import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		Scanner sc = new Scanner(System.in);
		main.solve(sc);
		sc.close();
	}

	void solve(Scanner sc) {
		int[] ia = new int[5];
		ia[0] = sc.nextInt();
		ia[1] = sc.nextInt();
		ia[2] = sc.nextInt();
		ia[3] = sc.nextInt();
		ia[4] = sc.nextInt();

		int sum = 0;
		int min = 9;
		int ii = 0;

		for (int i = 0; i < 5; i++) {
			if (ia[i] % 10 == 0) {
				continue;
			}
			if (ia[i] % 10 < min) {
				ii = i;
				min = ia[i] % 10;
			}
		}

		for (int i = 0; i < 5; i++) {
			if (i == ii) {
				continue;
			}

			if (ia[i] % 10 == 0) {
				sum += ia[i];
			} else {
				sum += ia[i] + (10 - ia[i] % 10);
			}
		}
		sum += ia[ii];

		System.out.println(sum);
	}
} import java.util.Arrays; Arrays java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		Scanner sc = new Scanner(System.in);
		main.solve(sc);
		sc.close();
	}

	void solve(Scanner sc) {
		int[] ia = new int[5];
		ia[0] = sc.nextInt();
		ia[1] = sc.nextInt();
		ia[2] = sc.nextInt();
		ia[3] = sc.nextInt();
		ia[4] = sc.nextInt();

		int sum = 0;
		int min = 9;
		int ii = 0;

		for (int i = 0; i < 5; i++) {
			if (ia[i] % 10 == 0) {
				continue;
			}
			if (ia[i] % 10 < min) {
				ii = i;
				min = ia[i] % 10;
			}
		}

		for (int i = 0; i < 5; i++) {
			if (i == ii) {
				continue;
			}

			if (ia[i] % 10 == 0) {
				sum += ia[i];
			} else {
				sum += ia[i] + (10 - ia[i] % 10);
			}
		}
		sum += ia[ii];

		System.out.println(sum);
	}
} Main public static void main(String[] args) {
		Main main = new Main();
		Scanner sc = new Scanner(System.in);
		main.solve(sc);
		sc.close();
	} main {
		Main main = new Main();
		Scanner sc = new Scanner(System.in);
		main.solve(sc);
		sc.close();
	} Main main = new Main(); main new Main() Scanner sc = new Scanner(System.in); sc new Scanner(System.in) main.solve(sc) main.solve main sc sc.close() sc.close sc String[] args args void solve(Scanner sc) {
		int[] ia = new int[5];
		ia[0] = sc.nextInt();
		ia[1] = sc.nextInt();
		ia[2] = sc.nextInt();
		ia[3] = sc.nextInt();
		ia[4] = sc.nextInt();

		int sum = 0;
		int min = 9;
		int ii = 0;

		for (int i = 0; i < 5; i++) {
			if (ia[i] % 10 == 0) {
				continue;
			}
			if (ia[i] % 10 < min) {
				ii = i;
				min = ia[i] % 10;
			}
		}

		for (int i = 0; i < 5; i++) {
			if (i == ii) {
				continue;
			}

			if (ia[i] % 10 == 0) {
				sum += ia[i];
			} else {
				sum += ia[i] + (10 - ia[i] % 10);
			}
		}
		sum += ia[ii];

		System.out.println(sum);
	} solve {
		int[] ia = new int[5];
		ia[0] = sc.nextInt();
		ia[1] = sc.nextInt();
		ia[2] = sc.nextInt();
		ia[3] = sc.nextInt();
		ia[4] = sc.nextInt();

		int sum = 0;
		int min = 9;
		int ii = 0;

		for (int i = 0; i < 5; i++) {
			if (ia[i] % 10 == 0) {
				continue;
			}
			if (ia[i] % 10 < min) {
				ii = i;
				min = ia[i] % 10;
			}
		}

		for (int i = 0; i < 5; i++) {
			if (i == ii) {
				continue;
			}

			if (ia[i] % 10 == 0) {
				sum += ia[i];
			} else {
				sum += ia[i] + (10 - ia[i] % 10);
			}
		}
		sum += ia[ii];

		System.out.println(sum);
	} int[] ia = new int[5]; ia new int[5] 5 ia[0] = sc.nextInt() ia[0] ia 0 sc.nextInt() sc.nextInt sc ia[1] = sc.nextInt() ia[1] ia 1 sc.nextInt() sc.nextInt sc ia[2] = sc.nextInt() ia[2] ia 2 sc.nextInt() sc.nextInt sc ia[3] = sc.nextInt() ia[3] ia 3 sc.nextInt() sc.nextInt sc ia[4] = sc.nextInt() ia[4] ia 4 sc.nextInt() sc.nextInt sc int sum = 0; sum 0 int min = 9; min 9 int ii = 0; ii 0 for (int i = 0; i < 5; i++) {
			if (ia[i] % 10 == 0) {
				continue;
			}
			if (ia[i] % 10 < min) {
				ii = i;
				min = ia[i] % 10;
			}
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			if (ia[i] % 10 == 0) {
				continue;
			}
			if (ia[i] % 10 < min) {
				ii = i;
				min = ia[i] % 10;
			}
		} {
			if (ia[i] % 10 == 0) {
				continue;
			}
			if (ia[i] % 10 < min) {
				ii = i;
				min = ia[i] % 10;
			}
		} if (ia[i] % 10 == 0) {
				continue;
			} ia[i] % 10 == 0 ia[i] % 10 ia[i] ia i 10 0 {
				continue;
			} continue; if (ia[i] % 10 < min) {
				ii = i;
				min = ia[i] % 10;
			} ia[i] % 10 < min ia[i] % 10 ia[i] ia i 10 min {
				ii = i;
				min = ia[i] % 10;
			} ii = i ii i min = ia[i] % 10 min ia[i] % 10 ia[i] ia i 10 for (int i = 0; i < 5; i++) {
			if (i == ii) {
				continue;
			}

			if (ia[i] % 10 == 0) {
				sum += ia[i];
			} else {
				sum += ia[i] + (10 - ia[i] % 10);
			}
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			if (i == ii) {
				continue;
			}

			if (ia[i] % 10 == 0) {
				sum += ia[i];
			} else {
				sum += ia[i] + (10 - ia[i] % 10);
			}
		} {
			if (i == ii) {
				continue;
			}

			if (ia[i] % 10 == 0) {
				sum += ia[i];
			} else {
				sum += ia[i] + (10 - ia[i] % 10);
			}
		} if (i == ii) {
				continue;
			} i == ii i ii {
				continue;
			} continue; if (ia[i] % 10 == 0) {
				sum += ia[i];
			} else {
				sum += ia[i] + (10 - ia[i] % 10);
			} ia[i] % 10 == 0 ia[i] % 10 ia[i] ia i 10 0 {
				sum += ia[i];
			} sum += ia[i] sum ia[i] ia i {
				sum += ia[i] + (10 - ia[i] % 10);
			} sum += ia[i] + (10 - ia[i] % 10) sum ia[i] + (10 - ia[i] % 10) ia[i] ia i (10 - ia[i] % 10) 10 ia[i] % 10 ia[i] ia i 10 sum += ia[ii] sum ia[ii] ia ii System.out.println(sum) System.out.println System.out System System.out sum Scanner sc sc public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		Scanner sc = new Scanner(System.in);
		main.solve(sc);
		sc.close();
	}

	void solve(Scanner sc) {
		int[] ia = new int[5];
		ia[0] = sc.nextInt();
		ia[1] = sc.nextInt();
		ia[2] = sc.nextInt();
		ia[3] = sc.nextInt();
		ia[4] = sc.nextInt();

		int sum = 0;
		int min = 9;
		int ii = 0;

		for (int i = 0; i < 5; i++) {
			if (ia[i] % 10 == 0) {
				continue;
			}
			if (ia[i] % 10 < min) {
				ii = i;
				min = ia[i] % 10;
			}
		}

		for (int i = 0; i < 5; i++) {
			if (i == ii) {
				continue;
			}

			if (ia[i] % 10 == 0) {
				sum += ia[i];
			} else {
				sum += ia[i] + (10 - ia[i] % 10);
			}
		}
		sum += ia[ii];

		System.out.println(sum);
	}
} public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		Scanner sc = new Scanner(System.in);
		main.solve(sc);
		sc.close();
	}

	void solve(Scanner sc) {
		int[] ia = new int[5];
		ia[0] = sc.nextInt();
		ia[1] = sc.nextInt();
		ia[2] = sc.nextInt();
		ia[3] = sc.nextInt();
		ia[4] = sc.nextInt();

		int sum = 0;
		int min = 9;
		int ii = 0;

		for (int i = 0; i < 5; i++) {
			if (ia[i] % 10 == 0) {
				continue;
			}
			if (ia[i] % 10 < min) {
				ii = i;
				min = ia[i] % 10;
			}
		}

		for (int i = 0; i < 5; i++) {
			if (i == ii) {
				continue;
			}

			if (ia[i] % 10 == 0) {
				sum += ia[i];
			} else {
				sum += ia[i] + (10 - ia[i] % 10);
			}
		}
		sum += ia[ii];

		System.out.println(sum);
	}
} Main
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		Scanner sc = new Scanner(System.in);
		main.solve(sc);
		sc.close();
	}

	void solve(Scanner sc) {
		int[] ia = new int[5];
		ia[0] = sc.nextInt();
		ia[1] = sc.nextInt();
		ia[2] = sc.nextInt();
		ia[3] = sc.nextInt();
		ia[4] = sc.nextInt();

		int sum = 0;
		int min = 9;
		int ii = 0;

		for (int i = 0; i < 5; i++) {
			if (ia[i] % 10 == 0) {
				continue;
			}
			if (ia[i] % 10 < min) {
				ii = i;
				min = ia[i] % 10;
			}
		}

		for (int i = 0; i < 5; i++) {
			if (i == ii) {
				continue;
			}

			if (ia[i] % 10 == 0) {
				sum += ia[i];
			} else {
				sum += ia[i] + (10 - ia[i] % 10);
			}
		}
		sum += ia[ii];

		System.out.println(sum);
	}
}