#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
int a=10,aa[10],b=0;
signed main()
{
	rep(i,5){
		cin>>aa[i];
		if(a>(aa[i]%10)&&aa[i]%10!=0){
			a=(aa[i]%10);
		}
	}
	rep(i,5){
		b+=(((aa[i]-1)/10)+1)*10;
	}
	cout<<b+a-10;
}