#include <stdio.h>

int main(void)
{
	int i,a[5],j,temp;
	int time = 0;
	
	for(i = 0; i < 5; i++){
		scanf("%d",&a[i]);
	}
	
	int hosuu[5];
	
	
	//補数の計算
	
	for(i = 0; i < 5; i++){
		hosuu[i] = 10 - a[i]%10;
		if(hosuu[i] == 10){
			hosuu[i] = 0;
		}
	}
	
	//ソート
	for(i = 0; i < 5; i++){
		for(j = i + 1; j < 5; j++){
			if(hosuu[i] > hosuu[j]){
				temp = hosuu[i];
				hosuu[i] = hosuu[j];
				hosuu[j] = temp;
				temp = a[i];
				a[i] = a[j];
				a[j] = temp;								
			}
		}
	}
	
	//時間の計算
	
	for(i = 4; i >= 0 ; i--){
		if(i != 0){
			time = time + a[i] + hosuu[i];
		}else{
			time = time + a[i]; 
	
	printf("%d",time);
	
	return 0;
}
	
	