#include <bits/stdc++.h>
using namespace std;

//C++14 (GCC 5.4.1)
int main() {
    vector<int> A=vector<int>(5,0);
    rep(i,5){
        cin>> A.at(i);
    }

    //-----------------------------------
    int Ans=0,minkire=10;
    rep(i,5){
        if(A.at(i)%10>0){
            chmin(minkire,A.at(i)%10);
            Ans+=(A.at(i)/10)*10+10;
        }else{
            Ans+=A.at(i);
        }
    }
    Ans=Ans-10+minkire;

    cout << Ans <<endl;
    return (0);
}