import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int sum = 0;
		int max = 0;
		for (int i = 0; i < 5; i++) {
			int num = sc.nextInt();
			sum += num;

			int x = 0;
			if (num % 10 != 0) {
				x = 10 - (num % 10);
			}
			sum += x;

			max = Math.max(max, x);
			//System.out.println(sum);
		}

		sum -= max;

		System.out.println(sum);
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int sum = 0;
		int max = 0;
		for (int i = 0; i < 5; i++) {
			int num = sc.nextInt();
			sum += num;

			int x = 0;
			if (num % 10 != 0) {
				x = 10 - (num % 10);
			}
			sum += x;

			max = Math.max(max, x);
			//System.out.println(sum);
		}

		sum -= max;

		System.out.println(sum);
	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int sum = 0;
		int max = 0;
		for (int i = 0; i < 5; i++) {
			int num = sc.nextInt();
			sum += num;

			int x = 0;
			if (num % 10 != 0) {
				x = 10 - (num % 10);
			}
			sum += x;

			max = Math.max(max, x);
			//System.out.println(sum);
		}

		sum -= max;

		System.out.println(sum);
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int sum = 0;
		int max = 0;
		for (int i = 0; i < 5; i++) {
			int num = sc.nextInt();
			sum += num;

			int x = 0;
			if (num % 10 != 0) {
				x = 10 - (num % 10);
			}
			sum += x;

			max = Math.max(max, x);
			//System.out.println(sum);
		}

		sum -= max;

		System.out.println(sum);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int sum = 0; sum 0 int max = 0; max 0 for (int i = 0; i < 5; i++) {
			int num = sc.nextInt();
			sum += num;

			int x = 0;
			if (num % 10 != 0) {
				x = 10 - (num % 10);
			}
			sum += x;

			max = Math.max(max, x);
			//System.out.println(sum);
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			int num = sc.nextInt();
			sum += num;

			int x = 0;
			if (num % 10 != 0) {
				x = 10 - (num % 10);
			}
			sum += x;

			max = Math.max(max, x);
			//System.out.println(sum);
		} {
			int num = sc.nextInt();
			sum += num;

			int x = 0;
			if (num % 10 != 0) {
				x = 10 - (num % 10);
			}
			sum += x;

			max = Math.max(max, x);
			//System.out.println(sum);
		} int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc sum += num sum num int x = 0; x 0 if (num % 10 != 0) {
				x = 10 - (num % 10);
			} num % 10 != 0 num % 10 num 10 0 {
				x = 10 - (num % 10);
			} x = 10 - (num % 10) x 10 - (num % 10) 10 (num % 10) num 10 sum += x sum x max = Math.max(max, x) max Math.max(max, x) Math.max Math max x sum -= max sum max System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int sum = 0;
		int max = 0;
		for (int i = 0; i < 5; i++) {
			int num = sc.nextInt();
			sum += num;

			int x = 0;
			if (num % 10 != 0) {
				x = 10 - (num % 10);
			}
			sum += x;

			max = Math.max(max, x);
			//System.out.println(sum);
		}

		sum -= max;

		System.out.println(sum);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int sum = 0;
		int max = 0;
		for (int i = 0; i < 5; i++) {
			int num = sc.nextInt();
			sum += num;

			int x = 0;
			if (num % 10 != 0) {
				x = 10 - (num % 10);
			}
			sum += x;

			max = Math.max(max, x);
			//System.out.println(sum);
		}

		sum -= max;

		System.out.println(sum);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int sum = 0;
		int max = 0;
		for (int i = 0; i < 5; i++) {
			int num = sc.nextInt();
			sum += num;

			int x = 0;
			if (num % 10 != 0) {
				x = 10 - (num % 10);
			}
			sum += x;

			max = Math.max(max, x);
			//System.out.println(sum);
		}

		sum -= max;

		System.out.println(sum);
	}

}
