import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int[] dsh = new int[5];
 		dsh[0] = sc.nextInt();
 		
		dsh[1] = sc.nextInt();
		
		dsh[2] = sc.nextInt();
		
		dsh[3] = sc.nextInt();
		
		dsh[4] = sc.nextInt();
		
		int[] ndsh = new int[5];
		int[] dif = new int[5];
		
		for(int l = 0; l < dsh.length; l++) {
			ndsh[l] = dsh[l];
			dif[l] = 0;
			while((ndsh[l] % 10) != 0) {
				ndsh[l] = ndsh[l] + 1;
				dif[l] = dif[l] + 1;
			}

		}
		
		int max_dif = 0;
		for(int n = 0; n < dif.length; n++) {
			if(max_dif < dif[n]) {
				max_dif = dif[n];
			}
		}
		int sum = ndsh[0] + ndsh[1] + ndsh[2] + ndsh[3] + ndsh[4];
		System.out.println((sum - max_dif));
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int[] dsh = new int[5];
 		dsh[0] = sc.nextInt();
 		
		dsh[1] = sc.nextInt();
		
		dsh[2] = sc.nextInt();
		
		dsh[3] = sc.nextInt();
		
		dsh[4] = sc.nextInt();
		
		int[] ndsh = new int[5];
		int[] dif = new int[5];
		
		for(int l = 0; l < dsh.length; l++) {
			ndsh[l] = dsh[l];
			dif[l] = 0;
			while((ndsh[l] % 10) != 0) {
				ndsh[l] = ndsh[l] + 1;
				dif[l] = dif[l] + 1;
			}

		}
		
		int max_dif = 0;
		for(int n = 0; n < dif.length; n++) {
			if(max_dif < dif[n]) {
				max_dif = dif[n];
			}
		}
		int sum = ndsh[0] + ndsh[1] + ndsh[2] + ndsh[3] + ndsh[4];
		System.out.println((sum - max_dif));
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int[] dsh = new int[5];
 		dsh[0] = sc.nextInt();
 		
		dsh[1] = sc.nextInt();
		
		dsh[2] = sc.nextInt();
		
		dsh[3] = sc.nextInt();
		
		dsh[4] = sc.nextInt();
		
		int[] ndsh = new int[5];
		int[] dif = new int[5];
		
		for(int l = 0; l < dsh.length; l++) {
			ndsh[l] = dsh[l];
			dif[l] = 0;
			while((ndsh[l] % 10) != 0) {
				ndsh[l] = ndsh[l] + 1;
				dif[l] = dif[l] + 1;
			}

		}
		
		int max_dif = 0;
		for(int n = 0; n < dif.length; n++) {
			if(max_dif < dif[n]) {
				max_dif = dif[n];
			}
		}
		int sum = ndsh[0] + ndsh[1] + ndsh[2] + ndsh[3] + ndsh[4];
		System.out.println((sum - max_dif));
	} main {
		Scanner sc = new Scanner(System.in);
		
		int[] dsh = new int[5];
 		dsh[0] = sc.nextInt();
 		
		dsh[1] = sc.nextInt();
		
		dsh[2] = sc.nextInt();
		
		dsh[3] = sc.nextInt();
		
		dsh[4] = sc.nextInt();
		
		int[] ndsh = new int[5];
		int[] dif = new int[5];
		
		for(int l = 0; l < dsh.length; l++) {
			ndsh[l] = dsh[l];
			dif[l] = 0;
			while((ndsh[l] % 10) != 0) {
				ndsh[l] = ndsh[l] + 1;
				dif[l] = dif[l] + 1;
			}

		}
		
		int max_dif = 0;
		for(int n = 0; n < dif.length; n++) {
			if(max_dif < dif[n]) {
				max_dif = dif[n];
			}
		}
		int sum = ndsh[0] + ndsh[1] + ndsh[2] + ndsh[3] + ndsh[4];
		System.out.println((sum - max_dif));
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] dsh = new int[5]; dsh new int[5] 5 dsh[0] = sc.nextInt() dsh[0] dsh 0 sc.nextInt() sc.nextInt sc dsh[1] = sc.nextInt() dsh[1] dsh 1 sc.nextInt() sc.nextInt sc dsh[2] = sc.nextInt() dsh[2] dsh 2 sc.nextInt() sc.nextInt sc dsh[3] = sc.nextInt() dsh[3] dsh 3 sc.nextInt() sc.nextInt sc dsh[4] = sc.nextInt() dsh[4] dsh 4 sc.nextInt() sc.nextInt sc int[] ndsh = new int[5]; ndsh new int[5] 5 int[] dif = new int[5]; dif new int[5] 5 for(int l = 0; l < dsh.length; l++) {
			ndsh[l] = dsh[l];
			dif[l] = 0;
			while((ndsh[l] % 10) != 0) {
				ndsh[l] = ndsh[l] + 1;
				dif[l] = dif[l] + 1;
			}

		} int l = 0; int l = 0; l 0 l < dsh.length l dsh.length dsh dsh.length l++ l++ l {
			ndsh[l] = dsh[l];
			dif[l] = 0;
			while((ndsh[l] % 10) != 0) {
				ndsh[l] = ndsh[l] + 1;
				dif[l] = dif[l] + 1;
			}

		} {
			ndsh[l] = dsh[l];
			dif[l] = 0;
			while((ndsh[l] % 10) != 0) {
				ndsh[l] = ndsh[l] + 1;
				dif[l] = dif[l] + 1;
			}

		} ndsh[l] = dsh[l] ndsh[l] ndsh l dsh[l] dsh l dif[l] = 0 dif[l] dif l 0 while((ndsh[l] % 10) != 0) {
				ndsh[l] = ndsh[l] + 1;
				dif[l] = dif[l] + 1;
			} (ndsh[l] % 10) != 0 (ndsh[l] % 10) ndsh[l] ndsh l 10 0 {
				ndsh[l] = ndsh[l] + 1;
				dif[l] = dif[l] + 1;
			} ndsh[l] = ndsh[l] + 1 ndsh[l] ndsh l ndsh[l] + 1 ndsh[l] ndsh l 1 dif[l] = dif[l] + 1 dif[l] dif l dif[l] + 1 dif[l] dif l 1 int max_dif = 0; max_dif 0 for(int n = 0; n < dif.length; n++) {
			if(max_dif < dif[n]) {
				max_dif = dif[n];
			}
		} int n = 0; int n = 0; n 0 n < dif.length n dif.length dif dif.length n++ n++ n {
			if(max_dif < dif[n]) {
				max_dif = dif[n];
			}
		} {
			if(max_dif < dif[n]) {
				max_dif = dif[n];
			}
		} if(max_dif < dif[n]) {
				max_dif = dif[n];
			} max_dif < dif[n] max_dif dif[n] dif n {
				max_dif = dif[n];
			} max_dif = dif[n] max_dif dif[n] dif n int sum = ndsh[0] + ndsh[1] + ndsh[2] + ndsh[3] + ndsh[4]; sum ndsh[0] + ndsh[1] + ndsh[2] + ndsh[3] + ndsh[4] ndsh[3] ndsh[2] ndsh[0] + ndsh[1] + ndsh[2] + ndsh[3] + ndsh[4] ndsh[0] ndsh 0 ndsh[1] ndsh 1 ndsh[2] ndsh 2 ndsh[3] ndsh 3 ndsh[4] ndsh 4 System.out.println((sum - max_dif)) System.out.println System.out System System.out (sum - max_dif) sum max_dif String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int[] dsh = new int[5];
 		dsh[0] = sc.nextInt();
 		
		dsh[1] = sc.nextInt();
		
		dsh[2] = sc.nextInt();
		
		dsh[3] = sc.nextInt();
		
		dsh[4] = sc.nextInt();
		
		int[] ndsh = new int[5];
		int[] dif = new int[5];
		
		for(int l = 0; l < dsh.length; l++) {
			ndsh[l] = dsh[l];
			dif[l] = 0;
			while((ndsh[l] % 10) != 0) {
				ndsh[l] = ndsh[l] + 1;
				dif[l] = dif[l] + 1;
			}

		}
		
		int max_dif = 0;
		for(int n = 0; n < dif.length; n++) {
			if(max_dif < dif[n]) {
				max_dif = dif[n];
			}
		}
		int sum = ndsh[0] + ndsh[1] + ndsh[2] + ndsh[3] + ndsh[4];
		System.out.println((sum - max_dif));
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int[] dsh = new int[5];
 		dsh[0] = sc.nextInt();
 		
		dsh[1] = sc.nextInt();
		
		dsh[2] = sc.nextInt();
		
		dsh[3] = sc.nextInt();
		
		dsh[4] = sc.nextInt();
		
		int[] ndsh = new int[5];
		int[] dif = new int[5];
		
		for(int l = 0; l < dsh.length; l++) {
			ndsh[l] = dsh[l];
			dif[l] = 0;
			while((ndsh[l] % 10) != 0) {
				ndsh[l] = ndsh[l] + 1;
				dif[l] = dif[l] + 1;
			}

		}
		
		int max_dif = 0;
		for(int n = 0; n < dif.length; n++) {
			if(max_dif < dif[n]) {
				max_dif = dif[n];
			}
		}
		int sum = ndsh[0] + ndsh[1] + ndsh[2] + ndsh[3] + ndsh[4];
		System.out.println((sum - max_dif));
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int[] dsh = new int[5];
 		dsh[0] = sc.nextInt();
 		
		dsh[1] = sc.nextInt();
		
		dsh[2] = sc.nextInt();
		
		dsh[3] = sc.nextInt();
		
		dsh[4] = sc.nextInt();
		
		int[] ndsh = new int[5];
		int[] dif = new int[5];
		
		for(int l = 0; l < dsh.length; l++) {
			ndsh[l] = dsh[l];
			dif[l] = 0;
			while((ndsh[l] % 10) != 0) {
				ndsh[l] = ndsh[l] + 1;
				dif[l] = dif[l] + 1;
			}

		}
		
		int max_dif = 0;
		for(int n = 0; n < dif.length; n++) {
			if(max_dif < dif[n]) {
				max_dif = dif[n];
			}
		}
		int sum = ndsh[0] + ndsh[1] + ndsh[2] + ndsh[3] + ndsh[4];
		System.out.println((sum - max_dif));
	}
}