import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] dish = new int[5];
		
		int maxMargin = 0;
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			dish[i] = sc.nextInt();
			
			int margin = (10 - dish[i] % 10) % 10;
			
			sum += dish[i] + margin;
			maxMargin = Math.max(maxMargin, margin);
		}
		
		sum -= maxMargin;
		System.out.println(sum);
		
		sc.close();
	}
	
}

 import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] dish = new int[5];
		
		int maxMargin = 0;
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			dish[i] = sc.nextInt();
			
			int margin = (10 - dish[i] % 10) % 10;
			
			sum += dish[i] + margin;
			maxMargin = Math.max(maxMargin, margin);
		}
		
		sum -= maxMargin;
		System.out.println(sum);
		
		sc.close();
	}
	
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] dish = new int[5];
		
		int maxMargin = 0;
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			dish[i] = sc.nextInt();
			
			int margin = (10 - dish[i] % 10) % 10;
			
			sum += dish[i] + margin;
			maxMargin = Math.max(maxMargin, margin);
		}
		
		sum -= maxMargin;
		System.out.println(sum);
		
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int[] dish = new int[5];
		
		int maxMargin = 0;
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			dish[i] = sc.nextInt();
			
			int margin = (10 - dish[i] % 10) % 10;
			
			sum += dish[i] + margin;
			maxMargin = Math.max(maxMargin, margin);
		}
		
		sum -= maxMargin;
		System.out.println(sum);
		
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] dish = new int[5]; dish new int[5] 5 int maxMargin = 0; maxMargin 0 int sum = 0; sum 0 for (int i = 0; i < 5; i++) {
			dish[i] = sc.nextInt();
			
			int margin = (10 - dish[i] % 10) % 10;
			
			sum += dish[i] + margin;
			maxMargin = Math.max(maxMargin, margin);
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			dish[i] = sc.nextInt();
			
			int margin = (10 - dish[i] % 10) % 10;
			
			sum += dish[i] + margin;
			maxMargin = Math.max(maxMargin, margin);
		} {
			dish[i] = sc.nextInt();
			
			int margin = (10 - dish[i] % 10) % 10;
			
			sum += dish[i] + margin;
			maxMargin = Math.max(maxMargin, margin);
		} dish[i] = sc.nextInt() dish[i] dish i sc.nextInt() sc.nextInt sc int margin = (10 - dish[i] % 10) % 10; margin (10 - dish[i] % 10) % 10 (10 - dish[i] % 10) 10 dish[i] % 10 dish[i] dish i 10 10 sum += dish[i] + margin sum dish[i] + margin dish[i] dish i margin maxMargin = Math.max(maxMargin, margin) maxMargin Math.max(maxMargin, margin) Math.max Math maxMargin margin sum -= maxMargin sum maxMargin System.out.println(sum) System.out.println System.out System System.out sum sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] dish = new int[5];
		
		int maxMargin = 0;
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			dish[i] = sc.nextInt();
			
			int margin = (10 - dish[i] % 10) % 10;
			
			sum += dish[i] + margin;
			maxMargin = Math.max(maxMargin, margin);
		}
		
		sum -= maxMargin;
		System.out.println(sum);
		
		sc.close();
	}
	
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] dish = new int[5];
		
		int maxMargin = 0;
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			dish[i] = sc.nextInt();
			
			int margin = (10 - dish[i] % 10) % 10;
			
			sum += dish[i] + margin;
			maxMargin = Math.max(maxMargin, margin);
		}
		
		sum -= maxMargin;
		System.out.println(sum);
		
		sc.close();
	}
	
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] dish = new int[5];
		
		int maxMargin = 0;
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			dish[i] = sc.nextInt();
			
			int margin = (10 - dish[i] % 10) % 10;
			
			sum += dish[i] + margin;
			maxMargin = Math.max(maxMargin, margin);
		}
		
		sum -= maxMargin;
		System.out.println(sum);
		
		sc.close();
	}
	
}


