#include <iostream>
using namespace std;
int a,b,c=10,ans;
int main(void){
    for(int i=0;i<5;i++){
        cin>>a;
        ans+=a/10*10;
        b=a%10;
        if(b==0)b=10;
        else ans+=10;
        c=min(c,b);
    }
    ans-=10-c;
    cout<<ans<<endl;
}
