import java.util.Scanner;

public class Main {

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

        int[] menu = new int[5];
        //        String s = sc.next();

        int ans = 0;
        int max = 0;
        int idx = 0;
        //        boolean ans = false;

        for (int i = 0; i < 5; i++) {
            menu[i] = sc.nextInt();
            if (max < (10 - (menu[i] % 10)) && (10 - (menu[i] % 10)) != 10) {
                max = 10 - (menu[i] % 10);
                idx = i;
            }
        }

        //        if ((Math.abs(ant[0] - ant[1]) > k) )
        //            ans = true;

        sc.close();

        for (int i = 0; i < 5; i++) {
            if (idx != i) {
                if ((10 - (menu[i] % 10)) == 10) {
                    ans += menu[i];
                } else {
                    ans += menu[i] + (10 - (menu[i] % 10));
                }
            }
        }
        ans += menu[idx];
        //        System.out.println(ans ? ":(" : "Yay!");
        System.out.println(ans);

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

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

        int[] menu = new int[5];
        //        String s = sc.next();

        int ans = 0;
        int max = 0;
        int idx = 0;
        //        boolean ans = false;

        for (int i = 0; i < 5; i++) {
            menu[i] = sc.nextInt();
            if (max < (10 - (menu[i] % 10)) && (10 - (menu[i] % 10)) != 10) {
                max = 10 - (menu[i] % 10);
                idx = i;
            }
        }

        //        if ((Math.abs(ant[0] - ant[1]) > k) )
        //            ans = true;

        sc.close();

        for (int i = 0; i < 5; i++) {
            if (idx != i) {
                if ((10 - (menu[i] % 10)) == 10) {
                    ans += menu[i];
                } else {
                    ans += menu[i] + (10 - (menu[i] % 10));
                }
            }
        }
        ans += menu[idx];
        //        System.out.println(ans ? ":(" : "Yay!");
        System.out.println(ans);

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

        int[] menu = new int[5];
        //        String s = sc.next();

        int ans = 0;
        int max = 0;
        int idx = 0;
        //        boolean ans = false;

        for (int i = 0; i < 5; i++) {
            menu[i] = sc.nextInt();
            if (max < (10 - (menu[i] % 10)) && (10 - (menu[i] % 10)) != 10) {
                max = 10 - (menu[i] % 10);
                idx = i;
            }
        }

        //        if ((Math.abs(ant[0] - ant[1]) > k) )
        //            ans = true;

        sc.close();

        for (int i = 0; i < 5; i++) {
            if (idx != i) {
                if ((10 - (menu[i] % 10)) == 10) {
                    ans += menu[i];
                } else {
                    ans += menu[i] + (10 - (menu[i] % 10));
                }
            }
        }
        ans += menu[idx];
        //        System.out.println(ans ? ":(" : "Yay!");
        System.out.println(ans);

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

        int[] menu = new int[5];
        //        String s = sc.next();

        int ans = 0;
        int max = 0;
        int idx = 0;
        //        boolean ans = false;

        for (int i = 0; i < 5; i++) {
            menu[i] = sc.nextInt();
            if (max < (10 - (menu[i] % 10)) && (10 - (menu[i] % 10)) != 10) {
                max = 10 - (menu[i] % 10);
                idx = i;
            }
        }

        //        if ((Math.abs(ant[0] - ant[1]) > k) )
        //            ans = true;

        sc.close();

