import java.util.Scanner;

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

        int loss = 0;
        int maxLoss = 0;
        int ans = 0;
        for (int i = 0; i < N; i++) {
            if (times[i]%10 == 0) {
                loss = 0;
            }
            else {
                loss = 10 - times[i] % 10;
                maxLoss = Math.max(loss, maxLoss);
            }
            ans += (times[i] + loss);
        }
        System.out.println(ans - maxLoss);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        final int N = 5;
        Scanner sc = new Scanner(System.in);
        int[] times = new int[N];
        for (int i = 0; i < N; i++) {
            times[i] = sc.nextInt();
        }

        int loss = 0;
        int maxLoss = 0;
        int ans = 0;
        for (int i = 0; i < N; i++) {
            if (times[i]%10 == 0) {
                loss = 0;
            }
            else {
                loss = 10 - times[i] % 10;
                maxLoss = Math.max(loss, maxLoss);
            }
            ans += (times[i] + loss);
        }
        System.out.println(ans - maxLoss);
    }
} Main public static void main(String[] args) {
        final int N = 5;
        Scanner sc = new Scanner(System.in);
        int[] times = new int[N];
        for (int i = 0; i < N; i++) {
            times[i] = sc.nextInt();
        }

        int loss = 0;
        int maxLoss = 0;
        int ans = 0;
        for (int i = 0; i < N; i++) {
            if (times[i]%10 == 0) {
                loss = 0;
            }
            else {
                loss = 10 - times[i] % 10;
                maxLoss = Math.max(loss, maxLoss);
            }
            ans += (times[i] + loss);
        }
        System.out.println(ans - maxLoss);
    } main {
        final int N = 5;
        Scanner sc = new Scanner(System.in);
        int[] times = new int[N];
        for (int i = 0; i < N; i++) {
            times[i] = sc.nextInt();
        }

        int loss = 0;
        int maxLoss = 0;
        int ans = 0;
        for (int i = 0; i < N; i++) {
            if (times[i]%10 == 0) {
                loss = 0;
            }
            else {
                loss = 10 - times[i] % 10;
                maxLoss = Math.max(loss, maxLoss);
            }
            ans += (times[i] + loss);
        }
        System.out.println(ans - maxLoss);
    } final int N = 5; N 5 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] times = new int[N]; times new int[N] N for (int i = 0; i < N; i++) {
            times[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            times[i] = sc.nextInt();
        } {
            times[i] = sc.nextInt();
        } times[i] = sc.nextInt() times[i] times i sc.nextInt() sc.nextInt sc int loss = 0; loss 0 int maxLoss = 0; maxLoss 0 int ans = 0; ans 0 for (int i = 0; i < N; i++) {
            if (times[i]%10 == 0) {
                loss = 0;
            }
            else {
                loss = 10 - times[i] % 10;
                maxLoss = Math.max(loss, maxLoss);
            }
            ans += (times[i] + loss);
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            if (times[i]%10 == 0) {
                loss = 0;
            }
            else {
                loss = 10 - times[i] % 10;
                maxLoss = Math.max(loss, maxLoss);
            }
            ans += (times[i] + loss);
        } {
            if (times[i]%10 == 0) {
                loss = 0;
            }
            else {
                loss = 10 - times[i] % 10;
                maxLoss = Math.max(loss, maxLoss);
            }
            ans += (times[i] + loss);
        } if (times[i]%10 == 0) {
                loss = 0;
            }
            else {
                loss = 10 - times[i] % 10;
                maxLoss = Math.max(loss, maxLoss);
            } times[i]%10 == 0 times[i]%10 times[i] times i 10 0 {
                loss = 0;
            } loss = 0 loss 0 {
                loss = 10 - times[i] % 10;
                maxLoss = Math.max(loss, maxLoss);
            } loss = 10 - times[i] % 10 loss 10 - times[i] % 10 10 times[i] % 10 times[i] times i 10 maxLoss = Math.max(loss, maxLoss) maxLoss Math.max(loss, maxLoss) Math.max Math loss maxLoss ans += (times[i] + loss) ans (times[i] + loss) times[i] times i loss System.out.println(ans - maxLoss) System.out.println System.out System System.out ans - maxLoss ans maxLoss String[] args args public class Main {
    public static void main(String[] args) {
        final int N = 5;
        Scanner sc = new Scanner(System.in);
        int[] times = new int[N];
        for (int i = 0; i < N; i++) {
            times[i] = sc.nextInt();
        }

        int loss = 0;
        int maxLoss = 0;
        int ans = 0;
        for (int i = 0; i < N; i++) {
            if (times[i]%10 == 0) {
                loss = 0;
            }
            else {
                loss = 10 - times[i] % 10;
                maxLoss = Math.max(loss, maxLoss);
            }
            ans += (times[i] + loss);
        }
        System.out.println(ans - maxLoss);
    }
} public class Main {
    public static void main(String[] args) {
        final int N = 5;
        Scanner sc = new Scanner(System.in);
        int[] times = new int[N];
        for (int i = 0; i < N; i++) {
            times[i] = sc.nextInt();
        }

        int loss = 0;
        int maxLoss = 0;
        int ans = 0;
        for (int i = 0; i < N; i++) {
            if (times[i]%10 == 0) {
                loss = 0;
            }
            else {
                loss = 10 - times[i] % 10;
                maxLoss = Math.max(loss, maxLoss);
            }
            ans += (times[i] + loss);
        }
        System.out.println(ans - maxLoss);
    }
} Main
import java.util.Scanner;

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

        int loss = 0;
        int maxLoss = 0;
        int ans = 0;
        for (int i = 0; i < N; i++) {
            if (times[i]%10 == 0) {
                loss = 0;
            }
            else {
                loss = 10 - times[i] % 10;
                maxLoss = Math.max(loss, maxLoss);
            }
            ans += (times[i] + loss);
        }
        System.out.println(ans - maxLoss);
    }
}
