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

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		int[] array = new int[5];
		array[0] = a;
		array[1] = b;
		array[2] = c;
		array[3] = d;
		array[4] = e;
		int[] sort = new int[5];
		sort[0] = a % 10 == 0 ? 10 : a % 10;
		sort[1] = b % 10 == 0 ? 10 : b % 10;
		sort[2] = c % 10 == 0 ? 10 : c % 10;
		sort[3] = d % 10 == 0 ? 10 : d % 10;
		sort[4] = e % 10 == 0 ? 10 : e % 10;
		Arrays.sort(sort);
		int modMin = sort[0];
		int ans = 0;
		boolean done = false;
		for(int i = 0 ; i < 5 ; i++) {
			if(array[i] % 10 == modMin && !done) {
				ans += array[i];
				done = true;
			} else {
				ans += array[i];
				if(array[i] % 10 != 0) {
					ans += (10 - array[i] % 10);
				}
			}
		}

		System.out.println(ans);
		sc.close();

	}

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

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		int[] array = new int[5];
		array[0] = a;
		array[1] = b;
		array[2] = c;
		array[3] = d;
		array[4] = e;
		int[] sort = new int[5];
		sort[0] = a % 10 == 0 ? 10 : a % 10;
		sort[1] = b % 10 == 0 ? 10 : b % 10;
		sort[2] = c % 10 == 0 ? 10 : c % 10;
		sort[3] = d % 10 == 0 ? 10 : d % 10;
		sort[4] = e % 10 == 0 ? 10 : e % 10;
		Arrays.sort(sort);
		int modMin = sort[0];
		int ans = 0;
		boolean done = false;
		for(int i = 0 ; i < 5 ; i++) {
			if(array[i] % 10 == modMin && !done) {
				ans += array[i];
				done = true;
			} else {
				ans += array[i];
				if(array[i] % 10 != 0) {
					ans += (10 - array[i] % 10);
				}
			}
		}

		System.out.println(ans);
		sc.close();

	}

} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		int[] array = new int[5];
		array[0] = a;
		array[1] = b;
		array[2] = c;
		array[3] = d;
		array[4] = e;
		int[] sort = new int[5];
		sort[0] = a % 10 == 0 ? 10 : a % 10;
		sort[1] = b % 10 == 0 ? 10 : b % 10;
		sort[2] = c % 10 == 0 ? 10 : c % 10;
		sort[3] = d % 10 == 0 ? 10 : d % 10;
		sort[4] = e % 10 == 0 ? 10 : e % 10;
		Arrays.sort(sort);
		int modMin = sort[0];
		int ans = 0;
		boolean done = false;
		for(int i = 0 ; i < 5 ; i++) {
			if(array[i] % 10 == modMin && !done) {
				ans += array[i];
				done = true;
			} else {
				ans += array[i];
				if(array[i] % 10 != 0) {
					ans += (10 - array[i] % 10);
				}
			}
		}

		System.out.println(ans);
		sc.close();

	} main {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		int[] array = new int[5];
		array[0] = a;
		array[1] = b;
		array[2] = c;
		array[3] = d;
		array[4] = e;
		int[] sort = new int[5];
		sort[0] = a % 10 == 0 ? 10 : a % 10;
		sort[1] = b % 10 == 0 ? 10 : b % 10;
		sort[2] = c % 10 == 0 ? 10 : c % 10;
		sort[3] = d % 10 == 0 ? 10 : d % 10;
		sort[4] = e % 10 == 0 ? 10 : e % 10;
		Arrays.sort(sort);
		int modMin = sort[0];
		int ans = 0;
		boolean done = false;
		for(int i = 0 ; i < 5 ; i++) {
			if(array[i] % 10 == modMin && !done) {
				ans += array[i];
				done = true;
			} else {
				ans += array[i];
				if(array[i] % 10 != 0) {
					ans += (10 - array[i] % 10);
				}
			}
		}

		System.out.println(ans);
		sc.close();

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int c = sc.nextInt(); c sc.nextInt() sc.nextInt sc int d = sc.nextInt(); d sc.nextInt() sc.nextInt sc int e = sc.nextInt(); e sc.nextInt() sc.nextInt sc int[] array = new int[5]; array new int[5] 5 array[0] = a array[0] array 0 a array[1] = b array[1] array 1 b array[2] = c array[2] array 2 c array[3] = d array[3] array 3 d array[4] = e array[4] array 4 e int[] sort = new int[5]; sort new int[5] 5 sort[0] = a % 10 == 0 ? 10 : a % 10 sort[0] sort 0 a % 10 == 0 ? 10 : a % 10 a % 10 == 0 a % 10 a 10 0 10 a % 10 a 10 sort[1] = b % 10 == 0 ? 10 : b % 10 sort[1] sort 1 b % 10 == 0 ? 10 : b % 10 b % 10 == 0 b % 10 b 10 0 10 b % 10 b 10 sort[2] = c % 10 == 0 ? 10 : c % 10 sort[2] sort 2 c % 10 == 0 ? 10 : c % 10 c % 10 == 0 c % 10 c 10 0 10 c % 10 c 10 sort[3] = d % 10 == 0 ? 10 : d % 10 sort[3] sort 3 d % 10 == 0 ? 10 : d % 10 d % 10 == 0 d % 10 d 10 0 10 d % 10 d 10 sort[4] = e % 10 == 0 ? 10 : e % 10 sort[4] sort 4 e % 10 == 0 ? 10 : e % 10 e % 10 == 0 e % 10 e 10 0 10 e % 10 e 10 Arrays.sort(sort) Arrays.sort Arrays sort int modMin = sort[0]; modMin sort[0] sort 0 int ans = 0; ans 0 boolean done = false; done false for(int i = 0 ; i < 5 ; i++) {
			if(array[i] % 10 == modMin && !done) {
				ans += array[i];
				done = true;
			} else {
				ans += array[i];
				if(array[i] % 10 != 0) {
					ans += (10 - array[i] % 10);
				}
			}
		} int i = 0 ; int i = 0 ; i 0 i < 5 i 5 i++ i++ i {
			if(array[i] % 10 == modMin && !done) {
				ans += array[i];
				done = true;
			} else {
				ans += array[i];
				if(array[i] % 10 != 0) {
					ans += (10 - array[i] % 10);
				}
			}
		} {
			if(array[i] % 10 == modMin && !done) {
				ans += array[i];
				done = true;
			} else {
				ans += array[i];
				if(array[i] % 10 != 0) {
					ans += (10 - array[i] % 10);
				}
			}
		} if(array[i] % 10 == modMin && !done) {
				ans += array[i];
				done = true;
			} else {
				ans += array[i];
				if(array[i] % 10 != 0) {
					ans += (10 - array[i] % 10);
				}
			} array[i] % 10 == modMin && !done array[i] % 10 == modMin array[i] % 10 array[i] array i 10 modMin !done done {
				ans += array[i];
				done = true;
			} ans += array[i] ans array[i] array i done = true done true {
				ans += array[i];
				if(array[i] % 10 != 0) {
					ans += (10 - array[i] % 10);
				}
			} ans += array[i] ans array[i] array i if(array[i] % 10 != 0) {
					ans += (10 - array[i] % 10);
				} array[i] % 10 != 0 array[i] % 10 array[i] array i 10 0 {
					ans += (10 - array[i] % 10);
				} ans += (10 - array[i] % 10) ans (10 - array[i] % 10) 10 array[i] % 10 array[i] array i 10 System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		int[] array = new int[5];
		array[0] = a;
		array[1] = b;
		array[2] = c;
		array[3] = d;
		array[4] = e;
		int[] sort = new int[5];
		sort[0] = a % 10 == 0 ? 10 : a % 10;
		sort[1] = b % 10 == 0 ? 10 : b % 10;
		sort[2] = c % 10 == 0 ? 10 : c % 10;
		sort[3] = d % 10 == 0 ? 10 : d % 10;
		sort[4] = e % 10 == 0 ? 10 : e % 10;
		Arrays.sort(sort);
		int modMin = sort[0];
		int ans = 0;
		boolean done = false;
		for(int i = 0 ; i < 5 ; i++) {
			if(array[i] % 10 == modMin && !done) {
				ans += array[i];
				done = true;
			} else {
				ans += array[i];
				if(array[i] % 10 != 0) {
					ans += (10 - array[i] % 10);
				}
			}
		}

		System.out.println(ans);
		sc.close();

	}

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		int[] array = new int[5];
		array[0] = a;
		array[1] = b;
		array[2] = c;
		array[3] = d;
		array[4] = e;
		int[] sort = new int[5];
		sort[0] = a % 10 == 0 ? 10 : a % 10;
		sort[1] = b % 10 == 0 ? 10 : b % 10;
		sort[2] = c % 10 == 0 ? 10 : c % 10;
		sort[3] = d % 10 == 0 ? 10 : d % 10;
		sort[4] = e % 10 == 0 ? 10 : e % 10;
		Arrays.sort(sort);
		int modMin = sort[0];
		int ans = 0;
		boolean done = false;
		for(int i = 0 ; i < 5 ; i++) {
			if(array[i] % 10 == modMin && !done) {
				ans += array[i];
				done = true;
			} else {
				ans += array[i];
				if(array[i] % 10 != 0) {
					ans += (10 - array[i] % 10);
				}
			}
		}

		System.out.println(ans);
		sc.close();

	}

} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		int[] array = new int[5];
		array[0] = a;
		array[1] = b;
		array[2] = c;
		array[3] = d;
		array[4] = e;
		int[] sort = new int[5];
		sort[0] = a % 10 == 0 ? 10 : a % 10;
		sort[1] = b % 10 == 0 ? 10 : b % 10;
		sort[2] = c % 10 == 0 ? 10 : c % 10;
		sort[3] = d % 10 == 0 ? 10 : d % 10;
		sort[4] = e % 10 == 0 ? 10 : e % 10;
		Arrays.sort(sort);
		int modMin = sort[0];
		int ans = 0;
		boolean done = false;
		for(int i = 0 ; i < 5 ; i++) {
			if(array[i] % 10 == modMin && !done) {
				ans += array[i];
				done = true;
			} else {
				ans += array[i];
				if(array[i] % 10 != 0) {
					ans += (10 - array[i] % 10);
				}
			}
		}

		System.out.println(ans);
		sc.close();

	}

}
