#include<iostream>
using namespace std;
int main(){
    int t,sum,last;
    last=10;
    sum=0;
    for(int i=0;i<5;i++){
	cin>>t;
	if(t%10==0){
	    sum+=t;
	    continue;
	}
	last=last<t%10? last : t%10;
	sum+=(t/10+1)*10;
    }
    cout<<sum-10+last<<endl;
    return 0;
}