import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[5];
		int r[] = new int[5];
		TreeMap<Integer, Integer> map = new TreeMap();

		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
			r[i] = a[i]%10;
			int b =10;
			if (r[i] != 0) {
				b = 10-r[i];
				map.put(b, a[i]);
			}
		}
		int ans = 0;

		if (map.size() == 0) {
			for (int i = 0; i < a.length; i++) {
				ans += a[i];
			}
			System.out.println(ans);
			return;
		}

		int last = map.get(map.lastKey());
		int idx = 0;
		for (int i = 0; i < a.length; i++) {
			if(a[i] == last) {
				idx = i;
			}
		}




		for (int i = 0; i < a.length; i++) {
			if (i != idx) {
				if (a[i]%10 == 0) {
					ans += a[i];
				} else {
					ans += a[i]+ (10- r[i]);
				}
			}
		}
		ans += last;

		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util import java.util.TreeMap; TreeMap java.util public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[5];
		int r[] = new int[5];
		TreeMap<Integer, Integer> map = new TreeMap();

		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
			r[i] = a[i]%10;
			int b =10;
			if (r[i] != 0) {
				b = 10-r[i];
				map.put(b, a[i]);
			}
		}
		int ans = 0;

		if (map.size() == 0) {
			for (int i = 0; i < a.length; i++) {
				ans += a[i];
			}
			System.out.println(ans);
			return;
		}

		int last = map.get(map.lastKey());
		int idx = 0;
		for (int i = 0; i < a.length; i++) {
			if(a[i] == last) {
				idx = i;
			}
		}




		for (int i = 0; i < a.length; i++) {
			if (i != idx) {
				if (a[i]%10 == 0) {
					ans += a[i];
				} else {
					ans += a[i]+ (10- r[i]);
				}
			}
		}
		ans += last;

		System.out.println(ans);
	}
} Main public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[5];
		int r[] = new int[5];
		TreeMap<Integer, Integer> map = new TreeMap();

		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
			r[i] = a[i]%10;
			int b =10;
			if (r[i] != 0) {
				b = 10-r[i];
				map.put(b, a[i]);
			}
		}
		int ans = 0;

		if (map.size() == 0) {
			for (int i = 0; i < a.length; i++) {
				ans += a[i];
			}
			System.out.println(ans);
			return;
		}

		int last = map.get(map.lastKey());
		int idx = 0;
		for (int i = 0; i < a.length; i++) {
			if(a[i] == last) {
				idx = i;
			}
		}




		for (int i = 0; i < a.length; i++) {
			if (i != idx) {
				if (a[i]%10 == 0) {
					ans += a[i];
				} else {
					ans += a[i]+ (10- r[i]);
				}
			}
		}
		ans += last;

		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[5];
		int r[] = new int[5];
		TreeMap<Integer, Integer> map = new TreeMap();

		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
			r[i] = a[i]%10;
			int b =10;
			if (r[i] != 0) {
				b = 10-r[i];
				map.put(b, a[i]);
			}
		}
		int ans = 0;

		if (map.size() == 0) {
			for (int i = 0; i < a.length; i++) {
				ans += a[i];
			}
			System.out.println(ans);
			return;
		}

		int last = map.get(map.lastKey());
		int idx = 0;
		for (int i = 0; i < a.length; i++) {
			if(a[i] == last) {
				idx = i;
			}
		}




		for (int i = 0; i < a.length; i++) {
			if (i != idx) {
				if (a[i]%10 == 0) {
					ans += a[i];
				} else {
					ans += a[i]+ (10- r[i]);
				}
			}
		}
		ans += last;

		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a[] = new int[5]; a new int[5] 5 int r[] = new int[5]; r new int[5] 5 TreeMap<Integer, Integer> map = new TreeMap(); map new TreeMap() for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
			r[i] = a[i]%10;
			int b =10;
			if (r[i] != 0) {
				b = 10-r[i];
				map.put(b, a[i]);
			}
		} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
			a[i] = sc.nextInt();
			r[i] = a[i]%10;
			int b =10;
			if (r[i] != 0) {
				b = 10-r[i];
				map.put(b, a[i]);
			}
		} {
			a[i] = sc.nextInt();
			r[i] = a[i]%10;
			int b =10;
			if (r[i] != 0) {
				b = 10-r[i];
				map.put(b, a[i]);
			}
		} a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc r[i] = a[i]%10 r[i] r i a[i]%10 a[i] a i 10 int b =10; b 10 if (r[i] != 0) {
				b = 10-r[i];
				map.put(b, a[i]);
			} r[i] != 0 r[i] r i 0 {
				b = 10-r[i];
				map.put(b, a[i]);
			} b = 10-r[i] b 10-r[i] 10 r[i] r i map.put(b, a[i]) map.put map b a[i] a i int ans = 0; ans 0 if (map.size() == 0) {
			for (int i = 0; i < a.length; i++) {
				ans += a[i];
			}
			System.out.println(ans);
			return;
		} map.size() == 0 map.size() map.size map 0 {
			for (int i = 0; i < a.length; i++) {
				ans += a[i];
			}
			System.out.println(ans);
			return;
		} for (int i = 0; i < a.length; i++) {
				ans += a[i];
			} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
				ans += a[i];
			} {
				ans += a[i];
			} ans += a[i] ans a[i] a i System.out.println(ans) System.out.println System.out System System.out ans return; int last = map.get(map.lastKey()); last map.get(map.lastKey()) map.get map map.lastKey() map.lastKey map int idx = 0; idx 0 for (int i = 0; i < a.length; i++) {
			if(a[i] == last) {
				idx = i;
			}
		} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
			if(a[i] == last) {
				idx = i;
			}
		} {
			if(a[i] == last) {
				idx = i;
			}
		} if(a[i] == last) {
				idx = i;
			} a[i] == last a[i] a i last {
				idx = i;
			} idx = i idx i for (int i = 0; i < a.length; i++) {
			if (i != idx) {
				if (a[i]%10 == 0) {
					ans += a[i];
				} else {
					ans += a[i]+ (10- r[i]);
				}
			}
		} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
			if (i != idx) {
				if (a[i]%10 == 0) {
					ans += a[i];
				} else {
					ans += a[i]+ (10- r[i]);
				}
			}
		} {
			if (i != idx) {
				if (a[i]%10 == 0) {
					ans += a[i];
				} else {
					ans += a[i]+ (10- r[i]);
				}
			}
		} if (i != idx) {
				if (a[i]%10 == 0) {
					ans += a[i];
				} else {
					ans += a[i]+ (10- r[i]);
				}
			} i != idx i idx {
				if (a[i]%10 == 0) {
					ans += a[i];
				} else {
					ans += a[i]+ (10- r[i]);
				}
			} if (a[i]%10 == 0) {
					ans += a[i];
				} else {
					ans += a[i]+ (10- r[i]);
				} a[i]%10 == 0 a[i]%10 a[i] a i 10 0 {
					ans += a[i];
				} ans += a[i] ans a[i] a i {
					ans += a[i]+ (10- r[i]);
				} ans += a[i]+ (10- r[i]) ans a[i]+ (10- r[i]) a[i] a i (10- r[i]) 10 r[i] r i ans += last ans last System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[5];
		int r[] = new int[5];
		TreeMap<Integer, Integer> map = new TreeMap();

		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
			r[i] = a[i]%10;
			int b =10;
			if (r[i] != 0) {
				b = 10-r[i];
				map.put(b, a[i]);
			}
		}
		int ans = 0;

		if (map.size() == 0) {
			for (int i = 0; i < a.length; i++) {
				ans += a[i];
			}
			System.out.println(ans);
			return;
		}

		int last = map.get(map.lastKey());
		int idx = 0;
		for (int i = 0; i < a.length; i++) {
			if(a[i] == last) {
				idx = i;
			}
		}




		for (int i = 0; i < a.length; i++) {
			if (i != idx) {
				if (a[i]%10 == 0) {
					ans += a[i];
				} else {
					ans += a[i]+ (10- r[i]);
				}
			}
		}
		ans += last;

		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[5];
		int r[] = new int[5];
		TreeMap<Integer, Integer> map = new TreeMap();

		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
			r[i] = a[i]%10;
			int b =10;
			if (r[i] != 0) {
				b = 10-r[i];
				map.put(b, a[i]);
			}
		}
		int ans = 0;

		if (map.size() == 0) {
			for (int i = 0; i < a.length; i++) {
				ans += a[i];
			}
			System.out.println(ans);
			return;
		}

		int last = map.get(map.lastKey());
		int idx = 0;
		for (int i = 0; i < a.length; i++) {
			if(a[i] == last) {
				idx = i;
			}
		}




		for (int i = 0; i < a.length; i++) {
			if (i != idx) {
				if (a[i]%10 == 0) {
					ans += a[i];
				} else {
					ans += a[i]+ (10- r[i]);
				}
			}
		}
		ans += last;

		System.out.println(ans);
	}
} Main
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[5];
		int r[] = new int[5];
		TreeMap<Integer, Integer> map = new TreeMap();

		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
			r[i] = a[i]%10;
			int b =10;
			if (r[i] != 0) {
				b = 10-r[i];
				map.put(b, a[i]);
			}
		}
		int ans = 0;

		if (map.size() == 0) {
			for (int i = 0; i < a.length; i++) {
				ans += a[i];
			}
			System.out.println(ans);
			return;
		}

		int last = map.get(map.lastKey());
		int idx = 0;
		for (int i = 0; i < a.length; i++) {
			if(a[i] == last) {
				idx = i;
			}
		}




		for (int i = 0; i < a.length; i++) {
			if (i != idx) {
				if (a[i]%10 == 0) {
					ans += a[i];
				} else {
					ans += a[i]+ (10- r[i]);
				}
			}
		}
		ans += last;

		System.out.println(ans);
	}
}
