import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int[] array = {Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine())};
        
        int result = 0;
        int p = 0;
        int q = 0;
        int tmp = 0;
        
        for(int i = 0; i < array.length - 1; i++){
            for(int j = i; j < array.length; j++){
                p = array[i] % 10;
                if(p == 0){
                    p = 10;
                }
                q = array[j] % 10;
                if(q == 0){
                    q = 10;
                }
                
                if(p < q){
                    tmp = array[i];
                    array[i] = array[j];
                    array[j] = tmp;
                }
            }
        }
        
        
        for(int i = 0; i < array.length; i++){
            if(i > 0 && array[i - 1] % 10 != 0){
                result += 10 - (array[i - 1] % 10);
            }
            result += array[i];
        }
        
        System.out.println(result);
        
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int[] array = {Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine())};
        
        int result = 0;
        int p = 0;
        int q = 0;
        int tmp = 0;
        
        for(int i = 0; i < array.length - 1; i++){
            for(int j = i; j < array.length; j++){
                p = array[i] % 10;
                if(p == 0){
                    p = 10;
                }
                q = array[j] % 10;
                if(q == 0){
                    q = 10;
                }
                
                if(p < q){
                    tmp = array[i];
                    array[i] = array[j];
                    array[j] = tmp;
                }
            }
        }
        
        
        for(int i = 0; i < array.length; i++){
            if(i > 0 && array[i - 1] % 10 != 0){
                result += 10 - (array[i - 1] % 10);
            }
            result += array[i];
        }
        
        System.out.println(result);
        
    }
} Main public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int[] array = {Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine())};
        
        int result = 0;
        int p = 0;
        int q = 0;
        int tmp = 0;
        
        for(int i = 0; i < array.length - 1; i++){
            for(int j = i; j < array.length; j++){
                p = array[i] % 10;
                if(p == 0){
                    p = 10;
                }
                q = array[j] % 10;
                if(q == 0){
                    q = 10;
                }
                
                if(p < q){
                    tmp = array[i];
                    array[i] = array[j];
                    array[j] = tmp;
                }
            }
        }
        
        
        for(int i = 0; i < array.length; i++){
            if(i > 0 && array[i - 1] % 10 != 0){
                result += 10 - (array[i - 1] % 10);
            }
            result += array[i];
        }
        
        System.out.println(result);
        
    } main {
        
        Scanner sc = new Scanner(System.in);
        int[] array = {Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine())};
        
        int result = 0;
        int p = 0;
        int q = 0;
        int tmp = 0;
        
        for(int i = 0; i < array.length - 1; i++){
            for(int j = i; j < array.length; j++){
                p = array[i] % 10;
                if(p == 0){
                    p = 10;
                }
                q = array[j] % 10;
                if(q == 0){
                    q = 10;
                }
                
                if(p < q){
                    tmp = array[i];
                    array[i] = array[j];
                    array[j] = tmp;
                }
            }
        }
        
        
        for(int i = 0; i < array.length; i++){
            if(i > 0 && array[i - 1] % 10 != 0){
                result += 10 - (array[i - 1] % 10);
            }
            result += array[i];
        }
        
        System.out.println(result);
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] array = {Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine())}; array {Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine())} Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int result = 0; result 0 int p = 0; p 0 int q = 0; q 0 int tmp = 0; tmp 0 for(int i = 0; i < array.length - 1; i++){
            for(int j = i; j < array.length; j++){
                p = array[i] % 10;
                if(p == 0){
                    p = 10;
                }
                q = array[j] % 10;
                if(q == 0){
                    q = 10;
                }
                
                if(p < q){
                    tmp = array[i];
                    array[i] = array[j];
                    array[j] = tmp;
                }
            }
        } int i = 0; int i = 0; i 0 i < array.length - 1 i array.length - 1 array.length array array.length 1 i++ i++ i {
            for(int j = i; j < array.length; j++){
                p = array[i] % 10;
                if(p == 0){
                    p = 10;
                }
                q = array[j] % 10;
                if(q == 0){
                    q = 10;
                }
                
                if(p < q){
                    tmp = array[i];
                    array[i] = array[j];
                    array[j] = tmp;
                }
            }
        } {
            for(int j = i; j < array.length; j++){
                p = array[i] % 10;
                if(p == 0){
                    p = 10;
                }
                q = array[j] % 10;
                if(q == 0){
                    q = 10;
                }
                
                if(p < q){
                    tmp = array[i];
                    array[i] = array[j];
                    array[j] = tmp;
                }
            }
        } for(int j = i; j < array.length; j++){
                p = array[i] % 10;
                if(p == 0){
                    p = 10;
                }
                q = array[j] % 10;
                if(q == 0){
                    q = 10;
                }
                
                if(p < q){
                    tmp = array[i];
                    array[i] = array[j];
                    array[j] = tmp;
                }
            } int j = i; int j = i; j i j < array.length j array.length array array.length j++ j++ j {
                p = array[i] % 10;
                if(p == 0){
                    p = 10;
                }
                q = array[j] % 10;
                if(q == 0){
                    q = 10;
                }
                
                if(p < q){
                    tmp = array[i];
                    array[i] = array[j];
                    array[j] = tmp;
                }
            } {
                p = array[i] % 10;
                if(p == 0){
                    p = 10;
                }
                q = array[j] % 10;
                if(q == 0){
                    q = 10;
                }
                
                if(p < q){
                    tmp = array[i];
                    array[i] = array[j];
                    array[j] = tmp;
                }
            } p = array[i] % 10 p array[i] % 10 array[i] array i 10 if(p == 0){
                    p = 10;
                } p == 0 p 0 {
                    p = 10;
                } p = 10 p 10 q = array[j] % 10 q array[j] % 10 array[j] array j 10 if(q == 0){
                    q = 10;
                } q == 0 q 0 {
                    q = 10;
                } q = 10 q 10 if(p < q){
                    tmp = array[i];
                    array[i] = array[j];
                    array[j] = tmp;
                } p < q p q {
                    tmp = array[i];
                    array[i] = array[j];
                    array[j] = tmp;
                } tmp = array[i] tmp array[i] array i array[i] = array[j] array[i] array i array[j] array j array[j] = tmp array[j] array j tmp for(int i = 0; i < array.length; i++){
            if(i > 0 && array[i - 1] % 10 != 0){
                result += 10 - (array[i - 1] % 10);
            }
            result += array[i];
        } int i = 0; int i = 0; i 0 i < array.length i array.length array array.length i++ i++ i {
            if(i > 0 && array[i - 1] % 10 != 0){
                result += 10 - (array[i - 1] % 10);
            }
            result += array[i];
        } {
            if(i > 0 && array[i - 1] % 10 != 0){
                result += 10 - (array[i - 1] % 10);
            }
            result += array[i];
        } if(i > 0 && array[i - 1] % 10 != 0){
                result += 10 - (array[i - 1] % 10);
            } i > 0 && array[i - 1] % 10 != 0 i > 0 i 0 array[i - 1] % 10 != 0 array[i - 1] % 10 array[i - 1] array i - 1 i 1 10 0 {
                result += 10 - (array[i - 1] % 10);
            } result += 10 - (array[i - 1] % 10) result 10 - (array[i - 1] % 10) 10 (array[i - 1] % 10) array[i - 1] array i - 1 i 1 10 result += array[i] result array[i] array i System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int[] array = {Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine())};
        
        int result = 0;
        int p = 0;
        int q = 0;
        int tmp = 0;
        
        for(int i = 0; i < array.length - 1; i++){
            for(int j = i; j < array.length; j++){
                p = array[i] % 10;
                if(p == 0){
                    p = 10;
                }
                q = array[j] % 10;
                if(q == 0){
                    q = 10;
                }
                
                if(p < q){
                    tmp = array[i];
                    array[i] = array[j];
                    array[j] = tmp;
                }
            }
        }
        
        
        for(int i = 0; i < array.length; i++){
            if(i > 0 && array[i - 1] % 10 != 0){
                result += 10 - (array[i - 1] % 10);
            }
            result += array[i];
        }
        
        System.out.println(result);
        
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int[] array = {Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine())};
        
        int result = 0;
        int p = 0;
        int q = 0;
        int tmp = 0;
        
        for(int i = 0; i < array.length - 1; i++){
            for(int j = i; j < array.length; j++){
                p = array[i] % 10;
                if(p == 0){
                    p = 10;
                }
                q = array[j] % 10;
                if(q == 0){
                    q = 10;
                }
                
                if(p < q){
                    tmp = array[i];
                    array[i] = array[j];
                    array[j] = tmp;
                }
            }
        }
        
        
        for(int i = 0; i < array.length; i++){
            if(i > 0 && array[i - 1] % 10 != 0){
                result += 10 - (array[i - 1] % 10);
            }
            result += array[i];
        }
        
        System.out.println(result);
        
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int[] array = {Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine()),
                        Integer.parseInt(sc.nextLine())};
        
        int result = 0;
        int p = 0;
        int q = 0;
        int tmp = 0;
        
        for(int i = 0; i < array.length - 1; i++){
            for(int j = i; j < array.length; j++){
                p = array[i] % 10;
                if(p == 0){
                    p = 10;
                }
                q = array[j] % 10;
                if(q == 0){
                    q = 10;
                }
                
                if(p < q){
                    tmp = array[i];
                    array[i] = array[j];
                    array[j] = tmp;
                }
            }
        }
        
        
        for(int i = 0; i < array.length; i++){
            if(i > 0 && array[i - 1] % 10 != 0){
                result += 10 - (array[i - 1] % 10);
            }
            result += array[i];
        }
        
        System.out.println(result);
        
    }
}
