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] = Integer.parseInt(sc.next());
        }

        int max = 0;
        int sum = 0;
        for (int i = 0; i < 5; i++) {
            int b = ((a[i] / 10) + 1) * 10;
            if (a[i] % 10 == 0) b -= 10;
            sum += b;
            max = Math.max(max, b - a[i]);
        }

        System.out.println(sum - max);

    }
} 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] = Integer.parseInt(sc.next());
        }

        int max = 0;
        int sum = 0;
        for (int i = 0; i < 5; i++) {
            int b = ((a[i] / 10) + 1) * 10;
            if (a[i] % 10 == 0) b -= 10;
            sum += b;
            max = Math.max(max, b - a[i]);
        }

        System.out.println(sum - max);

    }
} 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] = Integer.parseInt(sc.next());
        }

        int max = 0;
        int sum = 0;
        for (int i = 0; i < 5; i++) {
            int b = ((a[i] / 10) + 1) * 10;
            if (a[i] % 10 == 0) b -= 10;
            sum += b;
            max = Math.max(max, b - a[i]);
        }

        System.out.println(sum - max);

    } main {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[5];
        for (int i = 0; i < 5; i++) {
            a[i] = Integer.parseInt(sc.next());
        }

        int max = 0;
        int sum = 0;
        for (int i = 0; i < 5; i++) {
            int b = ((a[i] / 10) + 1) * 10;
            if (a[i] % 10 == 0) b -= 10;
            sum += b;
            max = Math.max(max, b - a[i]);
        }

        System.out.println(sum - max);

    } 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] = Integer.parseInt(sc.next());
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            a[i] = Integer.parseInt(sc.next());
        } {
            a[i] = Integer.parseInt(sc.next());
        } a[i] = Integer.parseInt(sc.next()) a[i] a i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int max = 0; max 0 int sum = 0; sum 0 for (int i = 0; i < 5; i++) {
            int b = ((a[i] / 10) + 1) * 10;
            if (a[i] % 10 == 0) b -= 10;
            sum += b;
            max = Math.max(max, b - a[i]);
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            int b = ((a[i] / 10) + 1) * 10;
            if (a[i] % 10 == 0) b -= 10;
            sum += b;
            max = Math.max(max, b - a[i]);
        } {
            int b = ((a[i] / 10) + 1) * 10;
            if (a[i] % 10 == 0) b -= 10;
            sum += b;
            max = Math.max(max, b - a[i]);
        } int b = ((a[i] / 10) + 1) * 10; b ((a[i] / 10) + 1) * 10 ((a[i] / 10) + 1) (a[i] / 10) a[i] a i 10 1 10 if (a[i] % 10 == 0) b -= 10; a[i] % 10 == 0 a[i] % 10 a[i] a i 10 0 b -= 10 b 10 sum += b sum b max = Math.max(max, b - a[i]) max Math.max(max, b - a[i]) Math.max Math max b - a[i] b a[i] a i System.out.println(sum - max) System.out.println System.out System System.out sum - max sum max 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] = Integer.parseInt(sc.next());
        }

        int max = 0;
        int sum = 0;
        for (int i = 0; i < 5; i++) {
            int b = ((a[i] / 10) + 1) * 10;
            if (a[i] % 10 == 0) b -= 10;
            sum += b;
            max = Math.max(max, b - a[i]);
        }

        System.out.println(sum - max);

    }
} 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] = Integer.parseInt(sc.next());
        }

        int max = 0;
        int sum = 0;
        for (int i = 0; i < 5; i++) {
            int b = ((a[i] / 10) + 1) * 10;
            if (a[i] % 10 == 0) b -= 10;
            sum += b;
            max = Math.max(max, b - a[i]);
        }

        System.out.println(sum - max);

    }
} 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] = Integer.parseInt(sc.next());
        }

        int max = 0;
        int sum = 0;
        for (int i = 0; i < 5; i++) {
            int b = ((a[i] / 10) + 1) * 10;
            if (a[i] % 10 == 0) b -= 10;
            sum += b;
            max = Math.max(max, b - a[i]);
        }

        System.out.println(sum - max);

    }
}