        for (int i = 0; i < 5; i++) {
            if (idx != i) {
                if ((10 - (menu[i] % 10)) == 10) {
                    ans += menu[i];
                } else {
                    ans += menu[i] + (10 - (menu[i] % 10));
                }
            }
        }
        ans += menu[idx];
        //        System.out.println(ans ? ":(" : "Yay!");
        System.out.println(ans);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] menu = new int[5]; menu new int[5] 5 int ans = 0; ans 0 int max = 0; max 0 int idx = 0; idx 0 for (int i = 0; i < 5; i++) {
            menu[i] = sc.nextInt();
            if (max < (10 - (menu[i] % 10)) && (10 - (menu[i] % 10)) != 10) {
                max = 10 - (menu[i] % 10);
                idx = i;
            }
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            menu[i] = sc.nextInt();
            if (max < (10 - (menu[i] % 10)) && (10 - (menu[i] % 10)) != 10) {
                max = 10 - (menu[i] % 10);
                idx = i;
            }
        } {
            menu[i] = sc.nextInt();
            if (max < (10 - (menu[i] % 10)) && (10 - (menu[i] % 10)) != 10) {
                max = 10 - (menu[i] % 10);
                idx = i;
            }
        } menu[i] = sc.nextInt() menu[i] menu i sc.nextInt() sc.nextInt sc if (max < (10 - (menu[i] % 10)) && (10 - (menu[i] % 10)) != 10) {
                max = 10 - (menu[i] % 10);
                idx = i;
            } max < (10 - (menu[i] % 10)) && (10 - (menu[i] % 10)) != 10 max < (10 - (menu[i] % 10)) max (10 - (menu[i] % 10)) 10 (menu[i] % 10) menu[i] menu i 10 (10 - (menu[i] % 10)) != 10 (10 - (menu[i] % 10)) 10 (menu[i] % 10) menu[i] menu i 10 10 {
                max = 10 - (menu[i] % 10);
                idx = i;
            } max = 10 - (menu[i] % 10) max 10 - (menu[i] % 10) 10 (menu[i] % 10) menu[i] menu i 10 idx = i idx i sc.close() sc.close sc for (int i = 0; i < 5; i++) {
            if (idx != i) {
                if ((10 - (menu[i] % 10)) == 10) {
                    ans += menu[i];
                } else {
                    ans += menu[i] + (10 - (menu[i] % 10));
                }
            }
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            if (idx != i) {
                if ((10 - (menu[i] % 10)) == 10) {
                    ans += menu[i];
                } else {
                    ans += menu[i] + (10 - (menu[i] % 10));
                }
            }
        } {
            if (idx != i) {
                if ((10 - (menu[i] % 10)) == 10) {
                    ans += menu[i];
                } else {
                    ans += menu[i] + (10 - (menu[i] % 10));
                }
            }
        } if (idx != i) {
                if ((10 - (menu[i] % 10)) == 10) {
                    ans += menu[i];
                } else {
                    ans += menu[i] + (10 - (menu[i] % 10));
                }
            } idx != i idx i {
                if ((10 - (menu[i] % 10)) == 10) {
                    ans += menu[i];
                } else {
                    ans += menu[i] + (10 - (menu[i] % 10));
                }
            } if ((10 - (menu[i] % 10)) == 10) {
                    ans += menu[i];
                } else {
                    ans += menu[i] + (10 - (menu[i] % 10));
                } (10 - (menu[i] % 10)) == 10 (10 - (menu[i] % 10)) 10 (menu[i] % 10) menu[i] menu i 10 10 {
                    ans += menu[i];
                } ans += menu[i] ans menu[i] menu i {
                    ans += menu[i] + (10 - (menu[i] % 10));
                } ans += menu[i] + (10 - (menu[i] % 10)) ans menu[i] + (10 - (menu[i] % 10)) menu[i] menu i (10 - (menu[i] % 10)) 10 (menu[i] % 10) menu[i] menu i 10 ans += menu[idx] ans menu[idx] menu idx 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) throws Exception {
        Scanner sc = new Scanner(System.in);

        int[] menu = new int[5];
        //        String s = sc.next();

        int ans = 0;
        int max = 0;
        int idx = 0;
        //        boolean ans = false;

        for (int i = 0; i < 5; i++) {
            menu[i] = sc.nextInt();
            if (max < (10 - (menu[i] % 10)) && (10 - (menu[i] % 10)) != 10) {
                max = 10 - (menu[i] % 10);
                idx = i;
            }
        }

        //        if ((Math.abs(ant[0] - ant[1]) > k) )
        //            ans = true;

        sc.close();

        for (int i = 0; i < 5; i++) {
            if (idx != i) {
                if ((10 - (menu[i] % 10)) == 10) {
                    ans += menu[i];
                } else {
                    ans += menu[i] + (10 - (menu[i] % 10));
                }
            }
        }
        ans += menu[idx];
        //        System.out.println(ans ? ":(" : "Yay!");
        System.out.println(ans);

    }
} public class Main {

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

        int[] menu = new int[5];
        //        String s = sc.next();

        int ans = 0;
        int max = 0;
        int idx = 0;
        //        boolean ans = false;

        for (int i = 0; i < 5; i++) {
            menu[i] = sc.nextInt();
            if (max < (10 - (menu[i] % 10)) && (10 - (menu[i] % 10)) != 10) {
                max = 10 - (menu[i] % 10);
                idx = i;
            }
        }

        //        if ((Math.abs(ant[0] - ant[1]) > k) )
        //            ans = true;

        sc.close();

        for (int i = 0; i < 5; i++) {
            if (idx != i) {
                if ((10 - (menu[i] % 10)) == 10) {
                    ans += menu[i];
                } else {
                    ans += menu[i] + (10 - (menu[i] % 10));
                }
            }
        }
        ans += menu[idx];
        //        System.out.println(ans ? ":(" : "Yay!");
        System.out.println(ans);

    }
} Main
import java.util.Scanner;

public class Main {

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

        int[] menu = new int[5];
        //        String s = sc.next();

        int ans = 0;
        int max = 0;
        int idx = 0;
        //        boolean ans = false;

        for (int i = 0; i < 5; i++) {
            menu[i] = sc.nextInt();
            if (max < (10 - (menu[i] % 10)) && (10 - (menu[i] % 10)) != 10) {
                max = 10 - (menu[i] % 10);
                idx = i;
            }
        }

        //        if ((Math.abs(ant[0] - ant[1]) > k) )
        //            ans = true;

        sc.close();

        for (int i = 0; i < 5; i++) {
            if (idx != i) {
                if ((10 - (menu[i] % 10)) == 10) {
                    ans += menu[i];
                } else {
                    ans += menu[i] + (10 - (menu[i] % 10));
                }
            }
        }
        ans += menu[idx];
        //        System.out.println(ans ? ":(" : "Yay!");
        System.out.println(ans);

    }
}