#include<bits/stdc++.h>
using namespace std;

int main(){
   
	int cost,hand=0,cun=0;
	int flag=0;
	for(int i=1;i<=12;i++){
   
		cin>>cost;
		hand=hand+300-cost;
		if(hand<0){
   
			cout<<-i<<endl;
			flag=1;
			break;
		}
		else{
   
			cun=cun+hand/100;
			hand%=100;
		}
	}
	if(flag==0){
   
		cout<<120*cun+hand<<endl;
	}
	return 0;
}