import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int[] menu = new int[5];

		//入力
		for(int i=0; i<menu.length; i++) {
			menu[i] = sc.nextInt();
		}

		//最後に注文するもの
		int last = 0;
		for(int i=0; i<menu.length; i++) {
			int x = menu[i]%10;
			int y = menu[last]%10;
			if((y==0) || (x!=0 && x<y)) {
				last = i;
			}
		}

		int ans = 0;
		//時刻の計算
		for(int i=0; i<menu.length; i++) {
			if(i!=last) {
				int time = menu[i];
				if(time%10 != 0) {
					time = time - time%10 + 10;
				}
				//System.out.println(time);
				ans += time;
			}
		}
		ans += menu[last];

		System.out.println(ans);

		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int[] menu = new int[5];

		//入力
		for(int i=0; i<menu.length; i++) {
			menu[i] = sc.nextInt();
		}

		//最後に注文するもの
		int last = 0;
		for(int i=0; i<menu.length; i++) {
			int x = menu[i]%10;
			int y = menu[last]%10;
			if((y==0) || (x!=0 && x<y)) {
				last = i;
			}
		}

		int ans = 0;
		//時刻の計算
		for(int i=0; i<menu.length; i++) {
			if(i!=last) {
				int time = menu[i];
				if(time%10 != 0) {
					time = time - time%10 + 10;
				}
				//System.out.println(time);
				ans += time;
			}
		}
		ans += menu[last];

		System.out.println(ans);

		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int[] menu = new int[5];

		//入力
		for(int i=0; i<menu.length; i++) {
			menu[i] = sc.nextInt();
		}

		//最後に注文するもの
		int last = 0;
		for(int i=0; i<menu.length; i++) {
			int x = menu[i]%10;
			int y = menu[last]%10;
			if((y==0) || (x!=0 && x<y)) {
				last = i;
			}
		}

		int ans = 0;
		//時刻の計算
		for(int i=0; i<menu.length; i++) {
			if(i!=last) {
				int time = menu[i];
				if(time%10 != 0) {
					time = time - time%10 + 10;
				}
				//System.out.println(time);
				ans += time;
			}
		}
		ans += menu[last];

		System.out.println(ans);

		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);

		int[] menu = new int[5];

		//入力
		for(int i=0; i<menu.length; i++) {
			menu[i] = sc.nextInt();
		}

		//最後に注文するもの
		int last = 0;
		for(int i=0; i<menu.length; i++) {
			int x = menu[i]%10;
			int y = menu[last]%10;
			if((y==0) || (x!=0 && x<y)) {
				last = i;
			}
		}

		int ans = 0;
		//時刻の計算
		for(int i=0; i<menu.length; i++) {
			if(i!=last) {
				int time = menu[i];
				if(time%10 != 0) {
					time = time - time%10 + 10;
				}
				//System.out.println(time);
				ans += time;
			}
		}
		ans += menu[last];

		System.out.println(ans);

		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] menu = new int[5]; menu new int[5] 5 for(int i=0; i<menu.length; i++) {
			menu[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<menu.length i menu.length menu menu.length i++ i++ i {
			menu[i] = sc.nextInt();
		} {
			menu[i] = sc.nextInt();
		} menu[i] = sc.nextInt() menu[i] menu i sc.nextInt() sc.nextInt sc int last = 0; last 0 for(int i=0; i<menu.length; i++) {
			int x = menu[i]%10;
			int y = menu[last]%10;
			if((y==0) || (x!=0 && x<y)) {
				last = i;
			}
		} int i=0; int i=0; i 0 i<menu.length i menu.length menu menu.length i++ i++ i {
			int x = menu[i]%10;
			int y = menu[last]%10;
			if((y==0) || (x!=0 && x<y)) {
				last = i;
			}
		} {
			int x = menu[i]%10;
			int y = menu[last]%10;
			if((y==0) || (x!=0 && x<y)) {
				last = i;
			}
		} int x = menu[i]%10; x menu[i]%10 menu[i] menu i 10 int y = menu[last]%10; y menu[last]%10 menu[last] menu last 10 if((y==0) || (x!=0 && x<y)) {
				last = i;
			} (y==0) || (x!=0 && x<y) (y==0) y 0 (x!=0 && x<y) x!=0 x 0 x<y x y {
				last = i;
			} last = i last i int ans = 0; ans 0 for(int i=0; i<menu.length; i++) {
			if(i!=last) {
				int time = menu[i];
				if(time%10 != 0) {
					time = time - time%10 + 10;
				}
				//System.out.println(time);
				ans += time;
			}
		} int i=0; int i=0; i 0 i<menu.length i menu.length menu menu.length i++ i++ i {
			if(i!=last) {
				int time = menu[i];
				if(time%10 != 0) {
					time = time - time%10 + 10;
				}
				//System.out.println(time);
				ans += time;
			}
		} {
			if(i!=last) {
				int time = menu[i];
				if(time%10 != 0) {
					time = time - time%10 + 10;
				}
				//System.out.println(time);
				ans += time;
			}
		} if(i!=last) {
				int time = menu[i];
				if(time%10 != 0) {
					time = time - time%10 + 10;
				}
				//System.out.println(time);
				ans += time;
			} i!=last i last {
				int time = menu[i];
				if(time%10 != 0) {
					time = time - time%10 + 10;
				}
				//System.out.println(time);
				ans += time;
			} int time = menu[i]; time menu[i] menu i if(time%10 != 0) {
					time = time - time%10 + 10;
				} time%10 != 0 time%10 time 10 0 {
					time = time - time%10 + 10;
				} time = time - time%10 + 10 time time - time%10 + 10 time - time%10 time time%10 time 10 10 ans += time ans time ans += menu[last] ans menu[last] menu last 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[] menu = new int[5];

		//入力
		for(int i=0; i<menu.length; i++) {
			menu[i] = sc.nextInt();
		}

		//最後に注文するもの
		int last = 0;
		for(int i=0; i<menu.length; i++) {
			int x = menu[i]%10;
			int y = menu[last]%10;
			if((y==0) || (x!=0 && x<y)) {
				last = i;
			}
		}

		int ans = 0;
		//時刻の計算
		for(int i=0; i<menu.length; i++) {
			if(i!=last) {
				int time = menu[i];
				if(time%10 != 0) {
					time = time - time%10 + 10;
				}
				//System.out.println(time);
				ans += time;
			}
		}
		ans += menu[last];

		System.out.println(ans);

		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int[] menu = new int[5];

		//入力
		for(int i=0; i<menu.length; i++) {
			menu[i] = sc.nextInt();
		}

		//最後に注文するもの
		int last = 0;
		for(int i=0; i<menu.length; i++) {
			int x = menu[i]%10;
			int y = menu[last]%10;
			if((y==0) || (x!=0 && x<y)) {
				last = i;
			}
		}

		int ans = 0;
		//時刻の計算
		for(int i=0; i<menu.length; i++) {
			if(i!=last) {
				int time = menu[i];
				if(time%10 != 0) {
					time = time - time%10 + 10;
				}
				//System.out.println(time);
				ans += time;
			}
		}
		ans += menu[last];

		System.out.println(ans);

		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int[] menu = new int[5];

		//入力
		for(int i=0; i<menu.length; i++) {
			menu[i] = sc.nextInt();
		}

		//最後に注文するもの
		int last = 0;
		for(int i=0; i<menu.length; i++) {
			int x = menu[i]%10;
			int y = menu[last]%10;
			if((y==0) || (x!=0 && x<y)) {
				last = i;
			}
		}

		int ans = 0;
		//時刻の計算
		for(int i=0; i<menu.length; i++) {
			if(i!=last) {
				int time = menu[i];
				if(time%10 != 0) {
					time = time - time%10 + 10;
				}
				//System.out.println(time);
				ans += time;
			}
		}
		ans += menu[last];

		System.out.println(ans);

		sc.close();
	}
}