//1089
#include<stdio.h>
int main()
{
int i,output,save=0,leave=0;
for(i=1;i<=12;i++)
{
scanf("%d",&output);
if((300+leave-output)>=0)
{
if((300+leave-output)>=100)
{
save+=(300+leave-output)/100;
leave=(300+leave-output)%100;
}
else leave=300+leave-output;
}
else
{
printf("%d",-i);return 0;
}
}
printf("%d",leave+(int)save*120);
return 0;
}