#include<iostream>
using namespace std;
int main(){
	int a,lowest,total=0;
	for(int i=0;i<5;i++){
		cin>>a;
		if(a%10&&(!i||a%10<lowest))lowest=a%10;
		total+=(a+9)/10*10;
	}
	cout<<total+lowest-(lowest?10:0)<<endl;
}