#include<bits/stdc++.h>
using namespace std;
int main(){
	vector<int> A(5);
	int count=0;
	for(int i=0;i<5;i++){
		cin>>A[i];
		count+=((A[i]+9)/10)*10;
		A[i]=(150-A[i])%10;
	}int k=*max_element(A.begin(),A.end());
	cout<<count-k<<endl;
}