#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__va_args__,repi,_rep,)(__va_args__)
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(int argc, char* argv[]){
    int a[] = {0, 0, 0, 0, 0};
    rep(i, 5) cin >> a[i];

    int sum = 0;
    rep(i, 5){
        sum += a[i];
        if(a[i] % 10 != 0){
            sum += 10-(a[i] % 10);
        }
    }

    int min = 10;
    int mod;
    rep(i, 5){
        mod = a[i] % 10;
        if(mod != 0){
            min = std::min(min, mod);
        }
    }
    sum -= (10 - min);
    cout << sum << endl;
}