import java.util.Scanner;

class Main {
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int[] in = new int[5];
        in[0] = scan.nextInt();
        in[1] = scan.nextInt();
        in[2] = scan.nextInt();
        in[3] = scan.nextInt();
        in[4] = scan.nextInt();

        int sum = 0;
        int max = 0;
        for (int i = 0; i < in.length; i++) {
            sum +=Math.round((int)Math.ceil((double)in[i]/10) * 10);
            if (10-in[i]%10 == 10) {
                continue;
            }
            max = Math.max(max,10-in[i]%10);
        }
        System.out.println(sum - max);
    }
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz