#include <bits/stdc++.h>
using namespace std;
#define rep0(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep1(i,n) for(long long i=1;i<=(long long)(n);i++)
#define all(v) v.begin(),v.end()
#define Sort(v) sort(all(v))
#define Reverse(v) reverse(all(v))
#define Rsort(v) sort(all(v),greater)
#define pub(v) push_back(v)
#define pob(v) pop_back(v)
typedef long long ll;
typedef vector<ll> vel;
typedef vector<vector<ll>> vel2d;
typedef string str;
typedef pair<ll,ll> pal;
typedef vector<str> ves;
typedef vector<char> vech;


int main() {
    vel a(5); rep0(i,5){cin>>a[i];}
    vel data(5);
    rep0(i,5){if(a[i]%10==0){data[i]=(a[i]/10)*10-a[i];} else{data[i]=(a[i]/10+1)*10-a[i];}}
    sort(all(data));
    ll ans=0;
    rep0(i,4){ans+=a[i]+data[i];//cout<<ans<<endl;}
    ans+=a[4];
    cout<<ans<<endl;
}
