int main(void)
{
    vector<int> dishes(5, 0);
    for (int i = 0; i < 5; i++)
    {
        cin >> dishes.at(i);
    }

    vector<int> time(5, 0);
    for (int i = 0; i < 5; i++)
    {
        if (dishes.at(i) >= 10 && dishes.at(i) < 100)
        {
            time.at(i) = dishes.at(i) % 10;
        }
        else if (dishes.at(i) >= 100)
        {
            time.at(i) = dishes.at(i) % 10;
        }
        else
        {
            time.at(i) = dishes.at(i);
        }
    }

    // for (int i = 0; i < 5; i++)
    // {
    //     cout << time.at(i) << endl;
    // }

    int min = time.at(0) != 0 ? time.at(0) : 1;
    int location = 0;
    for (int i = 0; i < 5; i++)
    {
        if (min >= time.at(i) && time.at(i) != 0)
        {
            min = time.at(i);
            location = i;
        }
    }

    int sum = 0;
    int temp;
    for (int i = 0; i < 5; i++)
    {
        if (i != location)
        {
            sum += dishes.at(i);
        }
        if (sum % 10 != 0)
        {
            temp = sum % 10;
            sum += (10 - temp);
        }
    }
    sum += dishes.at(location);
    cout << sum << endl;
    return (0);
}