import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);       
		int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();
        int ans = a+b+c+d+e;
        int A =10-a%10;if(A==10){A=0;}
        int B =10-b%10;if(B==10){B=0;}
        int C =10-c%10;if(C==10){C=0;}
        int D =10-d%10;if(D==10){D=0;}
        int E =10-e%10;if(E==10){E=0;}
        ans+=A+B+C+D+E;
        ans-=Math.max(A,Math.max(B,Math.max(C,Math.max(D,E))));
		System.out.println(ans);
  }
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);       
		int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();
        int ans = a+b+c+d+e;
        int A =10-a%10;if(A==10){A=0;}
        int B =10-b%10;if(B==10){B=0;}
        int C =10-c%10;if(C==10){C=0;}
        int D =10-d%10;if(D==10){D=0;}
        int E =10-e%10;if(E==10){E=0;}
        ans+=A+B+C+D+E;
        ans-=Math.max(A,Math.max(B,Math.max(C,Math.max(D,E))));
		System.out.println(ans);
  }
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);       
		int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();
        int ans = a+b+c+d+e;
        int A =10-a%10;if(A==10){A=0;}
        int B =10-b%10;if(B==10){B=0;}
        int C =10-c%10;if(C==10){C=0;}
        int D =10-d%10;if(D==10){D=0;}
        int E =10-e%10;if(E==10){E=0;}
        ans+=A+B+C+D+E;
        ans-=Math.max(A,Math.max(B,Math.max(C,Math.max(D,E))));
		System.out.println(ans);
  } main {
		Scanner sc = new Scanner(System.in);       
		int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();
        int ans = a+b+c+d+e;
        int A =10-a%10;if(A==10){A=0;}
        int B =10-b%10;if(B==10){B=0;}
        int C =10-c%10;if(C==10){C=0;}
        int D =10-d%10;if(D==10){D=0;}
        int E =10-e%10;if(E==10){E=0;}
        ans+=A+B+C+D+E;
        ans-=Math.max(A,Math.max(B,Math.max(C,Math.max(D,E))));
		System.out.println(ans);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int c = sc.nextInt(); c sc.nextInt() sc.nextInt sc int d = sc.nextInt(); d sc.nextInt() sc.nextInt sc int e = sc.nextInt(); e sc.nextInt() sc.nextInt sc int ans = a+b+c+d+e; ans a+b+c+d+e d c a+b+c+d+e a b c d e int A =10-a%10; A 10-a%10 10 a%10 a 10 if(A==10){A=0;} A==10 A 10 {A=0;} A=0 A 0 int B =10-b%10; B 10-b%10 10 b%10 b 10 if(B==10){B=0;} B==10 B 10 {B=0;} B=0 B 0 int C =10-c%10; C 10-c%10 10 c%10 c 10 if(C==10){C=0;} C==10 C 10 {C=0;} C=0 C 0 int D =10-d%10; D 10-d%10 10 d%10 d 10 if(D==10){D=0;} D==10 D 10 {D=0;} D=0 D 0 int E =10-e%10; E 10-e%10 10 e%10 e 10 if(E==10){E=0;} E==10 E 10 {E=0;} E=0 E 0 ans+=A+B+C+D+E ans A+B+C+D+E D C A+B+C+D+E A B C D E ans-=Math.max(A,Math.max(B,Math.max(C,Math.max(D,E)))) ans Math.max(A,Math.max(B,Math.max(C,Math.max(D,E)))) Math.max Math A Math.max(B,Math.max(C,Math.max(D,E))) Math.max Math B Math.max(C,Math.max(D,E)) Math.max Math C Math.max(D,E) Math.max Math D E System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);       
		int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();
        int ans = a+b+c+d+e;
        int A =10-a%10;if(A==10){A=0;}
        int B =10-b%10;if(B==10){B=0;}
        int C =10-c%10;if(C==10){C=0;}
        int D =10-d%10;if(D==10){D=0;}
        int E =10-e%10;if(E==10){E=0;}
        ans+=A+B+C+D+E;
        ans-=Math.max(A,Math.max(B,Math.max(C,Math.max(D,E))));
		System.out.println(ans);
  }
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);       
		int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();
        int ans = a+b+c+d+e;
        int A =10-a%10;if(A==10){A=0;}
        int B =10-b%10;if(B==10){B=0;}
        int C =10-c%10;if(C==10){C=0;}
        int D =10-d%10;if(D==10){D=0;}
        int E =10-e%10;if(E==10){E=0;}
        ans+=A+B+C+D+E;
        ans-=Math.max(A,Math.max(B,Math.max(C,Math.max(D,E))));
		System.out.println(ans);
  }
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);       
		int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();
        int ans = a+b+c+d+e;
        int A =10-a%10;if(A==10){A=0;}
        int B =10-b%10;if(B==10){B=0;}
        int C =10-c%10;if(C==10){C=0;}
        int D =10-d%10;if(D==10){D=0;}
        int E =10-e%10;if(E==10){E=0;}
        ans+=A+B+C+D+E;
        ans-=Math.max(A,Math.max(B,Math.max(C,Math.max(D,E))));
		System.out.println(ans);
  }
}
