import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int sum = 0;
        int temp = 0;
        int i = 0;
        int e = 0;
        //余りが一番小さいものを最後に注文する。
        int r[] = new int[5];
        int s = 11;
        int t = 11;
        for(int k = 0; k<5; k++){
          r[k] = sc.nextInt();
        }

        for(i = 0; i < 5; i++){
          s = Math.min(t,r[i]%10);
          if(t != s && r[i]%10 !=0){
          e = i;
          t = s; 
          }
        }
        temp = r[4];
        r[4] = r[e];
        r[e] = temp;

        for(int j = 0; j < 4; j++){
          if(r[j] % 10 != 0){
            sum = 10 - (r[j] % 10) + r[j] +sum;
          }else{
            sum += r[j];
          }
        }
        sum += r[4];
        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