#include<bits/stdc++.h>
#define rep(i,a) for(int i=0;i<a;i++)
using namespace std;
int test(int a){
    return (((a-1)/10+1)*10);
}
int main()
{
    vector<int> v;
    int minm=643;
    rep(i,5){
        int enter;
        cin>>enter;
        v.push_back(enter);
    }
    sort(v.begin(),v.end());
    do{
        minn=min(minn,test(v[0])+test(v[1])+test(v[2])+test(v[3])+v[4]);
    }while(next_permutation(v.begin(),v.end()));
  cout<<minn<<endl;
    return 0;
}
