import java.io.*;
import java.util.Arrays;

public class Main {
    private static int[] pos = new int[5];
    private static int k;

    private static int solver() {
        int idx=0;
        int min=10;

        for(int i=0; i<5;i++){
            int rem = pos[i] % 10;
            if(rem != 0  && rem < min){
                min = rem;
                idx = i;
            }
        }

        int sum=0;
        for(int i=0; i<5;i++){
            if(i==idx){
                sum+=pos[i];
            }else{
                sum+=((pos[i] + 9) / 10)*10;
            }
        }

        return sum;

    }


    public static void main(String[] args) {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(is);

        try {
            for(int i=0; i<5; i++) {
                String[] inputArray = br.readLine().split(" ");
                pos[i] = Integer.parseInt(inputArray[0]);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        System.out.println(solver());

    }
}
/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