import java.util.Scanner;

class Main {
	public static void main(String[] args) {
	
		Scanner stdIn = new Scanner(System.in);
		
		int[] minutes = new int[5];
		int swap;
		int total = 0;
		int mini;
		
		for (int i = 0; i < 5; i++) {
			minutes[i] = stdIn.nextInt();
		}
		
		mini = 9;
		
		for (int i = 0; i < 4; i++) {
			if ((minutes[i] % 10 < mini) && (minutes[i] % 10 != 0)) {
				swap = minutes[i];
				minutes[i] = minutes[4];
				minutes[4] = swap;
				mini = swap % 10;
			}
		}
		
//		System.out.println(minutes[4]);
			
		for (int i = 0; i < 5; i++) {
//			if(minutes[i] % 10 != 0) {
			while (minutes[i] % 10 != 0 && i != 4) {
				minutes[i]++;
			}
//			}
			total += minutes[i];
//			System.out.println(total);
		}
		
		System.out.println(total);
		
	
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args) {
	
		Scanner stdIn = new Scanner(System.in);
		
		int[] minutes = new int[5];
		int swap;
		int total = 0;
		int mini;
		
		for (int i = 0; i < 5; i++) {
			minutes[i] = stdIn.nextInt();
		}
		
		mini = 9;
		
		for (int i = 0; i < 4; i++) {
			if ((minutes[i] % 10 < mini) && (minutes[i] % 10 != 0)) {
				swap = minutes[i];
				minutes[i] = minutes[4];
				minutes[4] = swap;
				mini = swap % 10;
			}
		}
		
//		System.out.println(minutes[4]);
			
		for (int i = 0; i < 5; i++) {
//			if(minutes[i] % 10 != 0) {
			while (minutes[i] % 10 != 0 && i != 4) {
				minutes[i]++;
			}
//			}
			total += minutes[i];
//			System.out.println(total);
		}
		
		System.out.println(total);
		
	
	}
} Main public static void main(String[] args) {
	
		Scanner stdIn = new Scanner(System.in);
		
		int[] minutes = new int[5];
		int swap;
		int total = 0;
		int mini;
		
		for (int i = 0; i < 5; i++) {
			minutes[i] = stdIn.nextInt();
		}
		
		mini = 9;
		
		for (int i = 0; i < 4; i++) {
			if ((minutes[i] % 10 < mini) && (minutes[i] % 10 != 0)) {
				swap = minutes[i];
				minutes[i] = minutes[4];
				minutes[4] = swap;
				mini = swap % 10;
			}
		}
		
//		System.out.println(minutes[4]);
			
		for (int i = 0; i < 5; i++) {
//			if(minutes[i] % 10 != 0) {
			while (minutes[i] % 10 != 0 && i != 4) {
				minutes[i]++;
			}
//			}
			total += minutes[i];
//			System.out.println(total);
		}
		
		System.out.println(total);
		
	
	} main {
	
		Scanner stdIn = new Scanner(System.in);
		
		int[] minutes = new int[5];
		int swap;
		int total = 0;
		int mini;
		
		for (int i = 0; i < 5; i++) {
			minutes[i] = stdIn.nextInt();
		}
		
		mini = 9;
		
		for (int i = 0; i < 4; i++) {
			if ((minutes[i] % 10 < mini) && (minutes[i] % 10 != 0)) {
				swap = minutes[i];
				minutes[i] = minutes[4];
				minutes[4] = swap;
				mini = swap % 10;
			}
		}
		
//		System.out.println(minutes[4]);
			
		for (int i = 0; i < 5; i++) {
//			if(minutes[i] % 10 != 0) {
			while (minutes[i] % 10 != 0 && i != 4) {
				minutes[i]++;
			}
//			}
			total += minutes[i];
//			System.out.println(total);
		}
		
		System.out.println(total);
		
	
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int[] minutes = new int[5]; minutes new int[5] 5 int swap; swap int total = 0; total 0 int mini; mini for (int i = 0; i < 5; i++) {
			minutes[i] = stdIn.nextInt();
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			minutes[i] = stdIn.nextInt();
		} {
			minutes[i] = stdIn.nextInt();
		} minutes[i] = stdIn.nextInt() minutes[i] minutes i stdIn.nextInt() stdIn.nextInt stdIn mini = 9 mini 9 for (int i = 0; i < 4; i++) {
			if ((minutes[i] % 10 < mini) && (minutes[i] % 10 != 0)) {
				swap = minutes[i];
				minutes[i] = minutes[4];
				minutes[4] = swap;
				mini = swap % 10;
			}
		} int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
			if ((minutes[i] % 10 < mini) && (minutes[i] % 10 != 0)) {
				swap = minutes[i];
				minutes[i] = minutes[4];
				minutes[4] = swap;
				mini = swap % 10;
			}
		} {
			if ((minutes[i] % 10 < mini) && (minutes[i] % 10 != 0)) {
				swap = minutes[i];
				minutes[i] = minutes[4];
				minutes[4] = swap;
				mini = swap % 10;
			}
		} if ((minutes[i] % 10 < mini) && (minutes[i] % 10 != 0)) {
				swap = minutes[i];
				minutes[i] = minutes[4];
				minutes[4] = swap;
				mini = swap % 10;
			} (minutes[i] % 10 < mini) && (minutes[i] % 10 != 0) (minutes[i] % 10 < mini) minutes[i] % 10 minutes[i] minutes i 10 mini (minutes[i] % 10 != 0) minutes[i] % 10 minutes[i] minutes i 10 0 {
				swap = minutes[i];
				minutes[i] = minutes[4];
				minutes[4] = swap;
				mini = swap % 10;
			} swap = minutes[i] swap minutes[i] minutes i minutes[i] = minutes[4] minutes[i] minutes i minutes[4] minutes 4 minutes[4] = swap minutes[4] minutes 4 swap mini = swap % 10 mini swap % 10 swap 10 for (int i = 0; i < 5; i++) {
//			if(minutes[i] % 10 != 0) {
			while (minutes[i] % 10 != 0 && i != 4) {
				minutes[i]++;
			}
//			}
			total += minutes[i];
//			System.out.println(total);
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
//			if(minutes[i] % 10 != 0) {
			while (minutes[i] % 10 != 0 && i != 4) {
				minutes[i]++;
			}
//			}
			total += minutes[i];
//			System.out.println(total);
		} {
//			if(minutes[i] % 10 != 0) {
			while (minutes[i] % 10 != 0 && i != 4) {
				minutes[i]++;
			}
//			}
			total += minutes[i];
//			System.out.println(total);
		} while (minutes[i] % 10 != 0 && i != 4) {
				minutes[i]++;
			} minutes[i] % 10 != 0 && i != 4 minutes[i] % 10 != 0 minutes[i] % 10 minutes[i] minutes i 10 0 i != 4 i 4 {
				minutes[i]++;
			} minutes[i]++ minutes[i] minutes i total += minutes[i] total minutes[i] minutes i System.out.println(total) System.out.println System.out System System.out total String[] args args
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
	
		Scanner stdIn = new Scanner(System.in);
		
		int[] minutes = new int[5];
		int swap;
		int total = 0;
		int mini;
		
		for (int i = 0; i < 5; i++) {
			minutes[i] = stdIn.nextInt();
		}
		
		mini = 9;
		
		for (int i = 0; i < 4; i++) {
			if ((minutes[i] % 10 < mini) && (minutes[i] % 10 != 0)) {
				swap = minutes[i];
				minutes[i] = minutes[4];
				minutes[4] = swap;
				mini = swap % 10;
			}
		}
		
//		System.out.println(minutes[4]);
			
		for (int i = 0; i < 5; i++) {
//			if(minutes[i] % 10 != 0) {
			while (minutes[i] % 10 != 0 && i != 4) {
				minutes[i]++;
			}
//			}
			total += minutes[i];
//			System.out.println(total);
		}
		
		System.out.println(total);
		
	
	}
}