#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#include <fstream>
#include <iterator>
using namespace std;
#include "prettyprint.hpp"

typedef long long ll;

int main()
{
    vector<int> dish(5);
    vector<int> flag(5, 0);

    int amari = 9;
    for (int i = 0; i < 5; ++i)
    {
        cin >> dish[i];
        if (dish[i] % 10 == 0)
        {
            flag[i] = 1;
        }
        else
        {
            amari = min(amari, dish[i] % 10);
            dish[i] += (10 - dish[i] % 10);
        }
    }
    // cout << dish << endl;
    // cout << amari << endl;

    int sum = 0;
    for (int i = 0; i < 5; ++i)
    {
        sum += dish[i];
    }

    int ansflag = 0;
    for (int i = 0; i < 5; ++i)
    {
        ansflag += flag[i];
    }

    if (ansflag == 5)
    {
        cout << sum << endl;
    }
    else
    {
        cout << sum - 10 + amari << endl;
    }
}