
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int time[] = new int[5];
		for (int i = 0; i < 5; i++) {
			time[i] = scan.nextInt();
		}
		
		int last = 0;
		for (int i = 1; i < 5; i++) {
			if (time[i] % 10 == 0) {
				continue;
			}
			if (time[0] % 10 > time[i] % 10) {
				last = i;
			}
		}
		
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			
			if (time[i] % 10 == 0 || i == last) {
				sum += time[i];
			} else {
				sum += time[i] + (10 - (time[i] % 10));
			}
			
		}
		
		System.out.println(sum);
		scan.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int time[] = new int[5];
		for (int i = 0; i < 5; i++) {
			time[i] = scan.nextInt();
		}
		
		int last = 0;
		for (int i = 1; i < 5; i++) {
			if (time[i] % 10 == 0) {
				continue;
			}
			if (time[0] % 10 > time[i] % 10) {
				last = i;
			}
		}
		
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			
			if (time[i] % 10 == 0 || i == last) {
				sum += time[i];
			} else {
				sum += time[i] + (10 - (time[i] % 10));
			}
			
		}
		
		System.out.println(sum);
		scan.close();
	}
} Main public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int time[] = new int[5];
		for (int i = 0; i < 5; i++) {
			time[i] = scan.nextInt();
		}
		
		int last = 0;
		for (int i = 1; i < 5; i++) {
			if (time[i] % 10 == 0) {
				continue;
			}
			if (time[0] % 10 > time[i] % 10) {
				last = i;
			}
		}
		
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			
			if (time[i] % 10 == 0 || i == last) {
				sum += time[i];
			} else {
				sum += time[i] + (10 - (time[i] % 10));
			}
			
		}
		
		System.out.println(sum);
		scan.close();
	} main {

		Scanner scan = new Scanner(System.in);
		int time[] = new int[5];
		for (int i = 0; i < 5; i++) {
			time[i] = scan.nextInt();
		}
		
		int last = 0;
		for (int i = 1; i < 5; i++) {
			if (time[i] % 10 == 0) {
				continue;
			}
			if (time[0] % 10 > time[i] % 10) {
				last = i;
			}
		}
		
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			
			if (time[i] % 10 == 0 || i == last) {
				sum += time[i];
			} else {
				sum += time[i] + (10 - (time[i] % 10));
			}
			
		}
		
		System.out.println(sum);
		scan.close();
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int time[] = new int[5]; time new int[5] 5 for (int i = 0; i < 5; i++) {
			time[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			time[i] = scan.nextInt();
		} {
			time[i] = scan.nextInt();
		} time[i] = scan.nextInt() time[i] time i scan.nextInt() scan.nextInt scan int last = 0; last 0 for (int i = 1; i < 5; i++) {
			if (time[i] % 10 == 0) {
				continue;
			}
			if (time[0] % 10 > time[i] % 10) {
				last = i;
			}
		} int i = 1; int i = 1; i 1 i < 5 i 5 i++ i++ i {
			if (time[i] % 10 == 0) {
				continue;
			}
			if (time[0] % 10 > time[i] % 10) {
				last = i;
			}
		} {
			if (time[i] % 10 == 0) {
				continue;
			}
			if (time[0] % 10 > time[i] % 10) {
				last = i;
			}
		} if (time[i] % 10 == 0) {
				continue;
			} time[i] % 10 == 0 time[i] % 10 time[i] time i 10 0 {
				continue;
			} continue; if (time[0] % 10 > time[i] % 10) {
				last = i;
			} time[0] % 10 > time[i] % 10 time[0] % 10 time[0] time 0 10 time[i] % 10 time[i] time i 10 {
				last = i;
			} last = i last i int sum = 0; sum 0 for (int i = 0; i < 5; i++) {
			
			if (time[i] % 10 == 0 || i == last) {
				sum += time[i];
			} else {
				sum += time[i] + (10 - (time[i] % 10));
			}
			
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			
			if (time[i] % 10 == 0 || i == last) {
				sum += time[i];
			} else {
				sum += time[i] + (10 - (time[i] % 10));
			}
			
		} {
			
			if (time[i] % 10 == 0 || i == last) {
				sum += time[i];
			} else {
				sum += time[i] + (10 - (time[i] % 10));
			}
			
		} if (time[i] % 10 == 0 || i == last) {
				sum += time[i];
			} else {
				sum += time[i] + (10 - (time[i] % 10));
			} time[i] % 10 == 0 || i == last time[i] % 10 == 0 time[i] % 10 time[i] time i 10 0 i == last i last {
				sum += time[i];
			} sum += time[i] sum time[i] time i {
				sum += time[i] + (10 - (time[i] % 10));
			} sum += time[i] + (10 - (time[i] % 10)) sum time[i] + (10 - (time[i] % 10)) time[i] time i (10 - (time[i] % 10)) 10 (time[i] % 10) time[i] time i 10 System.out.println(sum) System.out.println System.out System System.out sum scan.close() scan.close scan String[] args args public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int time[] = new int[5];
		for (int i = 0; i < 5; i++) {
			time[i] = scan.nextInt();
		}
		
		int last = 0;
		for (int i = 1; i < 5; i++) {
			if (time[i] % 10 == 0) {
				continue;
			}
			if (time[0] % 10 > time[i] % 10) {
				last = i;
			}
		}
		
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			
			if (time[i] % 10 == 0 || i == last) {
				sum += time[i];
			} else {
				sum += time[i] + (10 - (time[i] % 10));
			}
			
		}
		
		System.out.println(sum);
		scan.close();
	}
} public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int time[] = new int[5];
		for (int i = 0; i < 5; i++) {
			time[i] = scan.nextInt();
		}
		
		int last = 0;
		for (int i = 1; i < 5; i++) {
			if (time[i] % 10 == 0) {
				continue;
			}
			if (time[0] % 10 > time[i] % 10) {
				last = i;
			}
		}
		
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			
			if (time[i] % 10 == 0 || i == last) {
				sum += time[i];
			} else {
				sum += time[i] + (10 - (time[i] % 10));
			}
			
		}
		
		System.out.println(sum);
		scan.close();
	}
} Main

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int time[] = new int[5];
		for (int i = 0; i < 5; i++) {
			time[i] = scan.nextInt();
		}
		
		int last = 0;
		for (int i = 1; i < 5; i++) {
			if (time[i] % 10 == 0) {
				continue;
			}
			if (time[0] % 10 > time[i] % 10) {
				last = i;
			}
		}
		
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			
			if (time[i] % 10 == 0 || i == last) {
				sum += time[i];
			} else {
				sum += time[i] + (10 - (time[i] % 10));
			}
			
		}
		
		System.out.println(sum);
		scan.close();
	}
}