import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int maxr = 0;
        int r = 0;
        int t = 0;
        for (int i = 0; i < 5; i++) {
            int tmp = s.nextInt();
            if (tmp % 10 == 0) {
                t += tmp;
            } else {
                r = 10 - tmp % 10;
                t += tmp + r;
                if (maxr < r) {
                    maxr = r;
                }
            }
        }
        s.close();

        System.out.println(t - maxr);
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int maxr = 0;
        int r = 0;
        int t = 0;
        for (int i = 0; i < 5; i++) {
            int tmp = s.nextInt();
            if (tmp % 10 == 0) {
                t += tmp;
            } else {
                r = 10 - tmp % 10;
                t += tmp + r;
                if (maxr < r) {
                    maxr = r;
                }
            }
        }
        s.close();

        System.out.println(t - maxr);
    }
} Main public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int maxr = 0;
        int r = 0;
        int t = 0;
        for (int i = 0; i < 5; i++) {
            int tmp = s.nextInt();
            if (tmp % 10 == 0) {
                t += tmp;
            } else {
                r = 10 - tmp % 10;
                t += tmp + r;
                if (maxr < r) {
                    maxr = r;
                }
            }
        }
        s.close();

        System.out.println(t - maxr);
    } main {
        Scanner s = new Scanner(System.in);
        int maxr = 0;
        int r = 0;
        int t = 0;
        for (int i = 0; i < 5; i++) {
            int tmp = s.nextInt();
            if (tmp % 10 == 0) {
                t += tmp;
            } else {
                r = 10 - tmp % 10;
                t += tmp + r;
                if (maxr < r) {
                    maxr = r;
                }
            }
        }
        s.close();

        System.out.println(t - maxr);
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) int maxr = 0; maxr 0 int r = 0; r 0 int t = 0; t 0 for (int i = 0; i < 5; i++) {
            int tmp = s.nextInt();
            if (tmp % 10 == 0) {
                t += tmp;
            } else {
                r = 10 - tmp % 10;
                t += tmp + r;
                if (maxr < r) {
                    maxr = r;
                }
            }
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            int tmp = s.nextInt();
            if (tmp % 10 == 0) {
                t += tmp;
            } else {
                r = 10 - tmp % 10;
                t += tmp + r;
                if (maxr < r) {
                    maxr = r;
                }
            }
        } {
            int tmp = s.nextInt();
            if (tmp % 10 == 0) {
                t += tmp;
            } else {
                r = 10 - tmp % 10;
                t += tmp + r;
                if (maxr < r) {
                    maxr = r;
                }
            }
        } int tmp = s.nextInt(); tmp s.nextInt() s.nextInt s if (tmp % 10 == 0) {
                t += tmp;
            } else {
                r = 10 - tmp % 10;
                t += tmp + r;
                if (maxr < r) {
                    maxr = r;
                }
            } tmp % 10 == 0 tmp % 10 tmp 10 0 {
                t += tmp;
            } t += tmp t tmp {
                r = 10 - tmp % 10;
                t += tmp + r;
                if (maxr < r) {
                    maxr = r;
                }
            } r = 10 - tmp % 10 r 10 - tmp % 10 10 tmp % 10 tmp 10 t += tmp + r t tmp + r tmp r if (maxr < r) {
                    maxr = r;
                } maxr < r maxr r {
                    maxr = r;
                } maxr = r maxr r s.close() s.close s System.out.println(t - maxr) System.out.println System.out System System.out t - maxr t maxr String[] args args public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int maxr = 0;
        int r = 0;
        int t = 0;
        for (int i = 0; i < 5; i++) {
            int tmp = s.nextInt();
            if (tmp % 10 == 0) {
                t += tmp;
            } else {
                r = 10 - tmp % 10;
                t += tmp + r;
                if (maxr < r) {
                    maxr = r;
                }
            }
        }
        s.close();

        System.out.println(t - maxr);
    }
} public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int maxr = 0;
        int r = 0;
        int t = 0;
        for (int i = 0; i < 5; i++) {
            int tmp = s.nextInt();
            if (tmp % 10 == 0) {
                t += tmp;
            } else {
                r = 10 - tmp % 10;
                t += tmp + r;
                if (maxr < r) {
                    maxr = r;
                }
            }
        }
        s.close();

        System.out.println(t - maxr);
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int maxr = 0;
        int r = 0;
        int t = 0;
        for (int i = 0; i < 5; i++) {
            int tmp = s.nextInt();
            if (tmp % 10 == 0) {
                t += tmp;
            } else {
                r = 10 - tmp % 10;
                t += tmp + r;
                if (maxr < r) {
                    maxr = r;
                }
            }
        }
        s.close();

        System.out.println(t - maxr);
    }
}