#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;

const int INF = 200000000;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    vector<int> dish(5);
    REP(i, 5) {
        int a;
        cin >> a;
        dish[i] = a;
    }

    int min_r = 10;
    int min_index = 0;
    REP(i, 5) {
        if (dish[i] % 10 < min_r && dish[i] % 10 != 0) {
            min_r = dish[i] % 10;
            min_index = i;
        }
    }
    int sum = 0;
    REP(i, 5) {
        sum += dish[i];
        if (dish[i] % 10 != 0) {
            sum += 10 - (dish[i] % 10);
        }
    }
    if (min_index[min_index] % 10 != 0) {
        sum -= (10 - (dish[min_index] % 10));
    }

    cout << sum << endl;

    return 0;
}
