import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] food = new int[5];
        food[0] = Integer.parseInt(sc.nextLine());
        food[1] = Integer.parseInt(sc.nextLine());
        food[2] = Integer.parseInt(sc.nextLine());
        food[3] = Integer.parseInt(sc.nextLine());
        food[4] = Integer.parseInt(sc.nextLine());
        int[] food2 = new int[5];
        System.arraycopy(food,0,food2,0,food.length);
        int num = 0;
        int sum = 0;
        num = calc(food2);
        int mod = 0;
        for(int i = 0;i < 5;i++){
            mod = food[i] % 10;
            if (mod != 0) {
                food[i] = food[i] + (10 -mod);
            }
            sum = sum + food[i];
        }
        System.out.println(sum-num);
    }
    public static int calc(int[] ary) {
        int num = 9;
        int flg = 0;
        ary[0] = ary[0] % 10;
        ary[1] = ary[1] % 10;
        ary[2] = ary[2] % 10;
        ary[3] = ary[3] % 10;
        ary[4] = ary[4] % 10;
        for (int i = 0;i < 4;i++){
            if (ary[i] != 0){
                num = Math.min(num,ary[i]);
                flg = 1;
            }
        }
        if (flg == 0) {
            return 0;
        } else {
            return 10-num;
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] food = new int[5];
        food[0] = Integer.parseInt(sc.nextLine());
        food[1] = Integer.parseInt(sc.nextLine());
        food[2] = Integer.parseInt(sc.nextLine());
        food[3] = Integer.parseInt(sc.nextLine());
        food[4] = Integer.parseInt(sc.nextLine());
        int[] food2 = new int[5];
        System.arraycopy(food,0,food2,0,food.length);
        int num = 0;
        int sum = 0;
        num = calc(food2);
        int mod = 0;
        for(int i = 0;i < 5;i++){
            mod = food[i] % 10;
            if (mod != 0) {
                food[i] = food[i] + (10 -mod);
            }
            sum = sum + food[i];
        }
        System.out.println(sum-num);
    }
    public static int calc(int[] ary) {
        int num = 9;
        int flg = 0;
        ary[0] = ary[0] % 10;
        ary[1] = ary[1] % 10;
        ary[2] = ary[2] % 10;
        ary[3] = ary[3] % 10;
        ary[4] = ary[4] % 10;
        for (int i = 0;i < 4;i++){
            if (ary[i] != 0){
                num = Math.min(num,ary[i]);
                flg = 1;
            }
        }
        if (flg == 0) {
            return 0;
        } else {
            return 10-num;
        }
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] food = new int[5];
        food[0] = Integer.parseInt(sc.nextLine());
        food[1] = Integer.parseInt(sc.nextLine());
        food[2] = Integer.parseInt(sc.nextLine());
        food[3] = Integer.parseInt(sc.nextLine());
        food[4] = Integer.parseInt(sc.nextLine());
        int[] food2 = new int[5];
        System.arraycopy(food,0,food2,0,food.length);
        int num = 0;
        int sum = 0;
        num = calc(food2);
        int mod = 0;
        for(int i = 0;i < 5;i++){
            mod = food[i] % 10;
            if (mod != 0) {
                food[i] = food[i] + (10 -mod);
            }
            sum = sum + food[i];
        }
        System.out.println(sum-num);
    } main {
        Scanner sc = new Scanner(System.in);
        int[] food = new int[5];
        food[0] = Integer.parseInt(sc.nextLine());
        food[1] = Integer.parseInt(sc.nextLine());
        food[2] = Integer.parseInt(sc.nextLine());
        food[3] = Integer.parseInt(sc.nextLine());
        food[4] = Integer.parseInt(sc.nextLine());
        int[] food2 = new int[5];
        System.arraycopy(food,0,food2,0,food.length);
        int num = 0;
        int sum = 0;
        num = calc(food2);
        int mod = 0;
        for(int i = 0;i < 5;i++){
            mod = food[i] % 10;
            if (mod != 0) {
                food[i] = food[i] + (10 -mod);
            }
            sum = sum + food[i];
        }
        System.out.println(sum-num);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] food = new int[5]; food new int[5] 5 food[0] = Integer.parseInt(sc.nextLine()) food[0] food 0 Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc food[1] = Integer.parseInt(sc.nextLine()) food[1] food 1 Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc food[2] = Integer.parseInt(sc.nextLine()) food[2] food 2 Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc food[3] = Integer.parseInt(sc.nextLine()) food[3] food 3 Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc food[4] = Integer.parseInt(sc.nextLine()) food[4] food 4 Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int[] food2 = new int[5]; food2 new int[5] 5 System.arraycopy(food,0,food2,0,food.length) System.arraycopy System food 0 food2 0 food.length food food.length int num = 0; num 0 int sum = 0; sum 0 num = calc(food2) num calc(food2) calc food2 int mod = 0; mod 0 for(int i = 0;i < 5;i++){
            mod = food[i] % 10;
            if (mod != 0) {
                food[i] = food[i] + (10 -mod);
            }
            sum = sum + food[i];
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            mod = food[i] % 10;
            if (mod != 0) {
                food[i] = food[i] + (10 -mod);
            }
            sum = sum + food[i];
        } {
            mod = food[i] % 10;
            if (mod != 0) {
                food[i] = food[i] + (10 -mod);
            }
            sum = sum + food[i];
        } mod = food[i] % 10 mod food[i] % 10 food[i] food i 10 if (mod != 0) {
                food[i] = food[i] + (10 -mod);
            } mod != 0 mod 0 {
                food[i] = food[i] + (10 -mod);
            } food[i] = food[i] + (10 -mod) food[i] food i food[i] + (10 -mod) food[i] food i (10 -mod) 10 mod sum = sum + food[i] sum sum + food[i] sum food[i] food i System.out.println(sum-num) System.out.println System.out System System.out sum-num sum num String[] args args public static int calc(int[] ary) {
        int num = 9;
        int flg = 0;
        ary[0] = ary[0] % 10;
        ary[1] = ary[1] % 10;
        ary[2] = ary[2] % 10;
        ary[3] = ary[3] % 10;
        ary[4] = ary[4] % 10;
        for (int i = 0;i < 4;i++){
            if (ary[i] != 0){
                num = Math.min(num,ary[i]);
                flg = 1;
            }
        }
        if (flg == 0) {
            return 0;
        } else {
            return 10-num;
        }
    } calc {
        int num = 9;
        int flg = 0;
        ary[0] = ary[0] % 10;
        ary[1] = ary[1] % 10;
        ary[2] = ary[2] % 10;
        ary[3] = ary[3] % 10;
        ary[4] = ary[4] % 10;
        for (int i = 0;i < 4;i++){
            if (ary[i] != 0){
                num = Math.min(num,ary[i]);
                flg = 1;
            }
        }
        if (flg == 0) {
            return 0;
        } else {
            return 10-num;
        }
    } int num = 9; num 9 int flg = 0; flg 0 ary[0] = ary[0] % 10 ary[0] ary 0 ary[0] % 10 ary[0] ary 0 10 ary[1] = ary[1] % 10 ary[1] ary 1 ary[1] % 10 ary[1] ary 1 10 ary[2] = ary[2] % 10 ary[2] ary 2 ary[2] % 10 ary[2] ary 2 10 ary[3] = ary[3] % 10 ary[3] ary 3 ary[3] % 10 ary[3] ary 3 10 ary[4] = ary[4] % 10 ary[4] ary 4 ary[4] % 10 ary[4] ary 4 10 for (int i = 0;i < 4;i++){
            if (ary[i] != 0){
                num = Math.min(num,ary[i]);
                flg = 1;
            }
        } int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
            if (ary[i] != 0){
                num = Math.min(num,ary[i]);
                flg = 1;
            }
        } {
            if (ary[i] != 0){
                num = Math.min(num,ary[i]);
                flg = 1;
            }
        } if (ary[i] != 0){
                num = Math.min(num,ary[i]);
                flg = 1;
            } ary[i] != 0 ary[i] ary i 0 {
                num = Math.min(num,ary[i]);
                flg = 1;
            } num = Math.min(num,ary[i]) num Math.min(num,ary[i]) Math.min Math num ary[i] ary i flg = 1 flg 1 if (flg == 0) {
            return 0;
        } else {
            return 10-num;
        } flg == 0 flg 0 {
            return 0;
        } return 0; 0 {
            return 10-num;
        } return 10-num; 10-num 10 num int[] ary ary public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] food = new int[5];
        food[0] = Integer.parseInt(sc.nextLine());
        food[1] = Integer.parseInt(sc.nextLine());
        food[2] = Integer.parseInt(sc.nextLine());
        food[3] = Integer.parseInt(sc.nextLine());
        food[4] = Integer.parseInt(sc.nextLine());
        int[] food2 = new int[5];
        System.arraycopy(food,0,food2,0,food.length);
        int num = 0;
        int sum = 0;
        num = calc(food2);
        int mod = 0;
        for(int i = 0;i < 5;i++){
            mod = food[i] % 10;
            if (mod != 0) {
                food[i] = food[i] + (10 -mod);
            }
            sum = sum + food[i];
        }
        System.out.println(sum-num);
    }
    public static int calc(int[] ary) {
        int num = 9;
        int flg = 0;
        ary[0] = ary[0] % 10;
        ary[1] = ary[1] % 10;
        ary[2] = ary[2] % 10;
        ary[3] = ary[3] % 10;
        ary[4] = ary[4] % 10;
        for (int i = 0;i < 4;i++){
            if (ary[i] != 0){
                num = Math.min(num,ary[i]);
                flg = 1;
            }
        }
        if (flg == 0) {
            return 0;
        } else {
            return 10-num;
        }
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] food = new int[5];
        food[0] = Integer.parseInt(sc.nextLine());
        food[1] = Integer.parseInt(sc.nextLine());
        food[2] = Integer.parseInt(sc.nextLine());
        food[3] = Integer.parseInt(sc.nextLine());
        food[4] = Integer.parseInt(sc.nextLine());
        int[] food2 = new int[5];
        System.arraycopy(food,0,food2,0,food.length);
        int num = 0;
        int sum = 0;
        num = calc(food2);
        int mod = 0;
        for(int i = 0;i < 5;i++){
            mod = food[i] % 10;
            if (mod != 0) {
                food[i] = food[i] + (10 -mod);
            }
            sum = sum + food[i];
        }
        System.out.println(sum-num);
    }
    public static int calc(int[] ary) {
        int num = 9;
        int flg = 0;
        ary[0] = ary[0] % 10;
        ary[1] = ary[1] % 10;
        ary[2] = ary[2] % 10;
        ary[3] = ary[3] % 10;
        ary[4] = ary[4] % 10;
        for (int i = 0;i < 4;i++){
            if (ary[i] != 0){
                num = Math.min(num,ary[i]);
                flg = 1;
            }
        }
        if (flg == 0) {
            return 0;
        } else {
            return 10-num;
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] food = new int[5];
        food[0] = Integer.parseInt(sc.nextLine());
        food[1] = Integer.parseInt(sc.nextLine());
        food[2] = Integer.parseInt(sc.nextLine());
        food[3] = Integer.parseInt(sc.nextLine());
        food[4] = Integer.parseInt(sc.nextLine());
        int[] food2 = new int[5];
        System.arraycopy(food,0,food2,0,food.length);
        int num = 0;
        int sum = 0;
        num = calc(food2);
        int mod = 0;
        for(int i = 0;i < 5;i++){
            mod = food[i] % 10;
            if (mod != 0) {
                food[i] = food[i] + (10 -mod);
            }
            sum = sum + food[i];
        }
        System.out.println(sum-num);
    }
    public static int calc(int[] ary) {
        int num = 9;
        int flg = 0;
        ary[0] = ary[0] % 10;
        ary[1] = ary[1] % 10;
        ary[2] = ary[2] % 10;
        ary[3] = ary[3] % 10;
        ary[4] = ary[4] % 10;
        for (int i = 0;i < 4;i++){
            if (ary[i] != 0){
                num = Math.min(num,ary[i]);
                flg = 1;
            }
        }
        if (flg == 0) {
            return 0;
        } else {
            return 10-num;
        }
    }
}
