import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		int[] input = new int[5];

		input[0] = sc1.nextInt();
		input[1] = sc1.nextInt();
		input[2] = sc1.nextInt();
		input[3] = sc1.nextInt();
		input[4] = sc1.nextInt();

		int[] test = new int[5];

		for (int i=0; i < 5 ; i++) {
			test[i] = input[i]%10;
		}

		int idx = 0;
		for (int i=0; i < 4 ; i++) {
			if (test[i+1] != 0 && test[idx] > test[i+1]) {
				idx = i+1;
			}
		}

		int ans = 0;

		for (int i=0; i < 5 ; i++) {
			if (i == idx) {
				continue;
			}
			else {
				ans += input[i];
				if (input[i]%10 != 0) {
					ans += 10-(input[i]%10);
				}
				//System.out.println(ans);
			}
		}

		ans += input[idx];
		System.out.println(ans);

		sc1.close();

	}

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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		int[] input = new int[5];

		input[0] = sc1.nextInt();
		input[1] = sc1.nextInt();
		input[2] = sc1.nextInt();
		input[3] = sc1.nextInt();
		input[4] = sc1.nextInt();

		int[] test = new int[5];

		for (int i=0; i < 5 ; i++) {
			test[i] = input[i]%10;
		}

		int idx = 0;
		for (int i=0; i < 4 ; i++) {
			if (test[i+1] != 0 && test[idx] > test[i+1]) {
				idx = i+1;
			}
		}

		int ans = 0;

		for (int i=0; i < 5 ; i++) {
			if (i == idx) {
				continue;
			}
			else {
				ans += input[i];
				if (input[i]%10 != 0) {
					ans += 10-(input[i]%10);
				}
				//System.out.println(ans);
			}
		}

		ans += input[idx];
		System.out.println(ans);

		sc1.close();

	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		int[] input = new int[5];

		input[0] = sc1.nextInt();
		input[1] = sc1.nextInt();
		input[2] = sc1.nextInt();
		input[3] = sc1.nextInt();
		input[4] = sc1.nextInt();

		int[] test = new int[5];

		for (int i=0; i < 5 ; i++) {
			test[i] = input[i]%10;
		}

		int idx = 0;
		for (int i=0; i < 4 ; i++) {
			if (test[i+1] != 0 && test[idx] > test[i+1]) {
				idx = i+1;
			}
		}

		int ans = 0;

		for (int i=0; i < 5 ; i++) {
			if (i == idx) {
				continue;
			}
			else {
				ans += input[i];
				if (input[i]%10 != 0) {
					ans += 10-(input[i]%10);
				}
				//System.out.println(ans);
			}
		}

		ans += input[idx];
		System.out.println(ans);

		sc1.close();

	} main {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		int[] input = new int[5];

		input[0] = sc1.nextInt();
		input[1] = sc1.nextInt();
		input[2] = sc1.nextInt();
		input[3] = sc1.nextInt();
		input[4] = sc1.nextInt();

		int[] test = new int[5];

		for (int i=0; i < 5 ; i++) {
			test[i] = input[i]%10;
		}

		int idx = 0;
		for (int i=0; i < 4 ; i++) {
			if (test[i+1] != 0 && test[idx] > test[i+1]) {
				idx = i+1;
			}
		}

		int ans = 0;

		for (int i=0; i < 5 ; i++) {
			if (i == idx) {
				continue;
			}
			else {
				ans += input[i];
				if (input[i]%10 != 0) {
					ans += 10-(input[i]%10);
				}
				//System.out.println(ans);
			}
		}

		ans += input[idx];
		System.out.println(ans);

		sc1.close();

	} Scanner sc1 = new Scanner(System.in); sc1 new Scanner(System.in) int[] input = new int[5]; input new int[5] 5 input[0] = sc1.nextInt() input[0] input 0 sc1.nextInt() sc1.nextInt sc1 input[1] = sc1.nextInt() input[1] input 1 sc1.nextInt() sc1.nextInt sc1 input[2] = sc1.nextInt() input[2] input 2 sc1.nextInt() sc1.nextInt sc1 input[3] = sc1.nextInt() input[3] input 3 sc1.nextInt() sc1.nextInt sc1 input[4] = sc1.nextInt() input[4] input 4 sc1.nextInt() sc1.nextInt sc1 int[] test = new int[5]; test new int[5] 5 for (int i=0; i < 5 ; i++) {
			test[i] = input[i]%10;
		} int i=0; int i=0; i 0 i < 5 i 5 i++ i++ i {
			test[i] = input[i]%10;
		} {
			test[i] = input[i]%10;
		} test[i] = input[i]%10 test[i] test i input[i]%10 input[i] input i 10 int idx = 0; idx 0 for (int i=0; i < 4 ; i++) {
			if (test[i+1] != 0 && test[idx] > test[i+1]) {
				idx = i+1;
			}
		} int i=0; int i=0; i 0 i < 4 i 4 i++ i++ i {
			if (test[i+1] != 0 && test[idx] > test[i+1]) {
				idx = i+1;
			}
		} {
			if (test[i+1] != 0 && test[idx] > test[i+1]) {
				idx = i+1;
			}
		} if (test[i+1] != 0 && test[idx] > test[i+1]) {
				idx = i+1;
			} test[i+1] != 0 && test[idx] > test[i+1] test[i+1] != 0 test[i+1] test i+1 i 1 0 test[idx] > test[i+1] test[idx] test idx test[i+1] test i+1 i 1 {
				idx = i+1;
			} idx = i+1 idx i+1 i 1 int ans = 0; ans 0 for (int i=0; i < 5 ; i++) {
			if (i == idx) {
				continue;
			}
			else {
				ans += input[i];
				if (input[i]%10 != 0) {
					ans += 10-(input[i]%10);
				}
				//System.out.println(ans);
			}
		} int i=0; int i=0; i 0 i < 5 i 5 i++ i++ i {
			if (i == idx) {
				continue;
			}
			else {
				ans += input[i];
				if (input[i]%10 != 0) {
					ans += 10-(input[i]%10);
				}
				//System.out.println(ans);
			}
		} {
			if (i == idx) {
				continue;
			}
			else {
				ans += input[i];
				if (input[i]%10 != 0) {
					ans += 10-(input[i]%10);
				}
				//System.out.println(ans);
			}
		} if (i == idx) {
				continue;
			}
			else {
				ans += input[i];
				if (input[i]%10 != 0) {
					ans += 10-(input[i]%10);
				}
				//System.out.println(ans);
			} i == idx i idx {
				continue;
			} continue; {
				ans += input[i];
				if (input[i]%10 != 0) {
					ans += 10-(input[i]%10);
				}
				//System.out.println(ans);
			} ans += input[i] ans input[i] input i if (input[i]%10 != 0) {
					ans += 10-(input[i]%10);
				} input[i]%10 != 0 input[i]%10 input[i] input i 10 0 {
					ans += 10-(input[i]%10);
				} ans += 10-(input[i]%10) ans 10-(input[i]%10) 10 (input[i]%10) input[i] input i 10 ans += input[idx] ans input[idx] input idx System.out.println(ans) System.out.println System.out System System.out ans sc1.close() sc1.close sc1 String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		int[] input = new int[5];

		input[0] = sc1.nextInt();
		input[1] = sc1.nextInt();
		input[2] = sc1.nextInt();
		input[3] = sc1.nextInt();
		input[4] = sc1.nextInt();

		int[] test = new int[5];

		for (int i=0; i < 5 ; i++) {
			test[i] = input[i]%10;
		}

		int idx = 0;
		for (int i=0; i < 4 ; i++) {
			if (test[i+1] != 0 && test[idx] > test[i+1]) {
				idx = i+1;
			}
		}

		int ans = 0;

		for (int i=0; i < 5 ; i++) {
			if (i == idx) {
				continue;
			}
			else {
				ans += input[i];
				if (input[i]%10 != 0) {
					ans += 10-(input[i]%10);
				}
				//System.out.println(ans);
			}
		}

		ans += input[idx];
		System.out.println(ans);

		sc1.close();

	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		int[] input = new int[5];

		input[0] = sc1.nextInt();
		input[1] = sc1.nextInt();
		input[2] = sc1.nextInt();
		input[3] = sc1.nextInt();
		input[4] = sc1.nextInt();

		int[] test = new int[5];

		for (int i=0; i < 5 ; i++) {
			test[i] = input[i]%10;
		}

		int idx = 0;
		for (int i=0; i < 4 ; i++) {
			if (test[i+1] != 0 && test[idx] > test[i+1]) {
				idx = i+1;
			}
		}

		int ans = 0;

		for (int i=0; i < 5 ; i++) {
			if (i == idx) {
				continue;
			}
			else {
				ans += input[i];
				if (input[i]%10 != 0) {
					ans += 10-(input[i]%10);
				}
				//System.out.println(ans);
			}
		}

		ans += input[idx];
		System.out.println(ans);

		sc1.close();

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		int[] input = new int[5];

		input[0] = sc1.nextInt();
		input[1] = sc1.nextInt();
		input[2] = sc1.nextInt();
		input[3] = sc1.nextInt();
		input[4] = sc1.nextInt();

		int[] test = new int[5];

		for (int i=0; i < 5 ; i++) {
			test[i] = input[i]%10;
		}

		int idx = 0;
		for (int i=0; i < 4 ; i++) {
			if (test[i+1] != 0 && test[idx] > test[i+1]) {
				idx = i+1;
			}
		}

		int ans = 0;

		for (int i=0; i < 5 ; i++) {
			if (i == idx) {
				continue;
			}
			else {
				ans += input[i];
				if (input[i]%10 != 0) {
					ans += 10-(input[i]%10);
				}
				//System.out.println(ans);
			}
		}

		ans += input[idx];
		System.out.println(ans);

		sc1.close();

	}

}