import java.util.*;
import java.lang.*;

public class Main {
	static int[] dish;
	static boolean[] used;
	static int min;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		dish = new int[5];
		for (int i = 0; i < 5; i++) {
			dish[i] = sc.nextInt();
		}
		used = new boolean[5];
		min = 100000000;
		dfs(0, 0);
		System.out.println(min);
	}
	static void dfs(int count, double time) {
		if (count == 5) {
			min = Math.min(min, (int) time);
			return;
		}
		for (int i = 0; i < 5; i++) {
			if (!used[i]) {
				used[i] = true;
				dfs(count + 1, Math.ceil(time / 10) * 10 + dish[i]);
				used[i] = false;
			}
		}
	}
} import java.util.*; util.* java import java.lang.*; lang.* java public class Main {
	static int[] dish;
	static boolean[] used;
	static int min;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		dish = new int[5];
		for (int i = 0; i < 5; i++) {
			dish[i] = sc.nextInt();
		}
		used = new boolean[5];
		min = 100000000;
		dfs(0, 0);
		System.out.println(min);
	}
	static void dfs(int count, double time) {
		if (count == 5) {
			min = Math.min(min, (int) time);
			return;
		}
		for (int i = 0; i < 5; i++) {
			if (!used[i]) {
				used[i] = true;
				dfs(count + 1, Math.ceil(time / 10) * 10 + dish[i]);
				used[i] = false;
			}
		}
	}
} Main static int[] dish; dish static boolean[] used; used static int min; min public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		dish = new int[5];
		for (int i = 0; i < 5; i++) {
			dish[i] = sc.nextInt();
		}
		used = new boolean[5];
		min = 100000000;
		dfs(0, 0);
		System.out.println(min);
	} main {
		Scanner sc = new Scanner(System.in);
		dish = new int[5];
		for (int i = 0; i < 5; i++) {
			dish[i] = sc.nextInt();
		}
		used = new boolean[5];
		min = 100000000;
		dfs(0, 0);
		System.out.println(min);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) dish = new int[5] dish new int[5] 5 for (int i = 0; i < 5; i++) {
			dish[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			dish[i] = sc.nextInt();
		} {
			dish[i] = sc.nextInt();
		} dish[i] = sc.nextInt() dish[i] dish i sc.nextInt() sc.nextInt sc used = new boolean[5] used new boolean[5] 5 min = 100000000 min 100000000 dfs(0, 0) dfs 0 0 System.out.println(min) System.out.println System.out System System.out min String[] args args static void dfs(int count, double time) {
		if (count == 5) {
			min = Math.min(min, (int) time);
			return;
		}
		for (int i = 0; i < 5; i++) {
			if (!used[i]) {
				used[i] = true;
				dfs(count + 1, Math.ceil(time / 10) * 10 + dish[i]);
				used[i] = false;
			}
		}
	} dfs {
		if (count == 5) {
			min = Math.min(min, (int) time);
			return;
		}
		for (int i = 0; i < 5; i++) {
			if (!used[i]) {
				used[i] = true;
				dfs(count + 1, Math.ceil(time / 10) * 10 + dish[i]);
				used[i] = false;
			}
		}
	} if (count == 5) {
			min = Math.min(min, (int) time);
			return;
		} count == 5 count 5 {
			min = Math.min(min, (int) time);
			return;
		} min = Math.min(min, (int) time) min Math.min(min, (int) time) Math.min Math min (int) time return; for (int i = 0; i < 5; i++) {
			if (!used[i]) {
				used[i] = true;
				dfs(count + 1, Math.ceil(time / 10) * 10 + dish[i]);
				used[i] = false;
			}
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			if (!used[i]) {
				used[i] = true;
				dfs(count + 1, Math.ceil(time / 10) * 10 + dish[i]);
				used[i] = false;
			}
		} {
			if (!used[i]) {
				used[i] = true;
				dfs(count + 1, Math.ceil(time / 10) * 10 + dish[i]);
				used[i] = false;
			}
		} if (!used[i]) {
				used[i] = true;
				dfs(count + 1, Math.ceil(time / 10) * 10 + dish[i]);
				used[i] = false;
			} !used[i] used[i] used i {
				used[i] = true;
				dfs(count + 1, Math.ceil(time / 10) * 10 + dish[i]);
				used[i] = false;
			} used[i] = true used[i] used i true dfs(count + 1, Math.ceil(time / 10) * 10 + dish[i]) dfs count + 1 count 1 Math.ceil(time / 10) * 10 + dish[i] Math.ceil(time / 10) * 10 Math.ceil(time / 10) Math.ceil Math time / 10 time 10 10 dish[i] dish i used[i] = false used[i] used i false int count count double time time public class Main {
	static int[] dish;
	static boolean[] used;
	static int min;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		dish = new int[5];
		for (int i = 0; i < 5; i++) {
			dish[i] = sc.nextInt();
		}
		used = new boolean[5];
		min = 100000000;
		dfs(0, 0);
		System.out.println(min);
	}
	static void dfs(int count, double time) {
		if (count == 5) {
			min = Math.min(min, (int) time);
			return;
		}
		for (int i = 0; i < 5; i++) {
			if (!used[i]) {
				used[i] = true;
				dfs(count + 1, Math.ceil(time / 10) * 10 + dish[i]);
				used[i] = false;
			}
		}
	}
} public class Main {
	static int[] dish;
	static boolean[] used;
	static int min;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		dish = new int[5];
		for (int i = 0; i < 5; i++) {
			dish[i] = sc.nextInt();
		}
		used = new boolean[5];
		min = 100000000;
		dfs(0, 0);
		System.out.println(min);
	}
	static void dfs(int count, double time) {
		if (count == 5) {
			min = Math.min(min, (int) time);
			return;
		}
		for (int i = 0; i < 5; i++) {
			if (!used[i]) {
				used[i] = true;
				dfs(count + 1, Math.ceil(time / 10) * 10 + dish[i]);
				used[i] = false;
			}
		}
	}
} Main
import java.util.*;
import java.lang.*;

public class Main {
	static int[] dish;
	static boolean[] used;
	static int min;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		dish = new int[5];
		for (int i = 0; i < 5; i++) {
			dish[i] = sc.nextInt();
		}
		used = new boolean[5];
		min = 100000000;
		dfs(0, 0);
		System.out.println(min);
	}
	static void dfs(int count, double time) {
		if (count == 5) {
			min = Math.min(min, (int) time);
			return;
		}
		for (int i = 0; i < 5; i++) {
			if (!used[i]) {
				used[i] = true;
				dfs(count + 1, Math.ceil(time / 10) * 10 + dish[i]);
				used[i] = false;
			}
		}
	}
}