#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int sum = 0, rest = 0;
    for (int i = 1; i <= 12; i++)
    {
        rest += 300;
        int n;
        cin >> n;
        rest -= n;
        if (rest < 0) return printf("%d", -i), 0;
        sum += rest / 100 * 100;
        rest %= 100;
    }
    printf("%d", rest + sum * 6 / 5);
    return 0;
}
