import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[5];
        for (int i = 0; i < 5; i++) {
            a[i] = sc.nextInt();
        }
        sc.close();

        int ans = 0;
        for (int i = 0; i < 5; i++) {
            int tmp = (a[i] / 10) * 10;
            if (a[i] % 10 != 0) {
                tmp += 10;
            }
//            System.out.println(tmp);
            ans += tmp;
        }
//        System.out.println(ans);

        int diff = 0;
        for (int i = 0; i < 5; i++) {
            if (a[i] % 10 != 0) {
                int tmp = 10 - (a[i] % 10);
                if (tmp > diff) {
                    diff = tmp;
                }
            }
        }

        ans -= diff;
        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 = new int[5];
        for (int i = 0; i < 5; i++) {
            a[i] = sc.nextInt();
        }
        sc.close();

        int ans = 0;
        for (int i = 0; i < 5; i++) {
            int tmp = (a[i] / 10) * 10;
            if (a[i] % 10 != 0) {
                tmp += 10;
            }
//            System.out.println(tmp);
            ans += tmp;
        }
//        System.out.println(ans);

        int diff = 0;
        for (int i = 0; i < 5; i++) {
            if (a[i] % 10 != 0) {
                int tmp = 10 - (a[i] % 10);
                if (tmp > diff) {
                    diff = tmp;
                }
            }
        }

        ans -= diff;
        System.out.println(ans);
    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[5];
        for (int i = 0; i < 5; i++) {
            a[i] = sc.nextInt();
        }
        sc.close();

        int ans = 0;
        for (int i = 0; i < 5; i++) {
            int tmp = (a[i] / 10) * 10;
            if (a[i] % 10 != 0) {
                tmp += 10;
            }
//            System.out.println(tmp);
            ans += tmp;
        }
//        System.out.println(ans);

        int diff = 0;
        for (int i = 0; i < 5; i++) {
            if (a[i] % 10 != 0) {
                int tmp = 10 - (a[i] % 10);
                if (tmp > diff) {
                    diff = tmp;
                }
            }
        }

        ans -= diff;
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[5];
        for (int i = 0; i < 5; i++) {
            a[i] = sc.nextInt();
        }
        sc.close();

        int ans = 0;
        for (int i = 0; i < 5; i++) {
            int tmp = (a[i] / 10) * 10;
            if (a[i] % 10 != 0) {
                tmp += 10;
            }
//            System.out.println(tmp);
            ans += tmp;
        }
//        System.out.println(ans);

        int diff = 0;
        for (int i = 0; i < 5; i++) {
            if (a[i] % 10 != 0) {
                int tmp = 10 - (a[i] % 10);
                if (tmp > diff) {
                    diff = tmp;
                }
            }
        }

        ans -= diff;
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] a = new int[5]; a new int[5] 5 for (int i = 0; i < 5; i++) {
            a[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            a[i] = sc.nextInt();
        } {
            a[i] = sc.nextInt();
        } a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc sc.close() sc.close sc int ans = 0; ans 0 for (int i = 0; i < 5; i++) {
            int tmp = (a[i] / 10) * 10;
            if (a[i] % 10 != 0) {
                tmp += 10;
            }
//            System.out.println(tmp);
            ans += tmp;
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            int tmp = (a[i] / 10) * 10;
            if (a[i] % 10 != 0) {
                tmp += 10;
            }
//            System.out.println(tmp);
            ans += tmp;
        } {
            int tmp = (a[i] / 10) * 10;
            if (a[i] % 10 != 0) {
                tmp += 10;
            }
//            System.out.println(tmp);
            ans += tmp;
        } int tmp = (a[i] / 10) * 10; tmp (a[i] / 10) * 10 (a[i] / 10) a[i] a i 10 10 if (a[i] % 10 != 0) {
                tmp += 10;
            } a[i] % 10 != 0 a[i] % 10 a[i] a i 10 0 {
                tmp += 10;
            } tmp += 10 tmp 10 ans += tmp ans tmp int diff = 0; diff 0 for (int i = 0; i < 5; i++) {
            if (a[i] % 10 != 0) {
                int tmp = 10 - (a[i] % 10);
                if (tmp > diff) {
                    diff = tmp;
                }
            }
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            if (a[i] % 10 != 0) {
                int tmp = 10 - (a[i] % 10);
                if (tmp > diff) {
                    diff = tmp;
                }
            }
        } {
            if (a[i] % 10 != 0) {
                int tmp = 10 - (a[i] % 10);
                if (tmp > diff) {
                    diff = tmp;
                }
            }
        } if (a[i] % 10 != 0) {
                int tmp = 10 - (a[i] % 10);
                if (tmp > diff) {
                    diff = tmp;
                }
            } a[i] % 10 != 0 a[i] % 10 a[i] a i 10 0 {
                int tmp = 10 - (a[i] % 10);
                if (tmp > diff) {
                    diff = tmp;
                }
            } int tmp = 10 - (a[i] % 10); tmp 10 - (a[i] % 10) 10 (a[i] % 10) a[i] a i 10 if (tmp > diff) {
                    diff = tmp;
                } tmp > diff tmp diff {
                    diff = tmp;
                } diff = tmp diff tmp ans -= diff ans diff 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 = new int[5];
        for (int i = 0; i < 5; i++) {
            a[i] = sc.nextInt();
        }
        sc.close();

        int ans = 0;
        for (int i = 0; i < 5; i++) {
            int tmp = (a[i] / 10) * 10;
            if (a[i] % 10 != 0) {
                tmp += 10;
            }
//            System.out.println(tmp);
            ans += tmp;
        }
//        System.out.println(ans);

        int diff = 0;
        for (int i = 0; i < 5; i++) {
            if (a[i] % 10 != 0) {
                int tmp = 10 - (a[i] % 10);
                if (tmp > diff) {
                    diff = tmp;
                }
            }
        }

        ans -= diff;
        System.out.println(ans);
    }

} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[5];
        for (int i = 0; i < 5; i++) {
            a[i] = sc.nextInt();
        }
        sc.close();

        int ans = 0;
        for (int i = 0; i < 5; i++) {
            int tmp = (a[i] / 10) * 10;
            if (a[i] % 10 != 0) {
                tmp += 10;
            }
//            System.out.println(tmp);
            ans += tmp;
        }
//        System.out.println(ans);

        int diff = 0;
        for (int i = 0; i < 5; i++) {
            if (a[i] % 10 != 0) {
                int tmp = 10 - (a[i] % 10);
                if (tmp > diff) {
                    diff = tmp;
                }
            }
        }

        ans -= diff;
        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 = new int[5];
        for (int i = 0; i < 5; i++) {
            a[i] = sc.nextInt();
        }
        sc.close();

        int ans = 0;
        for (int i = 0; i < 5; i++) {
            int tmp = (a[i] / 10) * 10;
            if (a[i] % 10 != 0) {
                tmp += 10;
            }
//            System.out.println(tmp);
            ans += tmp;
        }
//        System.out.println(ans);

        int diff = 0;
        for (int i = 0; i < 5; i++) {
            if (a[i] % 10 != 0) {
                int tmp = 10 - (a[i] % 10);
                if (tmp > diff) {
                    diff = tmp;
                }
            }
        }

        ans -= diff;
        System.out.println(ans);
    }

}
