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

int main() {
    vector<int> menu(5);
    int num = 0;
    int sum = 0;
    int last = 10;
    for (int i = 0; i < 5; i++) {
        cin >> menu[i];
        int mod = menu[i] % 10;
        if (mod == 0) {
            sum += menu[i];
        } else {
            sum += menu[i] + (10 - mod);
        }
        if (mod != 0 && mod < last) {
            num = menu[i];
            last = mod;
        }
    }
    cout << sum - (10 - num % 10) << endl;
}
