#include <stdio.h>
int main(){
	int a[5];
	scanf("%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&a[4]);
	int max = 0;
	int wait = 0;
	for(int i=0;i<5;i++){
		if(a[i]%10 == 0){
			wait+=a[i]
		}
		else{
			wait += (a[i]/10 + 1) *10;
			if(max<= (10 - a[i]%10)%10){
				max=(10 - a[i]%10)%10;
			}
		}
	}
	printf("%d",wait-max);
	return 0;
}