#include<bits/stdc++.h>
using namespace std;
int main(){
int money=0,mama,cost,month;
bool flag=true;
for(int i=1;i<=12;i++){
money+=300;
cin>>cost;
money-=cost;
if(money<0){
flag=false;
month=i;
break;
}
}
mama+=money/100;
money%=100;
if(flag){
money+=mama*120;
cout<<money;
}else{
cout<<-month;
}
return 0;
}