import java.util.*;
 
public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int[] A = new int[5];
      	int[] B = new int[5];
      	for(int i = 0; i < 5; i++){
        	A[i] = scan.nextInt();
          	B[i] = tenth(A[i]);
        }
      	int min = ichi(A[0]);
      	int pointer = 0;
      	int all = 0;
      	int k = 0;
      	for(int i = 0; i < 5; i++){
        	if(ichi(A[i]) < min && ichi(A[i]) != 0){
            	min = ichi(A[i]);
              	pointer = i;
            }
        }
      	all = B[0] + B[1] + B[2] + B[3] + B[4] - B[pointer];
      	all = all + A[pointer];
      	System.out.print(all);
    }
  	public static int tenth(int a){
    	while(a % 10 != 0){
        	a++;
        }
      	return a;
    }
  	public static int ichi(int b){
    	while(b >= 10){
        	b = b - 10;
        }
      	return b;
    }
 
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz