import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int[] dishes = new int[5];
        for (int i = 0; i < dishes.length; i++) {
            dishes[i] = sc.nextInt();
        }

        int min = Integer.MAX_VALUE;
        int[] tmpOrder = new int[dishes.length];

        for (int a = 0; a < dishes.length; a++) {
            tmpOrder[0] = dishes[a];

            for (int b = 0; b < dishes.length; b++) {
                tmpOrder[1] = dishes[b];

                for (int c = 0; c < dishes.length; c++) {

                    tmpOrder[2] = dishes[c];

                    for (int d = 0; d < dishes.length; d++) {

                        tmpOrder[3] = dishes[d];

                        for (int e = 0; e < dishes.length; e++) {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        }
                    }
                }
            }
        }

        System.out.println(min);

    }

    private static boolean search(int[] array) {

        boolean exist = false;
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array.length; j++) {

                if (i == j) continue;

                if (array[i] == array[j]) {
                    exist = true;
                    break;
                }
            }
        }

        return exist;
    }

    private static int time(int[] dishes) {
        int time = 0;
        for (int i = 0; i < dishes.length; i++) {
            time += dishes[i];

            if (time % 10 == 0) continue;

            if (!(i == dishes.length -1)) {
                time += (10 - time % 10);
            }
        }

        return time;
    }
} import java.util.*; util.* java public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int[] dishes = new int[5];
        for (int i = 0; i < dishes.length; i++) {
            dishes[i] = sc.nextInt();
        }

        int min = Integer.MAX_VALUE;
        int[] tmpOrder = new int[dishes.length];

        for (int a = 0; a < dishes.length; a++) {
            tmpOrder[0] = dishes[a];

            for (int b = 0; b < dishes.length; b++) {
                tmpOrder[1] = dishes[b];

                for (int c = 0; c < dishes.length; c++) {

                    tmpOrder[2] = dishes[c];

                    for (int d = 0; d < dishes.length; d++) {

                        tmpOrder[3] = dishes[d];

                        for (int e = 0; e < dishes.length; e++) {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        }
                    }
                }
            }
        }

        System.out.println(min);

    }

    private static boolean search(int[] array) {

        boolean exist = false;
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array.length; j++) {

                if (i == j) continue;

                if (array[i] == array[j]) {
                    exist = true;
                    break;
                }
            }
        }

        return exist;
    }

    private static int time(int[] dishes) {
        int time = 0;
        for (int i = 0; i < dishes.length; i++) {
            time += dishes[i];

            if (time % 10 == 0) continue;

            if (!(i == dishes.length -1)) {
                time += (10 - time % 10);
            }
        }

        return time;
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int[] dishes = new int[5];
        for (int i = 0; i < dishes.length; i++) {
            dishes[i] = sc.nextInt();
        }

        int min = Integer.MAX_VALUE;
        int[] tmpOrder = new int[dishes.length];

        for (int a = 0; a < dishes.length; a++) {
            tmpOrder[0] = dishes[a];

            for (int b = 0; b < dishes.length; b++) {
                tmpOrder[1] = dishes[b];

                for (int c = 0; c < dishes.length; c++) {

                    tmpOrder[2] = dishes[c];

                    for (int d = 0; d < dishes.length; d++) {

                        tmpOrder[3] = dishes[d];

                        for (int e = 0; e < dishes.length; e++) {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        }
                    }
                }
            }
        }

        System.out.println(min);

    } main {
        Scanner sc = new Scanner(System.in);

        int[] dishes = new int[5];
        for (int i = 0; i < dishes.length; i++) {
            dishes[i] = sc.nextInt();
        }

        int min = Integer.MAX_VALUE;
        int[] tmpOrder = new int[dishes.length];

        for (int a = 0; a < dishes.length; a++) {
            tmpOrder[0] = dishes[a];

            for (int b = 0; b < dishes.length; b++) {
                tmpOrder[1] = dishes[b];

                for (int c = 0; c < dishes.length; c++) {

                    tmpOrder[2] = dishes[c];

                    for (int d = 0; d < dishes.length; d++) {

                        tmpOrder[3] = dishes[d];

                        for (int e = 0; e < dishes.length; e++) {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        }
                    }
                }
            }
        }

        System.out.println(min);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] dishes = new int[5]; dishes new int[5] 5 for (int i = 0; i < dishes.length; i++) {
            dishes[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < dishes.length i dishes.length dishes dishes.length i++ i++ i {
            dishes[i] = sc.nextInt();
        } {
            dishes[i] = sc.nextInt();
        } dishes[i] = sc.nextInt() dishes[i] dishes i sc.nextInt() sc.nextInt sc int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE int[] tmpOrder = new int[dishes.length]; tmpOrder new int[dishes.length] dishes.length dishes dishes.length for (int a = 0; a < dishes.length; a++) {
            tmpOrder[0] = dishes[a];

            for (int b = 0; b < dishes.length; b++) {
                tmpOrder[1] = dishes[b];

                for (int c = 0; c < dishes.length; c++) {

                    tmpOrder[2] = dishes[c];

                    for (int d = 0; d < dishes.length; d++) {

                        tmpOrder[3] = dishes[d];

                        for (int e = 0; e < dishes.length; e++) {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        }
                    }
                }
            }
        } int a = 0; int a = 0; a 0 a < dishes.length a dishes.length dishes dishes.length a++ a++ a {
            tmpOrder[0] = dishes[a];

            for (int b = 0; b < dishes.length; b++) {
                tmpOrder[1] = dishes[b];

                for (int c = 0; c < dishes.length; c++) {

                    tmpOrder[2] = dishes[c];

                    for (int d = 0; d < dishes.length; d++) {

                        tmpOrder[3] = dishes[d];

                        for (int e = 0; e < dishes.length; e++) {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        }
                    }
                }
            }
        } {
            tmpOrder[0] = dishes[a];

            for (int b = 0; b < dishes.length; b++) {
                tmpOrder[1] = dishes[b];

                for (int c = 0; c < dishes.length; c++) {

                    tmpOrder[2] = dishes[c];

                    for (int d = 0; d < dishes.length; d++) {

                        tmpOrder[3] = dishes[d];

                        for (int e = 0; e < dishes.length; e++) {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        }
                    }
                }
            }
        } tmpOrder[0] = dishes[a] tmpOrder[0] tmpOrder 0 dishes[a] dishes a for (int b = 0; b < dishes.length; b++) {
                tmpOrder[1] = dishes[b];

                for (int c = 0; c < dishes.length; c++) {

                    tmpOrder[2] = dishes[c];

                    for (int d = 0; d < dishes.length; d++) {

                        tmpOrder[3] = dishes[d];

                        for (int e = 0; e < dishes.length; e++) {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        }
                    }
                }
            } int b = 0; int b = 0; b 0 b < dishes.length b dishes.length dishes dishes.length b++ b++ b {
                tmpOrder[1] = dishes[b];

                for (int c = 0; c < dishes.length; c++) {

                    tmpOrder[2] = dishes[c];

                    for (int d = 0; d < dishes.length; d++) {

                        tmpOrder[3] = dishes[d];

                        for (int e = 0; e < dishes.length; e++) {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        }
                    }
                }
            } {
                tmpOrder[1] = dishes[b];

                for (int c = 0; c < dishes.length; c++) {

                    tmpOrder[2] = dishes[c];

                    for (int d = 0; d < dishes.length; d++) {

                        tmpOrder[3] = dishes[d];

                        for (int e = 0; e < dishes.length; e++) {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        }
                    }
                }
            } tmpOrder[1] = dishes[b] tmpOrder[1] tmpOrder 1 dishes[b] dishes b for (int c = 0; c < dishes.length; c++) {

                    tmpOrder[2] = dishes[c];

                    for (int d = 0; d < dishes.length; d++) {

                        tmpOrder[3] = dishes[d];

                        for (int e = 0; e < dishes.length; e++) {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        }
                    }
                } int c = 0; int c = 0; c 0 c < dishes.length c dishes.length dishes dishes.length c++ c++ c {

                    tmpOrder[2] = dishes[c];

                    for (int d = 0; d < dishes.length; d++) {

                        tmpOrder[3] = dishes[d];

                        for (int e = 0; e < dishes.length; e++) {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        }
                    }
                } {

                    tmpOrder[2] = dishes[c];

                    for (int d = 0; d < dishes.length; d++) {

                        tmpOrder[3] = dishes[d];

                        for (int e = 0; e < dishes.length; e++) {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        }
                    }
                } tmpOrder[2] = dishes[c] tmpOrder[2] tmpOrder 2 dishes[c] dishes c for (int d = 0; d < dishes.length; d++) {

                        tmpOrder[3] = dishes[d];

                        for (int e = 0; e < dishes.length; e++) {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        }
                    } int d = 0; int d = 0; d 0 d < dishes.length d dishes.length dishes dishes.length d++ d++ d {

                        tmpOrder[3] = dishes[d];

                        for (int e = 0; e < dishes.length; e++) {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        }
                    } {

                        tmpOrder[3] = dishes[d];

                        for (int e = 0; e < dishes.length; e++) {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        }
                    } tmpOrder[3] = dishes[d] tmpOrder[3] tmpOrder 3 dishes[d] dishes d for (int e = 0; e < dishes.length; e++) {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        } int e = 0; int e = 0; e 0 e < dishes.length e dishes.length dishes dishes.length e++ e++ e {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        } {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        } tmpOrder[4] = dishes[e] tmpOrder[4] tmpOrder 4 dishes[e] dishes e boolean exist = search(new int[]{a, b, c, d, e}); exist search(new int[]{a, b, c, d, e}) search new int[]{a, b, c, d, e} if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            } exist {
                                continue;
                            } continue; {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            } int tmpTime = time(tmpOrder); tmpTime time(tmpOrder) time tmpOrder if (min > tmpTime) {
                                    min = tmpTime;
                                } min > tmpTime min tmpTime {
                                    min = tmpTime;
                                } min = tmpTime min tmpTime System.out.println(min) System.out.println System.out System System.out min String[] args args private static boolean search(int[] array) {

        boolean exist = false;
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array.length; j++) {

                if (i == j) continue;

                if (array[i] == array[j]) {
                    exist = true;
                    break;
                }
            }
        }

        return exist;
    } search {

        boolean exist = false;
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array.length; j++) {

                if (i == j) continue;

                if (array[i] == array[j]) {
                    exist = true;
                    break;
                }
            }
        }

        return exist;
    } boolean exist = false; exist false for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array.length; j++) {

                if (i == j) continue;

                if (array[i] == array[j]) {
                    exist = true;
                    break;
                }
            }
        } int i = 0; int i = 0; i 0 i < array.length i array.length array array.length i++ i++ i {
            for (int j = 0; j < array.length; j++) {

                if (i == j) continue;

                if (array[i] == array[j]) {
                    exist = true;
                    break;
                }
            }
        } {
            for (int j = 0; j < array.length; j++) {

                if (i == j) continue;

                if (array[i] == array[j]) {
                    exist = true;
                    break;
                }
            }
        } for (int j = 0; j < array.length; j++) {

                if (i == j) continue;

                if (array[i] == array[j]) {
                    exist = true;
                    break;
                }
            } int j = 0; int j = 0; j 0 j < array.length j array.length array array.length j++ j++ j {

                if (i == j) continue;

                if (array[i] == array[j]) {
                    exist = true;
                    break;
                }
            } {

                if (i == j) continue;

                if (array[i] == array[j]) {
                    exist = true;
                    break;
                }
            } if (i == j) continue; i == j i j continue; if (array[i] == array[j]) {
                    exist = true;
                    break;
                } array[i] == array[j] array[i] array i array[j] array j {
                    exist = true;
                    break;
                } exist = true exist true break; return exist; exist int[] array array private static int time(int[] dishes) {
        int time = 0;
        for (int i = 0; i < dishes.length; i++) {
            time += dishes[i];

            if (time % 10 == 0) continue;

            if (!(i == dishes.length -1)) {
                time += (10 - time % 10);
            }
        }

        return time;
    } time {
        int time = 0;
        for (int i = 0; i < dishes.length; i++) {
            time += dishes[i];

            if (time % 10 == 0) continue;

            if (!(i == dishes.length -1)) {
                time += (10 - time % 10);
            }
        }

        return time;
    } int time = 0; time 0 for (int i = 0; i < dishes.length; i++) {
            time += dishes[i];

            if (time % 10 == 0) continue;

            if (!(i == dishes.length -1)) {
                time += (10 - time % 10);
            }
        } int i = 0; int i = 0; i 0 i < dishes.length i dishes.length dishes dishes.length i++ i++ i {
            time += dishes[i];

            if (time % 10 == 0) continue;

            if (!(i == dishes.length -1)) {
                time += (10 - time % 10);
            }
        } {
            time += dishes[i];

            if (time % 10 == 0) continue;

            if (!(i == dishes.length -1)) {
                time += (10 - time % 10);
            }
        } time += dishes[i] time dishes[i] dishes i if (time % 10 == 0) continue; time % 10 == 0 time % 10 time 10 0 continue; if (!(i == dishes.length -1)) {
                time += (10 - time % 10);
            } !(i == dishes.length -1) (i == dishes.length -1) i dishes.length -1 dishes.length dishes dishes.length 1 {
                time += (10 - time % 10);
            } time += (10 - time % 10) time (10 - time % 10) 10 time % 10 time 10 return time; time int[] dishes dishes public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int[] dishes = new int[5];
        for (int i = 0; i < dishes.length; i++) {
            dishes[i] = sc.nextInt();
        }

        int min = Integer.MAX_VALUE;
        int[] tmpOrder = new int[dishes.length];

        for (int a = 0; a < dishes.length; a++) {
            tmpOrder[0] = dishes[a];

            for (int b = 0; b < dishes.length; b++) {
                tmpOrder[1] = dishes[b];

                for (int c = 0; c < dishes.length; c++) {

                    tmpOrder[2] = dishes[c];

                    for (int d = 0; d < dishes.length; d++) {

                        tmpOrder[3] = dishes[d];

                        for (int e = 0; e < dishes.length; e++) {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        }
                    }
                }
            }
        }

        System.out.println(min);

    }

    private static boolean search(int[] array) {

        boolean exist = false;
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array.length; j++) {

                if (i == j) continue;

                if (array[i] == array[j]) {
                    exist = true;
                    break;
                }
            }
        }

        return exist;
    }

    private static int time(int[] dishes) {
        int time = 0;
        for (int i = 0; i < dishes.length; i++) {
            time += dishes[i];

            if (time % 10 == 0) continue;

            if (!(i == dishes.length -1)) {
                time += (10 - time % 10);
            }
        }

        return time;
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int[] dishes = new int[5];
        for (int i = 0; i < dishes.length; i++) {
            dishes[i] = sc.nextInt();
        }

        int min = Integer.MAX_VALUE;
        int[] tmpOrder = new int[dishes.length];

        for (int a = 0; a < dishes.length; a++) {
            tmpOrder[0] = dishes[a];

            for (int b = 0; b < dishes.length; b++) {
                tmpOrder[1] = dishes[b];

                for (int c = 0; c < dishes.length; c++) {

                    tmpOrder[2] = dishes[c];

                    for (int d = 0; d < dishes.length; d++) {

                        tmpOrder[3] = dishes[d];

                        for (int e = 0; e < dishes.length; e++) {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        }
                    }
                }
            }
        }

        System.out.println(min);

    }

    private static boolean search(int[] array) {

        boolean exist = false;
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array.length; j++) {

                if (i == j) continue;

                if (array[i] == array[j]) {
                    exist = true;
                    break;
                }
            }
        }

        return exist;
    }

    private static int time(int[] dishes) {
        int time = 0;
        for (int i = 0; i < dishes.length; i++) {
            time += dishes[i];

            if (time % 10 == 0) continue;

            if (!(i == dishes.length -1)) {
                time += (10 - time % 10);
            }
        }

        return time;
    }
} Main
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int[] dishes = new int[5];
        for (int i = 0; i < dishes.length; i++) {
            dishes[i] = sc.nextInt();
        }

        int min = Integer.MAX_VALUE;
        int[] tmpOrder = new int[dishes.length];

        for (int a = 0; a < dishes.length; a++) {
            tmpOrder[0] = dishes[a];

            for (int b = 0; b < dishes.length; b++) {
                tmpOrder[1] = dishes[b];

                for (int c = 0; c < dishes.length; c++) {

                    tmpOrder[2] = dishes[c];

                    for (int d = 0; d < dishes.length; d++) {

                        tmpOrder[3] = dishes[d];

                        for (int e = 0; e < dishes.length; e++) {
                            tmpOrder[4] = dishes[e];

                            // 同じ料理があったらスキップ
                            boolean exist = search(new int[]{a, b, c, d, e});
                            if (exist) {
                                continue;
                            } else {

                                int tmpTime = time(tmpOrder);
                                if (min > tmpTime) {
                                    min = tmpTime;
                                }
                            }
                        }
                    }
                }
            }
        }

        System.out.println(min);

    }

    private static boolean search(int[] array) {

        boolean exist = false;
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array.length; j++) {

                if (i == j) continue;

                if (array[i] == array[j]) {
                    exist = true;
                    break;
                }
            }
        }

        return exist;
    }

    private static int time(int[] dishes) {
        int time = 0;
        for (int i = 0; i < dishes.length; i++) {
            time += dishes[i];

            if (time % 10 == 0) continue;

            if (!(i == dishes.length -1)) {
                time += (10 - time % 10);
            }
        }

        return time;
    }
}
