#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll i,r,mn=10,ans=0;ll a[6]={0};
    for(i=0;i<5;i++){
        cin >> a[i];
        r = a[i]%10;
        if(r<mn&&r>0)mn=r;
        ans += a[i]+10-r;
        if(r==0)ans -=10;
    }
    ans -= 10-mn;
    cout << ans << endl;
}
