import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[5];
		for (int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < 5; i++) {
			int sum = 0;
			for (int j = 0; j < 5; j++) {
				if (i != j) {
					sum += a[j];
				}
				int m = sum % 10;
				if (m > 0) {
					sum += 10 - m;
				}
			}
			sum += a[i];
			ans = Math.min(ans, sum);
		}
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[5];
		for (int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < 5; i++) {
			int sum = 0;
			for (int j = 0; j < 5; j++) {
				if (i != j) {
					sum += a[j];
				}
				int m = sum % 10;
				if (m > 0) {
					sum += 10 - m;
				}
			}
			sum += a[i];
			ans = Math.min(ans, sum);
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[5];
		for (int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < 5; i++) {
			int sum = 0;
			for (int j = 0; j < 5; j++) {
				if (i != j) {
					sum += a[j];
				}
				int m = sum % 10;
				if (m > 0) {
					sum += 10 - m;
				}
			}
			sum += a[i];
			ans = Math.min(ans, sum);
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[5];
		for (int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < 5; i++) {
			int sum = 0;
			for (int j = 0; j < 5; j++) {
				if (i != j) {
					sum += a[j];
				}
				int m = sum % 10;
				if (m > 0) {
					sum += 10 - m;
				}
			}
			sum += a[i];
			ans = Math.min(ans, sum);
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] a = new int[5]; a new int[5] 5 for (int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			a[i] = sc.nextInt();
		} {
			a[i] = sc.nextInt();
		} a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc sc.close() sc.close sc int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = 0; i < 5; i++) {
			int sum = 0;
			for (int j = 0; j < 5; j++) {
				if (i != j) {
					sum += a[j];
				}
				int m = sum % 10;
				if (m > 0) {
					sum += 10 - m;
				}
			}
			sum += a[i];
			ans = Math.min(ans, sum);
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			int sum = 0;
			for (int j = 0; j < 5; j++) {
				if (i != j) {
					sum += a[j];
				}
				int m = sum % 10;
				if (m > 0) {
					sum += 10 - m;
				}
			}
			sum += a[i];
			ans = Math.min(ans, sum);
		} {
			int sum = 0;
			for (int j = 0; j < 5; j++) {
				if (i != j) {
					sum += a[j];
				}
				int m = sum % 10;
				if (m > 0) {
					sum += 10 - m;
				}
			}
			sum += a[i];
			ans = Math.min(ans, sum);
		} int sum = 0; sum 0 for (int j = 0; j < 5; j++) {
				if (i != j) {
					sum += a[j];
				}
				int m = sum % 10;
				if (m > 0) {
					sum += 10 - m;
				}
			} int j = 0; int j = 0; j 0 j < 5 j 5 j++ j++ j {
				if (i != j) {
					sum += a[j];
				}
				int m = sum % 10;
				if (m > 0) {
					sum += 10 - m;
				}
			} {
				if (i != j) {
					sum += a[j];
				}
				int m = sum % 10;
				if (m > 0) {
					sum += 10 - m;
				}
			} if (i != j) {
					sum += a[j];
				} i != j i j {
					sum += a[j];
				} sum += a[j] sum a[j] a j int m = sum % 10; m sum % 10 sum 10 if (m > 0) {
					sum += 10 - m;
				} m > 0 m 0 {
					sum += 10 - m;
				} sum += 10 - m sum 10 - m 10 m sum += a[i] sum a[i] a i ans = Math.min(ans, sum) ans Math.min(ans, sum) Math.min Math ans sum System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[5];
		for (int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < 5; i++) {
			int sum = 0;
			for (int j = 0; j < 5; j++) {
				if (i != j) {
					sum += a[j];
				}
				int m = sum % 10;
				if (m > 0) {
					sum += 10 - m;
				}
			}
			sum += a[i];
			ans = Math.min(ans, sum);
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[5];
		for (int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < 5; i++) {
			int sum = 0;
			for (int j = 0; j < 5; j++) {
				if (i != j) {
					sum += a[j];
				}
				int m = sum % 10;
				if (m > 0) {
					sum += 10 - m;
				}
			}
			sum += a[i];
			ans = Math.min(ans, sum);
		}
		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[5];
		for (int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < 5; i++) {
			int sum = 0;
			for (int j = 0; j < 5; j++) {
				if (i != j) {
					sum += a[j];
				}
				int m = sum % 10;
				if (m > 0) {
					sum += 10 - m;
				}
			}
			sum += a[i];
			ans = Math.min(ans, sum);
		}
		System.out.println(ans);
	}
}
