#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;
int main(){
int count=0;
int min=9999;
int temp=0;
	int a[5];
	cin>>a[0]>>a[1]<<a[2]<<a[3]<<a[4];
	do{
	for(int i=0;i<4;++i){
		for(int j=0;j<a[i];j+=10){
		temp=j;}
		count+=temp;
	}
    	count+=a[4];
	if(min>count)
		min=count;



	count=0;
	temp=0;
		
		

	
	}while(next_permutation(a,a+5)):
	cout<<min<<endl;

	return 0;
}
	
	