const maxn = 1000;
oo = 1000000000;
var n,i,j: longint;
f,p: array[0..maxn] of longint;
dp: array[0..maxn,0..maxn] of longint;
min: longint;
begin
readln(n);
f[0]:=0;
for i:=1 to n do
begin
readln(p[i]);
if p[i]>100 then f[i]:=f[i-1]+1
else f[i]:=f[i-1];
end;
dp[0,0]:=0;
for i:=1 to n do
for j:=0 to f[i] do
begin
dp[i,j]:=oo;
if j<=f[i-1] then dp[i,j]:=dp[i-1,j]+p[i];
if (dp[i-1,j-1]+p[i]<dp[i,j]) and (p[i]>100) and (j>0) then dp[i,j]:=dp[i-1,j-1]+p[i];
if (dp[i-1,j+1]<dp[i,j]) and (j<f[i-1]) then dp[i,j]:=dp[i-1,j+1];
end;
min:=oo;
for i:=0 to f[n] do
if dp[n,i]<min then min:=dp[n,i];
writeln(min);
end.
Y29uc3QgbWF4biA9IDEwMDA7CiAgICAgIG9vID0gMTAwMDAwMDAwMDsKdmFyIG4saSxqOiBsb25naW50OwogICAgZixwOiBhcnJheVswLi5tYXhuXSBvZiBsb25naW50OwogICAgZHA6IGFycmF5WzAuLm1heG4sMC4ubWF4bl0gb2YgbG9uZ2ludDsKICAgIG1pbjogbG9uZ2ludDsKYmVnaW4KICByZWFkbG4obik7CiAgZlswXTo9MDsKICBmb3IgaTo9MSB0byBuIGRvCiAgYmVnaW4KICAgIHJlYWRsbihwW2ldKTsKICAgIGlmIHBbaV0+MTAwIHRoZW4gZltpXTo9ZltpLTFdKzEKICAgIGVsc2UgZltpXTo9ZltpLTFdOwogIGVuZDsKICBkcFswLDBdOj0wOwogIGZvciBpOj0xIHRvIG4gZG8KICBmb3Igajo9MCB0byBmW2ldIGRvCiAgYmVnaW4KICAgIGRwW2ksal06PW9vOwogICAgaWYgajw9ZltpLTFdIHRoZW4gZHBbaSxqXTo9ZHBbaS0xLGpdK3BbaV07CiAgICBpZiAoZHBbaS0xLGotMV0rcFtpXTxkcFtpLGpdKSBhbmQgKHBbaV0+MTAwKSBhbmQgKGo+MCkgdGhlbiBkcFtpLGpdOj1kcFtpLTEsai0xXStwW2ldOwogICAgaWYgKGRwW2ktMSxqKzFdPGRwW2ksal0pIGFuZCAoajxmW2ktMV0pIHRoZW4gZHBbaSxqXTo9ZHBbaS0xLGorMV07CiAgZW5kOwogIG1pbjo9b287CiAgZm9yIGk6PTAgdG8gZltuXSBkbwogIGlmIGRwW24saV08bWluIHRoZW4gbWluOj1kcFtuLGldOwogIHdyaXRlbG4obWluKTsKZW5kLg==