import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int [] Dish = new int [5];
        int time = 0;
        int max = 0;

        for(int i =0; i<5;i++){
            Dish[i] = scanner.nextInt();
            if(Dish[i]%10 == 0){
                time += Dish[i];
            }
            
            else{
                time += (10-(Dish[i]%10)) + Dish[i];
                
                if(10-(Dish[i]%10)>max){
                    max = 10-(Dish[i]%10);
                }
            }
        }
        
        System.out.println(time-max);
        
    }    
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int [] Dish = new int [5];
        int time = 0;
        int max = 0;

        for(int i =0; i<5;i++){
            Dish[i] = scanner.nextInt();
            if(Dish[i]%10 == 0){
                time += Dish[i];
            }
            
            else{
                time += (10-(Dish[i]%10)) + Dish[i];
                
                if(10-(Dish[i]%10)>max){
                    max = 10-(Dish[i]%10);
                }
            }
        }
        
        System.out.println(time-max);
        
    }    
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int [] Dish = new int [5];
        int time = 0;
        int max = 0;

        for(int i =0; i<5;i++){
            Dish[i] = scanner.nextInt();
            if(Dish[i]%10 == 0){
                time += Dish[i];
            }
            
            else{
                time += (10-(Dish[i]%10)) + Dish[i];
                
                if(10-(Dish[i]%10)>max){
                    max = 10-(Dish[i]%10);
                }
            }
        }
        
        System.out.println(time-max);
        
    } main {
        Scanner scanner = new Scanner(System.in);
        int [] Dish = new int [5];
        int time = 0;
        int max = 0;

        for(int i =0; i<5;i++){
            Dish[i] = scanner.nextInt();
            if(Dish[i]%10 == 0){
                time += Dish[i];
            }
            
            else{
                time += (10-(Dish[i]%10)) + Dish[i];
                
                if(10-(Dish[i]%10)>max){
                    max = 10-(Dish[i]%10);
                }
            }
        }
        
        System.out.println(time-max);
        
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int [] Dish = new int [5]; Dish new int [5] 5 int time = 0; time 0 int max = 0; max 0 for(int i =0; i<5;i++){
            Dish[i] = scanner.nextInt();
            if(Dish[i]%10 == 0){
                time += Dish[i];
            }
            
            else{
                time += (10-(Dish[i]%10)) + Dish[i];
                
                if(10-(Dish[i]%10)>max){
                    max = 10-(Dish[i]%10);
                }
            }
        } int i =0; int i =0; i 0 i<5 i 5 i++ i++ i {
            Dish[i] = scanner.nextInt();
            if(Dish[i]%10 == 0){
                time += Dish[i];
            }
            
            else{
                time += (10-(Dish[i]%10)) + Dish[i];
                
                if(10-(Dish[i]%10)>max){
                    max = 10-(Dish[i]%10);
                }
            }
        } {
            Dish[i] = scanner.nextInt();
            if(Dish[i]%10 == 0){
                time += Dish[i];
            }
            
            else{
                time += (10-(Dish[i]%10)) + Dish[i];
                
                if(10-(Dish[i]%10)>max){
                    max = 10-(Dish[i]%10);
                }
            }
        } Dish[i] = scanner.nextInt() Dish[i] Dish i scanner.nextInt() scanner.nextInt scanner if(Dish[i]%10 == 0){
                time += Dish[i];
            }
            
            else{
                time += (10-(Dish[i]%10)) + Dish[i];
                
                if(10-(Dish[i]%10)>max){
                    max = 10-(Dish[i]%10);
                }
            } Dish[i]%10 == 0 Dish[i]%10 Dish[i] Dish i 10 0 {
                time += Dish[i];
            } time += Dish[i] time Dish[i] Dish i {
                time += (10-(Dish[i]%10)) + Dish[i];
                
                if(10-(Dish[i]%10)>max){
                    max = 10-(Dish[i]%10);
                }
            } time += (10-(Dish[i]%10)) + Dish[i] time (10-(Dish[i]%10)) + Dish[i] (10-(Dish[i]%10)) 10 (Dish[i]%10) Dish[i] Dish i 10 Dish[i] Dish i if(10-(Dish[i]%10)>max){
                    max = 10-(Dish[i]%10);
                } 10-(Dish[i]%10)>max 10-(Dish[i]%10) 10 (Dish[i]%10) Dish[i] Dish i 10 max {
                    max = 10-(Dish[i]%10);
                } max = 10-(Dish[i]%10) max 10-(Dish[i]%10) 10 (Dish[i]%10) Dish[i] Dish i 10 System.out.println(time-max) System.out.println System.out System System.out time-max time max String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int [] Dish = new int [5];
        int time = 0;
        int max = 0;

        for(int i =0; i<5;i++){
            Dish[i] = scanner.nextInt();
            if(Dish[i]%10 == 0){
                time += Dish[i];
            }
            
            else{
                time += (10-(Dish[i]%10)) + Dish[i];
                
                if(10-(Dish[i]%10)>max){
                    max = 10-(Dish[i]%10);
                }
            }
        }
        
        System.out.println(time-max);
        
    }    
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int [] Dish = new int [5];
        int time = 0;
        int max = 0;

        for(int i =0; i<5;i++){
            Dish[i] = scanner.nextInt();
            if(Dish[i]%10 == 0){
                time += Dish[i];
            }
            
            else{
                time += (10-(Dish[i]%10)) + Dish[i];
                
                if(10-(Dish[i]%10)>max){
                    max = 10-(Dish[i]%10);
                }
            }
        }
        
        System.out.println(time-max);
        
    }    
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int [] Dish = new int [5];
        int time = 0;
        int max = 0;

        for(int i =0; i<5;i++){
            Dish[i] = scanner.nextInt();
            if(Dish[i]%10 == 0){
                time += Dish[i];
            }
            
            else{
                time += (10-(Dish[i]%10)) + Dish[i];
                
                if(10-(Dish[i]%10)>max){
                    max = 10-(Dish[i]%10);
                }
            }
        }
        
        System.out.println(time-max);
        
    }    
}