import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();
        int E = sc.nextInt();
        int N = 5;

        //注文してから届くまでの時間
        int[] time = {A, B, C, D, E};
        //注文してから次に注文できるまでの時間
        int[] nextTime = new int[N];

        for (int i = 0; i < N; i++) {
            if (time[i] % 10 == 0) {
                nextTime[i] = time[i];
            } else {
                nextTime[i] = time[i] - time[i] % 10 + 10;
            }
        }

        int ans = 999999999;

        for (int i = 0; i < N; i++) {
            int sumTime = 0;
            for (int j = 0; j < N; j++) {
                if (i == j) {
                    //最後の処理
                    sumTime += time[j];
                } else {
                    sumTime += nextTime[j];
                }
            }
            ans = Math.min(ans, sumTime);
        }

        System.out.println(ans);


    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();
        int E = sc.nextInt();
        int N = 5;

        //注文してから届くまでの時間
        int[] time = {A, B, C, D, E};
        //注文してから次に注文できるまでの時間
        int[] nextTime = new int[N];

        for (int i = 0; i < N; i++) {
            if (time[i] % 10 == 0) {
                nextTime[i] = time[i];
            } else {
                nextTime[i] = time[i] - time[i] % 10 + 10;
            }
        }

        int ans = 999999999;

        for (int i = 0; i < N; i++) {
            int sumTime = 0;
            for (int j = 0; j < N; j++) {
                if (i == j) {
                    //最後の処理
                    sumTime += time[j];
                } else {
                    sumTime += nextTime[j];
                }
            }
            ans = Math.min(ans, sumTime);
        }

        System.out.println(ans);


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

        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();
        int E = sc.nextInt();
        int N = 5;

        //注文してから届くまでの時間
        int[] time = {A, B, C, D, E};
        //注文してから次に注文できるまでの時間
        int[] nextTime = new int[N];

        for (int i = 0; i < N; i++) {
            if (time[i] % 10 == 0) {
                nextTime[i] = time[i];
            } else {
                nextTime[i] = time[i] - time[i] % 10 + 10;
            }
        }

        int ans = 999999999;

        for (int i = 0; i < N; i++) {
            int sumTime = 0;
            for (int j = 0; j < N; j++) {
                if (i == j) {
                    //最後の処理
                    sumTime += time[j];
                } else {
                    sumTime += nextTime[j];
                }
            }
            ans = Math.min(ans, sumTime);
        }

        System.out.println(ans);


    } main {

        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();
        int E = sc.nextInt();
        int N = 5;

        //注文してから届くまでの時間
        int[] time = {A, B, C, D, E};
        //注文してから次に注文できるまでの時間
        int[] nextTime = new int[N];

        for (int i = 0; i < N; i++) {
            if (time[i] % 10 == 0) {
                nextTime[i] = time[i];
            } else {
                nextTime[i] = time[i] - time[i] % 10 + 10;
            }
        }

        int ans = 999999999;

        for (int i = 0; i < N; i++) {
            int sumTime = 0;
            for (int j = 0; j < N; j++) {
                if (i == j) {
                    //最後の処理
                    sumTime += time[j];
                } else {
                    sumTime += nextTime[j];
                }
            }
            ans = Math.min(ans, sumTime);
        }

        System.out.println(ans);


    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int A = sc.nextInt(); A sc.nextInt() sc.nextInt sc int B = sc.nextInt(); B sc.nextInt() sc.nextInt sc int C = sc.nextInt(); C sc.nextInt() sc.nextInt sc int D = sc.nextInt(); D sc.nextInt() sc.nextInt sc int E = sc.nextInt(); E sc.nextInt() sc.nextInt sc int N = 5; N 5 int[] time = {A, B, C, D, E}; time {A, B, C, D, E} A B C D E int[] nextTime = new int[N]; nextTime new int[N] N for (int i = 0; i < N; i++) {
            if (time[i] % 10 == 0) {
                nextTime[i] = time[i];
            } else {
                nextTime[i] = time[i] - time[i] % 10 + 10;
            }
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            if (time[i] % 10 == 0) {
                nextTime[i] = time[i];
            } else {
                nextTime[i] = time[i] - time[i] % 10 + 10;
            }
        } {
            if (time[i] % 10 == 0) {
                nextTime[i] = time[i];
            } else {
                nextTime[i] = time[i] - time[i] % 10 + 10;
            }
        } if (time[i] % 10 == 0) {
                nextTime[i] = time[i];
            } else {
                nextTime[i] = time[i] - time[i] % 10 + 10;
            } time[i] % 10 == 0 time[i] % 10 time[i] time i 10 0 {
                nextTime[i] = time[i];
            } nextTime[i] = time[i] nextTime[i] nextTime i time[i] time i {
                nextTime[i] = time[i] - time[i] % 10 + 10;
            } nextTime[i] = time[i] - time[i] % 10 + 10 nextTime[i] nextTime i time[i] - time[i] % 10 + 10 time[i] - time[i] % 10 time[i] time i time[i] % 10 time[i] time i 10 10 int ans = 999999999; ans 999999999 for (int i = 0; i < N; i++) {
            int sumTime = 0;
            for (int j = 0; j < N; j++) {
                if (i == j) {
                    //最後の処理
                    sumTime += time[j];
                } else {
                    sumTime += nextTime[j];
                }
            }
            ans = Math.min(ans, sumTime);
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            int sumTime = 0;
            for (int j = 0; j < N; j++) {
                if (i == j) {
                    //最後の処理
                    sumTime += time[j];
                } else {
                    sumTime += nextTime[j];
                }
            }
            ans = Math.min(ans, sumTime);
        } {
            int sumTime = 0;
            for (int j = 0; j < N; j++) {
                if (i == j) {
                    //最後の処理
                    sumTime += time[j];
                } else {
                    sumTime += nextTime[j];
                }
            }
            ans = Math.min(ans, sumTime);
        } int sumTime = 0; sumTime 0 for (int j = 0; j < N; j++) {
                if (i == j) {
                    //最後の処理
                    sumTime += time[j];
                } else {
                    sumTime += nextTime[j];
                }
            } int j = 0; int j = 0; j 0 j < N j N j++ j++ j {
                if (i == j) {
                    //最後の処理
                    sumTime += time[j];
                } else {
                    sumTime += nextTime[j];
                }
            } {
                if (i == j) {
                    //最後の処理
                    sumTime += time[j];
                } else {
                    sumTime += nextTime[j];
                }
            } if (i == j) {
                    //最後の処理
                    sumTime += time[j];
                } else {
                    sumTime += nextTime[j];
                } i == j i j {
                    //最後の処理
                    sumTime += time[j];
                } sumTime += time[j] sumTime time[j] time j {
                    sumTime += nextTime[j];
                } sumTime += nextTime[j] sumTime nextTime[j] nextTime j ans = Math.min(ans, sumTime) ans Math.min(ans, sumTime) Math.min Math ans sumTime System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();
        int E = sc.nextInt();
        int N = 5;

        //注文してから届くまでの時間
        int[] time = {A, B, C, D, E};
        //注文してから次に注文できるまでの時間
        int[] nextTime = new int[N];

        for (int i = 0; i < N; i++) {
            if (time[i] % 10 == 0) {
                nextTime[i] = time[i];
            } else {
                nextTime[i] = time[i] - time[i] % 10 + 10;
            }
        }

        int ans = 999999999;

        for (int i = 0; i < N; i++) {
            int sumTime = 0;
            for (int j = 0; j < N; j++) {
                if (i == j) {
                    //最後の処理
                    sumTime += time[j];
                } else {
                    sumTime += nextTime[j];
                }
            }
            ans = Math.min(ans, sumTime);
        }

        System.out.println(ans);


    }
} public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();
        int E = sc.nextInt();
        int N = 5;

        //注文してから届くまでの時間
        int[] time = {A, B, C, D, E};
        //注文してから次に注文できるまでの時間
        int[] nextTime = new int[N];

        for (int i = 0; i < N; i++) {
            if (time[i] % 10 == 0) {
                nextTime[i] = time[i];
            } else {
                nextTime[i] = time[i] - time[i] % 10 + 10;
            }
        }

        int ans = 999999999;

        for (int i = 0; i < N; i++) {
            int sumTime = 0;
            for (int j = 0; j < N; j++) {
                if (i == j) {
                    //最後の処理
                    sumTime += time[j];
                } else {
                    sumTime += nextTime[j];
                }
            }
            ans = Math.min(ans, sumTime);
        }

        System.out.println(ans);


    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();
        int E = sc.nextInt();
        int N = 5;

        //注文してから届くまでの時間
        int[] time = {A, B, C, D, E};
        //注文してから次に注文できるまでの時間
        int[] nextTime = new int[N];

        for (int i = 0; i < N; i++) {
            if (time[i] % 10 == 0) {
                nextTime[i] = time[i];
            } else {
                nextTime[i] = time[i] - time[i] % 10 + 10;
            }
        }

        int ans = 999999999;

        for (int i = 0; i < N; i++) {
            int sumTime = 0;
            for (int j = 0; j < N; j++) {
                if (i == j) {
                    //最後の処理
                    sumTime += time[j];
                } else {
                    sumTime += nextTime[j];
                }
            }
            ans = Math.min(ans, sumTime);
        }

        System.out.println(ans);


    }
}
