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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] T = new int[5];
		int[] AT = new int[5];
		int[] TAT = new int[5];
		
		int max = 0;
		
		for(int i = 0; i < 5; i++) {
			T[i] = sc.nextInt();
			if(T[i] % 10 != 0) {
				AT[i] = 10 - (T[i] % 10);
			} else {
				AT[i] = 0;
			}
			TAT[i] = T[i] + AT[i];
			if(max <= AT[i] ) {
				max = AT[i];
			}
		}
		
		int sum = 0;
		
		for(int i = 0; i < 5; i++) {
			sum += TAT[i];
		}
		
		sum -= max;
		
		System.out.println(sum);
		
	}
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] T = new int[5];
		int[] AT = new int[5];
		int[] TAT = new int[5];
		
		int max = 0;
		
		for(int i = 0; i < 5; i++) {
			T[i] = sc.nextInt();
			if(T[i] % 10 != 0) {
				AT[i] = 10 - (T[i] % 10);
			} else {
				AT[i] = 0;
			}
			TAT[i] = T[i] + AT[i];
			if(max <= AT[i] ) {
				max = AT[i];
			}
		}
		
		int sum = 0;
		
		for(int i = 0; i < 5; i++) {
			sum += TAT[i];
		}
		
		sum -= max;
		
		System.out.println(sum);
		
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] T = new int[5];
		int[] AT = new int[5];
		int[] TAT = new int[5];
		
		int max = 0;
		
		for(int i = 0; i < 5; i++) {
			T[i] = sc.nextInt();
			if(T[i] % 10 != 0) {
				AT[i] = 10 - (T[i] % 10);
			} else {
				AT[i] = 0;
			}
			TAT[i] = T[i] + AT[i];
			if(max <= AT[i] ) {
				max = AT[i];
			}
		}
		
		int sum = 0;
		
		for(int i = 0; i < 5; i++) {
			sum += TAT[i];
		}
		
		sum -= max;
		
		System.out.println(sum);
		
	} main {
		Scanner sc = new Scanner(System.in);
		int[] T = new int[5];
		int[] AT = new int[5];
		int[] TAT = new int[5];
		
		int max = 0;
		
		for(int i = 0; i < 5; i++) {
			T[i] = sc.nextInt();
			if(T[i] % 10 != 0) {
				AT[i] = 10 - (T[i] % 10);
			} else {
				AT[i] = 0;
			}
			TAT[i] = T[i] + AT[i];
			if(max <= AT[i] ) {
				max = AT[i];
			}
		}
		
		int sum = 0;
		
		for(int i = 0; i < 5; i++) {
			sum += TAT[i];
		}
		
		sum -= max;
		
		System.out.println(sum);
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] T = new int[5]; T new int[5] 5 int[] AT = new int[5]; AT new int[5] 5 int[] TAT = new int[5]; TAT new int[5] 5 int max = 0; max 0 for(int i = 0; i < 5; i++) {
			T[i] = sc.nextInt();
			if(T[i] % 10 != 0) {
				AT[i] = 10 - (T[i] % 10);
			} else {
				AT[i] = 0;
			}
			TAT[i] = T[i] + AT[i];
			if(max <= AT[i] ) {
				max = AT[i];
			}
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			T[i] = sc.nextInt();
			if(T[i] % 10 != 0) {
				AT[i] = 10 - (T[i] % 10);
			} else {
				AT[i] = 0;
			}
			TAT[i] = T[i] + AT[i];
			if(max <= AT[i] ) {
				max = AT[i];
			}
		} {
			T[i] = sc.nextInt();
			if(T[i] % 10 != 0) {
				AT[i] = 10 - (T[i] % 10);
			} else {
				AT[i] = 0;
			}
			TAT[i] = T[i] + AT[i];
			if(max <= AT[i] ) {
				max = AT[i];
			}
		} T[i] = sc.nextInt() T[i] T i sc.nextInt() sc.nextInt sc if(T[i] % 10 != 0) {
				AT[i] = 10 - (T[i] % 10);
			} else {
				AT[i] = 0;
			} T[i] % 10 != 0 T[i] % 10 T[i] T i 10 0 {
				AT[i] = 10 - (T[i] % 10);
			} AT[i] = 10 - (T[i] % 10) AT[i] AT i 10 - (T[i] % 10) 10 (T[i] % 10) T[i] T i 10 {
				AT[i] = 0;
			} AT[i] = 0 AT[i] AT i 0 TAT[i] = T[i] + AT[i] TAT[i] TAT i T[i] + AT[i] T[i] T i AT[i] AT i if(max <= AT[i] ) {
				max = AT[i];
			} max <= AT[i] max AT[i] AT i {
				max = AT[i];
			} max = AT[i] max AT[i] AT i int sum = 0; sum 0 for(int i = 0; i < 5; i++) {
			sum += TAT[i];
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			sum += TAT[i];
		} {
			sum += TAT[i];
		} sum += TAT[i] sum TAT[i] TAT i sum -= max sum max System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] T = new int[5];
		int[] AT = new int[5];
		int[] TAT = new int[5];
		
		int max = 0;
		
		for(int i = 0; i < 5; i++) {
			T[i] = sc.nextInt();
			if(T[i] % 10 != 0) {
				AT[i] = 10 - (T[i] % 10);
			} else {
				AT[i] = 0;
			}
			TAT[i] = T[i] + AT[i];
			if(max <= AT[i] ) {
				max = AT[i];
			}
		}
		
		int sum = 0;
		
		for(int i = 0; i < 5; i++) {
			sum += TAT[i];
		}
		
		sum -= max;
		
		System.out.println(sum);
		
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] T = new int[5];
		int[] AT = new int[5];
		int[] TAT = new int[5];
		
		int max = 0;
		
		for(int i = 0; i < 5; i++) {
			T[i] = sc.nextInt();
			if(T[i] % 10 != 0) {
				AT[i] = 10 - (T[i] % 10);
			} else {
				AT[i] = 0;
			}
			TAT[i] = T[i] + AT[i];
			if(max <= AT[i] ) {
				max = AT[i];
			}
		}
		
		int sum = 0;
		
		for(int i = 0; i < 5; i++) {
			sum += TAT[i];
		}
		
		sum -= max;
		
		System.out.println(sum);
		
	}
} Main
import java.util.Scanner;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] T = new int[5];
		int[] AT = new int[5];
		int[] TAT = new int[5];
		
		int max = 0;
		
		for(int i = 0; i < 5; i++) {
			T[i] = sc.nextInt();
			if(T[i] % 10 != 0) {
				AT[i] = 10 - (T[i] % 10);
			} else {
				AT[i] = 0;
			}
			TAT[i] = T[i] + AT[i];
			if(max <= AT[i] ) {
				max = AT[i];
			}
		}
		
		int sum = 0;
		
		for(int i = 0; i < 5; i++) {
			sum += TAT[i];
		}
		
		sum -= max;
		
		System.out.println(sum);
		
	}
}
