import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        List<Integer> list = new ArrayList<>();
        Integer last = null;
        int lastIndex = 0;

        for (int i=0; i<5; i++) {
            int input = sc.nextInt();
            if (input % 10 == 0) list.add(input);
            else {
                if (last == null || input % 10 < last % 10) {
                    last = input;
                    lastIndex = i;
                }

                int next10 = input + 10 - (input % 10);
                list.add(next10);
            }
        }

        int sum = 0;
        if (last == null) {
            for (int each: list) {
                sum += each;
            }
        } else {
            for (int i=0; i<5; i++) {
                if (i != lastIndex) {
                    sum += list.get(i);
                }
            }

            sum += last;
        }

        System.out.println(sum);
    }
}

/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