var
i,c,s:longint;
fun:boolean;
mon:array [1..12] of integer;
begin
for i:=1 to 12 do read(mon[i]);
for i:=1 to 12 do begin
s:=s+300-mon[i];
c:=c+s div 100;
s:=s mod 100;
if s<0 then begin
write('-',i);
fun:=true;
exit;
end;
end;
if fun=true then i:=0 else write(s+120*c);
end.