import java.util.*;

public class Main {
	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] order = new int[5];
		order[0] = sc.nextInt();
		order[1] = sc.nextInt();
		order[2] = sc.nextInt();
		order[3] = sc.nextInt();
		order[4] = sc.nextInt();
		sc.close();
		int[] time = new int[5];
		for(int i = 0; i < 5; i++) {
			time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0);
		}
		int max = 0;
		int ans = 0;
		for(int i = 0; i < 5; i++) {
			max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max;
			ans += time[i];
		}
		System.out.println(ans - max);
	}
} import java.util.*; util.* java public class Main {
	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] order = new int[5];
		order[0] = sc.nextInt();
		order[1] = sc.nextInt();
		order[2] = sc.nextInt();
		order[3] = sc.nextInt();
		order[4] = sc.nextInt();
		sc.close();
		int[] time = new int[5];
		for(int i = 0; i < 5; i++) {
			time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0);
		}
		int max = 0;
		int ans = 0;
		for(int i = 0; i < 5; i++) {
			max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max;
			ans += time[i];
		}
		System.out.println(ans - max);
	}
} Main public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] order = new int[5];
		order[0] = sc.nextInt();
		order[1] = sc.nextInt();
		order[2] = sc.nextInt();
		order[3] = sc.nextInt();
		order[4] = sc.nextInt();
		sc.close();
		int[] time = new int[5];
		for(int i = 0; i < 5; i++) {
			time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0);
		}
		int max = 0;
		int ans = 0;
		for(int i = 0; i < 5; i++) {
			max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max;
			ans += time[i];
		}
		System.out.println(ans - max);
	} main {
		Scanner sc = new Scanner(System.in);
		int[] order = new int[5];
		order[0] = sc.nextInt();
		order[1] = sc.nextInt();
		order[2] = sc.nextInt();
		order[3] = sc.nextInt();
		order[4] = sc.nextInt();
		sc.close();
		int[] time = new int[5];
		for(int i = 0; i < 5; i++) {
			time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0);
		}
		int max = 0;
		int ans = 0;
		for(int i = 0; i < 5; i++) {
			max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max;
			ans += time[i];
		}
		System.out.println(ans - max);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] order = new int[5]; order new int[5] 5 order[0] = sc.nextInt() order[0] order 0 sc.nextInt() sc.nextInt sc order[1] = sc.nextInt() order[1] order 1 sc.nextInt() sc.nextInt sc order[2] = sc.nextInt() order[2] order 2 sc.nextInt() sc.nextInt sc order[3] = sc.nextInt() order[3] order 3 sc.nextInt() sc.nextInt sc order[4] = sc.nextInt() order[4] order 4 sc.nextInt() sc.nextInt sc sc.close() sc.close sc int[] time = new int[5]; time new int[5] 5 for(int i = 0; i < 5; i++) {
			time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0);
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0);
		} {
			time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0);
		} time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0) time[i] time i (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0) (order[i] / 10) * 10 (order[i] / 10) order[i] order i 10 10 (order[i] % 10 != 0 ? 10 : 0) order[i] % 10 != 0 order[i] % 10 order[i] order i 10 0 10 0 int max = 0; max 0 int ans = 0; ans 0 for(int i = 0; i < 5; i++) {
			max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max;
			ans += time[i];
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max;
			ans += time[i];
		} {
			max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max;
			ans += time[i];
		} max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max max Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max Math.abs(time[i] - order[i]) > max Math.abs(time[i] - order[i]) Math.abs Math time[i] - order[i] time[i] time i order[i] order i max Math.abs(time[i] - order[i]) Math.abs Math time[i] - order[i] time[i] time i order[i] order i max ans += time[i] ans time[i] time i System.out.println(ans - max) System.out.println System.out System System.out ans - max ans max final String[] args args public class Main {
	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] order = new int[5];
		order[0] = sc.nextInt();
		order[1] = sc.nextInt();
		order[2] = sc.nextInt();
		order[3] = sc.nextInt();
		order[4] = sc.nextInt();
		sc.close();
		int[] time = new int[5];
		for(int i = 0; i < 5; i++) {
			time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0);
		}
		int max = 0;
		int ans = 0;
		for(int i = 0; i < 5; i++) {
			max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max;
			ans += time[i];
		}
		System.out.println(ans - max);
	}
} public class Main {
	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] order = new int[5];
		order[0] = sc.nextInt();
		order[1] = sc.nextInt();
		order[2] = sc.nextInt();
		order[3] = sc.nextInt();
		order[4] = sc.nextInt();
		sc.close();
		int[] time = new int[5];
		for(int i = 0; i < 5; i++) {
			time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0);
		}
		int max = 0;
		int ans = 0;
		for(int i = 0; i < 5; i++) {
			max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max;
			ans += time[i];
		}
		System.out.println(ans - max);
	}
} Main
import java.util.*;

public class Main {
	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] order = new int[5];
		order[0] = sc.nextInt();
		order[1] = sc.nextInt();
		order[2] = sc.nextInt();
		order[3] = sc.nextInt();
		order[4] = sc.nextInt();
		sc.close();
		int[] time = new int[5];
		for(int i = 0; i < 5; i++) {
			time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0);
		}
		int max = 0;
		int ans = 0;
		for(int i = 0; i < 5; i++) {
			max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max;
			ans += time[i];
		}
		System.out.println(ans - max);
	}
}
