import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);

		int[] time = new int[5];
		int sum = 0;
		int frac = 10;
		for (int i = 0; i < 5; i++) {
			time[i] = sc.nextInt();
			sum += ((time[i] - 1) / 10 + 1) * 10;

			if (time[i] % 10 != 0) {
				frac = Math.min(frac, (time[i] % 10));
			}
		}
		System.out.println(sum - (10 - frac));
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);

		int[] time = new int[5];
		int sum = 0;
		int frac = 10;
		for (int i = 0; i < 5; i++) {
			time[i] = sc.nextInt();
			sum += ((time[i] - 1) / 10 + 1) * 10;

			if (time[i] % 10 != 0) {
				frac = Math.min(frac, (time[i] % 10));
			}
		}
		System.out.println(sum - (10 - frac));
	}
} Main public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);

		int[] time = new int[5];
		int sum = 0;
		int frac = 10;
		for (int i = 0; i < 5; i++) {
			time[i] = sc.nextInt();
			sum += ((time[i] - 1) / 10 + 1) * 10;

			if (time[i] % 10 != 0) {
				frac = Math.min(frac, (time[i] % 10));
			}
		}
		System.out.println(sum - (10 - frac));
	} main {

		Scanner sc = new Scanner(System.in);

		int[] time = new int[5];
		int sum = 0;
		int frac = 10;
		for (int i = 0; i < 5; i++) {
			time[i] = sc.nextInt();
			sum += ((time[i] - 1) / 10 + 1) * 10;

			if (time[i] % 10 != 0) {
				frac = Math.min(frac, (time[i] % 10));
			}
		}
		System.out.println(sum - (10 - frac));
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] time = new int[5]; time new int[5] 5 int sum = 0; sum 0 int frac = 10; frac 10 for (int i = 0; i < 5; i++) {
			time[i] = sc.nextInt();
			sum += ((time[i] - 1) / 10 + 1) * 10;

			if (time[i] % 10 != 0) {
				frac = Math.min(frac, (time[i] % 10));
			}
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			time[i] = sc.nextInt();
			sum += ((time[i] - 1) / 10 + 1) * 10;

			if (time[i] % 10 != 0) {
				frac = Math.min(frac, (time[i] % 10));
			}
		} {
			time[i] = sc.nextInt();
			sum += ((time[i] - 1) / 10 + 1) * 10;

			if (time[i] % 10 != 0) {
				frac = Math.min(frac, (time[i] % 10));
			}
		} time[i] = sc.nextInt() time[i] time i sc.nextInt() sc.nextInt sc sum += ((time[i] - 1) / 10 + 1) * 10 sum ((time[i] - 1) / 10 + 1) * 10 ((time[i] - 1) / 10 + 1) (time[i] - 1) / 10 (time[i] - 1) time[i] time i 1 10 1 10 if (time[i] % 10 != 0) {
				frac = Math.min(frac, (time[i] % 10));
			} time[i] % 10 != 0 time[i] % 10 time[i] time i 10 0 {
				frac = Math.min(frac, (time[i] % 10));
			} frac = Math.min(frac, (time[i] % 10)) frac Math.min(frac, (time[i] % 10)) Math.min Math frac (time[i] % 10) time[i] time i 10 System.out.println(sum - (10 - frac)) System.out.println System.out System System.out sum - (10 - frac) sum (10 - frac) 10 frac String args[] args public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);

		int[] time = new int[5];
		int sum = 0;
		int frac = 10;
		for (int i = 0; i < 5; i++) {
			time[i] = sc.nextInt();
			sum += ((time[i] - 1) / 10 + 1) * 10;

			if (time[i] % 10 != 0) {
				frac = Math.min(frac, (time[i] % 10));
			}
		}
		System.out.println(sum - (10 - frac));
	}
} public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);

		int[] time = new int[5];
		int sum = 0;
		int frac = 10;
		for (int i = 0; i < 5; i++) {
			time[i] = sc.nextInt();
			sum += ((time[i] - 1) / 10 + 1) * 10;

			if (time[i] % 10 != 0) {
				frac = Math.min(frac, (time[i] % 10));
			}
		}
		System.out.println(sum - (10 - frac));
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);

		int[] time = new int[5];
		int sum = 0;
		int frac = 10;
		for (int i = 0; i < 5; i++) {
			time[i] = sc.nextInt();
			sum += ((time[i] - 1) / 10 + 1) * 10;

			if (time[i] % 10 != 0) {
				frac = Math.min(frac, (time[i] % 10));
			}
		}
		System.out.println(sum - (10 - frac));
	}
}