#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod=1e9+7;

int main(){
#include <bits/stdc++.h>

using namespace std;

int main(){
    int diffMax = 0;
    int ans = 0;
    for (int i = 0; i < 5; ++i) {
        int a;
        cin >> a;

        int aa = ((a + 9) / 10) * 10;
        ans += aa;
        diffMax = max(diffMax, aa - a);
    }

    cout << ans - diffMax << endl;
    return 0;
}