import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int dishAmount = 5;
		int[] time = new int[dishAmount];
		int lastTime = 0;
		int totalTime = 0;
		for(int i = 0 ; i < dishAmount ; i++) {
			time[i] = sc.nextInt();
			if(time[i] % 10 != 0) {
				totalTime = totalTime + (10 * ((time[i] / 10) + 1));
				
				if(lastTime < 10 - (time[i] % 10)) {
					lastTime = 10 - (time[i] % 10);
				}
			}else {
				totalTime = totalTime + time[i];
			}
		}
		sc.close();
		System.out.println(totalTime - lastTime);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int dishAmount = 5;
		int[] time = new int[dishAmount];
		int lastTime = 0;
		int totalTime = 0;
		for(int i = 0 ; i < dishAmount ; i++) {
			time[i] = sc.nextInt();
			if(time[i] % 10 != 0) {
				totalTime = totalTime + (10 * ((time[i] / 10) + 1));
				
				if(lastTime < 10 - (time[i] % 10)) {
					lastTime = 10 - (time[i] % 10);
				}
			}else {
				totalTime = totalTime + time[i];
			}
		}
		sc.close();
		System.out.println(totalTime - lastTime);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int dishAmount = 5;
		int[] time = new int[dishAmount];
		int lastTime = 0;
		int totalTime = 0;
		for(int i = 0 ; i < dishAmount ; i++) {
			time[i] = sc.nextInt();
			if(time[i] % 10 != 0) {
				totalTime = totalTime + (10 * ((time[i] / 10) + 1));
				
				if(lastTime < 10 - (time[i] % 10)) {
					lastTime = 10 - (time[i] % 10);
				}
			}else {
				totalTime = totalTime + time[i];
			}
		}
		sc.close();
		System.out.println(totalTime - lastTime);
	} main {
		Scanner sc = new Scanner(System.in);
		int dishAmount = 5;
		int[] time = new int[dishAmount];
		int lastTime = 0;
		int totalTime = 0;
		for(int i = 0 ; i < dishAmount ; i++) {
			time[i] = sc.nextInt();
			if(time[i] % 10 != 0) {
				totalTime = totalTime + (10 * ((time[i] / 10) + 1));
				
				if(lastTime < 10 - (time[i] % 10)) {
					lastTime = 10 - (time[i] % 10);
				}
			}else {
				totalTime = totalTime + time[i];
			}
		}
		sc.close();
		System.out.println(totalTime - lastTime);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int dishAmount = 5; dishAmount 5 int[] time = new int[dishAmount]; time new int[dishAmount] dishAmount int lastTime = 0; lastTime 0 int totalTime = 0; totalTime 0 for(int i = 0 ; i < dishAmount ; i++) {
			time[i] = sc.nextInt();
			if(time[i] % 10 != 0) {
				totalTime = totalTime + (10 * ((time[i] / 10) + 1));
				
				if(lastTime < 10 - (time[i] % 10)) {
					lastTime = 10 - (time[i] % 10);
				}
			}else {
				totalTime = totalTime + time[i];
			}
		} int i = 0 ; int i = 0 ; i 0 i < dishAmount i dishAmount i++ i++ i {
			time[i] = sc.nextInt();
			if(time[i] % 10 != 0) {
				totalTime = totalTime + (10 * ((time[i] / 10) + 1));
				
				if(lastTime < 10 - (time[i] % 10)) {
					lastTime = 10 - (time[i] % 10);
				}
			}else {
				totalTime = totalTime + time[i];
			}
		} {
			time[i] = sc.nextInt();
			if(time[i] % 10 != 0) {
				totalTime = totalTime + (10 * ((time[i] / 10) + 1));
				
				if(lastTime < 10 - (time[i] % 10)) {
					lastTime = 10 - (time[i] % 10);
				}
			}else {
				totalTime = totalTime + time[i];
			}
		} time[i] = sc.nextInt() time[i] time i sc.nextInt() sc.nextInt sc if(time[i] % 10 != 0) {
				totalTime = totalTime + (10 * ((time[i] / 10) + 1));
				
				if(lastTime < 10 - (time[i] % 10)) {
					lastTime = 10 - (time[i] % 10);
				}
			}else {
				totalTime = totalTime + time[i];
			} time[i] % 10 != 0 time[i] % 10 time[i] time i 10 0 {
				totalTime = totalTime + (10 * ((time[i] / 10) + 1));
				
				if(lastTime < 10 - (time[i] % 10)) {
					lastTime = 10 - (time[i] % 10);
				}
			} totalTime = totalTime + (10 * ((time[i] / 10) + 1)) totalTime totalTime + (10 * ((time[i] / 10) + 1)) totalTime (10 * ((time[i] / 10) + 1)) 10 ((time[i] / 10) + 1) (time[i] / 10) time[i] time i 10 1 if(lastTime < 10 - (time[i] % 10)) {
					lastTime = 10 - (time[i] % 10);
				} lastTime < 10 - (time[i] % 10) lastTime 10 - (time[i] % 10) 10 (time[i] % 10) time[i] time i 10 {
					lastTime = 10 - (time[i] % 10);
				} lastTime = 10 - (time[i] % 10) lastTime 10 - (time[i] % 10) 10 (time[i] % 10) time[i] time i 10 {
				totalTime = totalTime + time[i];
			} totalTime = totalTime + time[i] totalTime totalTime + time[i] totalTime time[i] time i sc.close() sc.close sc System.out.println(totalTime - lastTime) System.out.println System.out System System.out totalTime - lastTime totalTime lastTime String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int dishAmount = 5;
		int[] time = new int[dishAmount];
		int lastTime = 0;
		int totalTime = 0;
		for(int i = 0 ; i < dishAmount ; i++) {
			time[i] = sc.nextInt();
			if(time[i] % 10 != 0) {
				totalTime = totalTime + (10 * ((time[i] / 10) + 1));
				
				if(lastTime < 10 - (time[i] % 10)) {
					lastTime = 10 - (time[i] % 10);
				}
			}else {
				totalTime = totalTime + time[i];
			}
		}
		sc.close();
		System.out.println(totalTime - lastTime);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int dishAmount = 5;
		int[] time = new int[dishAmount];
		int lastTime = 0;
		int totalTime = 0;
		for(int i = 0 ; i < dishAmount ; i++) {
			time[i] = sc.nextInt();
			if(time[i] % 10 != 0) {
				totalTime = totalTime + (10 * ((time[i] / 10) + 1));
				
				if(lastTime < 10 - (time[i] % 10)) {
					lastTime = 10 - (time[i] % 10);
				}
			}else {
				totalTime = totalTime + time[i];
			}
		}
		sc.close();
		System.out.println(totalTime - lastTime);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int dishAmount = 5;
		int[] time = new int[dishAmount];
		int lastTime = 0;
		int totalTime = 0;
		for(int i = 0 ; i < dishAmount ; i++) {
			time[i] = sc.nextInt();
			if(time[i] % 10 != 0) {
				totalTime = totalTime + (10 * ((time[i] / 10) + 1));
				
				if(lastTime < 10 - (time[i] % 10)) {
					lastTime = 10 - (time[i] % 10);
				}
			}else {
				totalTime = totalTime + time[i];
			}
		}
		sc.close();
		System.out.println(totalTime - lastTime);
	}
}