#include <iostream>
using namespace std;
int main()
{
int ys = 0; // 预算
int a = 0; // 手里的钱
int mm = 0;
for (int i = 1; i <= 12; i++)
{
cin >> ys;
a += 300;
if (ys > a)
{
cout << -i;
return 0;
}
a -= ys;
mm += a / 100 * 100;
a %= 100;
}
cout << mm * 1.2 + a;
return 0;
}