#include <bits/stdc++.h>

using namespace std;

int main() {
    vector<int> A(5);
    for (auto &a: A) cin >> a;

    int mi = 10, sum = 0;
    for (const auto &a: A){
        sum += (a + 9) / 10 * 10;
        if (a % 10 != 0)
            mi = min(mi, a % 10);
    }

    cout << sum + mi - 10 << endl;
}