#include <bits/stdc++.h>
using namespace std;

int main(){
    vector<int> menu(5);
    int mini = 9;
    for (int i = 0; i < 5; i++){
        int a;
        cin >> a;
        pair<int,int> p = make_pair(a%10,a);
        menu[i] = p;
        if (a != 0){
            mini = min(mini,a%10);
        }
    }

    int sum = 0;

    for (int i = 0; i < 5; i++){
        if (menu[i].first == 0){
            sum += menu[i].second / 10;
        }else if (menu[i].first == mini){
            sum += menu[i].second;
        }else{
            sum += (menu[i].second/10)*10 + 10;
        }
    }

    cout << sum << endl;
}