import java.util.Arrays;
import java.util.Scanner;



class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	 int A[] = new int [5];
    	 int total=0;

    	 int ans=0;

    	 int C[] = new int[5];
    	 for(int i =0;i<5;i++){
    		A[i]=sc.nextInt();
    		total += A[i];

    		C[i] = A[i]%10;
    		if(C[i]!=0){
    		C[i]= 10-C[i];
    		ans += C[i];
    		}


    	 }
    	 Arrays.sort(C);

    	 System.out.println(ans+total-C[4]);

    }

} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	 int A[] = new int [5];
    	 int total=0;

    	 int ans=0;

    	 int C[] = new int[5];
    	 for(int i =0;i<5;i++){
    		A[i]=sc.nextInt();
    		total += A[i];

    		C[i] = A[i]%10;
    		if(C[i]!=0){
    		C[i]= 10-C[i];
    		ans += C[i];
    		}


    	 }
    	 Arrays.sort(C);

    	 System.out.println(ans+total-C[4]);

    }

} Main public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	 int A[] = new int [5];
    	 int total=0;

    	 int ans=0;

    	 int C[] = new int[5];
    	 for(int i =0;i<5;i++){
    		A[i]=sc.nextInt();
    		total += A[i];

    		C[i] = A[i]%10;
    		if(C[i]!=0){
    		C[i]= 10-C[i];
    		ans += C[i];
    		}


    	 }
    	 Arrays.sort(C);

    	 System.out.println(ans+total-C[4]);

    } main {
    	Scanner sc = new Scanner(System.in);
    	 int A[] = new int [5];
    	 int total=0;

    	 int ans=0;

    	 int C[] = new int[5];
    	 for(int i =0;i<5;i++){
    		A[i]=sc.nextInt();
    		total += A[i];

    		C[i] = A[i]%10;
    		if(C[i]!=0){
    		C[i]= 10-C[i];
    		ans += C[i];
    		}


    	 }
    	 Arrays.sort(C);

    	 System.out.println(ans+total-C[4]);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int A[] = new int [5]; A new int [5] 5 int total=0; total 0 int ans=0; ans 0 int C[] = new int[5]; C new int[5] 5 for(int i =0;i<5;i++){
    		A[i]=sc.nextInt();
    		total += A[i];

    		C[i] = A[i]%10;
    		if(C[i]!=0){
    		C[i]= 10-C[i];
    		ans += C[i];
    		}


    	 } int i =0; int i =0; i 0 i<5 i 5 i++ i++ i {
    		A[i]=sc.nextInt();
    		total += A[i];

    		C[i] = A[i]%10;
    		if(C[i]!=0){
    		C[i]= 10-C[i];
    		ans += C[i];
    		}


    	 } {
    		A[i]=sc.nextInt();
    		total += A[i];

    		C[i] = A[i]%10;
    		if(C[i]!=0){
    		C[i]= 10-C[i];
    		ans += C[i];
    		}


    	 } A[i]=sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc total += A[i] total A[i] A i C[i] = A[i]%10 C[i] C i A[i]%10 A[i] A i 10 if(C[i]!=0){
    		C[i]= 10-C[i];
    		ans += C[i];
    		} C[i]!=0 C[i] C i 0 {
    		C[i]= 10-C[i];
    		ans += C[i];
    		} C[i]= 10-C[i] C[i] C i 10-C[i] 10 C[i] C i ans += C[i] ans C[i] C i Arrays.sort(C) Arrays.sort Arrays C System.out.println(ans+total-C[4]) System.out.println System.out System System.out ans+total-C[4] ans+total ans total C[4] C 4 String[] args args
import java.util.Arrays;
import java.util.Scanner;



class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	 int A[] = new int [5];
    	 int total=0;

    	 int ans=0;

    	 int C[] = new int[5];
    	 for(int i =0;i<5;i++){
    		A[i]=sc.nextInt();
    		total += A[i];

    		C[i] = A[i]%10;
    		if(C[i]!=0){
    		C[i]= 10-C[i];
    		ans += C[i];
    		}


    	 }
    	 Arrays.sort(C);

    	 System.out.println(ans+total-C[4]);

    }

}