#include<bits/stdc++.h>
using namespace std;
int money,spend,mum,nomoney=1,nomoneymonth;
int main(){
for(int i=1;i<=12;i++){
money+=300;
cin>>spend;
money=money-spend;
if(money<0){
nomoney=0;
nomoneymonth=i;
break;
}
mum+=money/100;
money=money%100;
}
if(nomoney=1){
cout<<money+mum*120;
}
else{
cout<<-nomoneymonth;
}
return 0;
}