#include <bits/stdc++.h>
int main(){
int money[12];
int mother,hand,ans;
int outputAns = 1;
for(int i=0;i<12;i++){
scanf("%d",&money[i]);
}
hand,mother = 0;
for(int i=0;i<12;i++){
hand = hand + 300;
if((hand - money[i]) < 0){
printf("-%d",i+1);
outputAns = 0;
break;
}else if((hand - money[i])/100 > 0){
hand = hand - ((hand-money[i])/100)*100;
mother = mother + ((hand-money[i])/100)*100;
hand = hand - money[i];
}
}
ans = hand + mother*0.2;
if(outputAns){
printf("%d",ans);
}
return 0;
}