import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
    
        int amtTime = 0;
        int maxLoss = 10;
        int maxLossNum = 0;
      	boolean a = true;
        
         List<Integer> Array = new ArrayList<>();
        
        while(sc.hasNextInt()) {
        	Array.add((Integer)sc.nextInt());
        }
        
        for(int i = 0; i < Array.size(); i++ ){
            if(Array.get(i) % 10 != 0 && maxLoss > Array.get(i) % 10){
                maxLoss = Array.get(i) % 10; 
                maxLossNum = Array.get(i);
            };
        }        
        for(int j = 0; j < Array.size(); j++ ){
            if(Array.get(j) == maxLossNum && a){
                a = false;
              	continue;
            }else{
            	int t = Array.get(j);
            	int rt = t % 10;
            	int adj = 0;
            	if(rt > 0){
            	    adj = 10 - rt;
            	}
            	amtTime += t + adj;
            }
        }
        
        	System.out.println(amtTime + maxLossNum);
    }
}
/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