import java.util.*;
public class Main {
	
		static void solve() {
			Scanner sc = new Scanner(System.in);
			int array[] = new int[5];
			int plus = 0;
			int max = 0;
			for(int  i = 0;i<array.length;i++) {
				array[i] = sc.nextInt();
				if(array[i]%10!=0) {
					plus =10 - array[i]%10;
					array[i]+=plus;
					max = Math.max(max, plus);
				}
			}
			System.out.println(array[0]+array[1]+array[2]+array[3]+array[4]-max);
			sc.close();
	}
	public static void main(String[] args) {
		solve();
	}

} import java.util.*; util.* java public class Main {
	
		static void solve() {
			Scanner sc = new Scanner(System.in);
			int array[] = new int[5];
			int plus = 0;
			int max = 0;
			for(int  i = 0;i<array.length;i++) {
				array[i] = sc.nextInt();
				if(array[i]%10!=0) {
					plus =10 - array[i]%10;
					array[i]+=plus;
					max = Math.max(max, plus);
				}
			}
			System.out.println(array[0]+array[1]+array[2]+array[3]+array[4]-max);
			sc.close();
	}
	public static void main(String[] args) {
		solve();
	}

} Main static void solve() {
			Scanner sc = new Scanner(System.in);
			int array[] = new int[5];
			int plus = 0;
			int max = 0;
			for(int  i = 0;i<array.length;i++) {
				array[i] = sc.nextInt();
				if(array[i]%10!=0) {
					plus =10 - array[i]%10;
					array[i]+=plus;
					max = Math.max(max, plus);
				}
			}
			System.out.println(array[0]+array[1]+array[2]+array[3]+array[4]-max);
			sc.close();
	} solve {
			Scanner sc = new Scanner(System.in);
			int array[] = new int[5];
			int plus = 0;
			int max = 0;
			for(int  i = 0;i<array.length;i++) {
				array[i] = sc.nextInt();
				if(array[i]%10!=0) {
					plus =10 - array[i]%10;
					array[i]+=plus;
					max = Math.max(max, plus);
				}
			}
			System.out.println(array[0]+array[1]+array[2]+array[3]+array[4]-max);
			sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int array[] = new int[5]; array new int[5] 5 int plus = 0; plus 0 int max = 0; max 0 for(int  i = 0;i<array.length;i++) {
				array[i] = sc.nextInt();
				if(array[i]%10!=0) {
					plus =10 - array[i]%10;
					array[i]+=plus;
					max = Math.max(max, plus);
				}
			} int  i = 0; int  i = 0; i 0 i<array.length i array.length array array.length i++ i++ i {
				array[i] = sc.nextInt();
				if(array[i]%10!=0) {
					plus =10 - array[i]%10;
					array[i]+=plus;
					max = Math.max(max, plus);
				}
			} {
				array[i] = sc.nextInt();
				if(array[i]%10!=0) {
					plus =10 - array[i]%10;
					array[i]+=plus;
					max = Math.max(max, plus);
				}
			} array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc if(array[i]%10!=0) {
					plus =10 - array[i]%10;
					array[i]+=plus;
					max = Math.max(max, plus);
				} array[i]%10!=0 array[i]%10 array[i] array i 10 0 {
					plus =10 - array[i]%10;
					array[i]+=plus;
					max = Math.max(max, plus);
				} plus =10 - array[i]%10 plus 10 - array[i]%10 10 array[i]%10 array[i] array i 10 array[i]+=plus array[i] array i plus max = Math.max(max, plus) max Math.max(max, plus) Math.max Math max plus System.out.println(array[0]+array[1]+array[2]+array[3]+array[4]-max) System.out.println System.out System System.out array[0]+array[1]+array[2]+array[3]+array[4]-max array[0]+array[1]+array[2]+array[3]+array[4] array[3] array[2] array[0]+array[1]+array[2]+array[3]+array[4] array[0] array 0 array[1] array 1 array[2] array 2 array[3] array 3 array[4] array 4 max sc.close() sc.close sc public static void main(String[] args) {
		solve();
	} main {
		solve();
	} solve() solve String[] args args public class Main {
	
		static void solve() {
			Scanner sc = new Scanner(System.in);
			int array[] = new int[5];
			int plus = 0;
			int max = 0;
			for(int  i = 0;i<array.length;i++) {
				array[i] = sc.nextInt();
				if(array[i]%10!=0) {
					plus =10 - array[i]%10;
					array[i]+=plus;
					max = Math.max(max, plus);
				}
			}
			System.out.println(array[0]+array[1]+array[2]+array[3]+array[4]-max);
			sc.close();
	}
	public static void main(String[] args) {
		solve();
	}

} public class Main {
	
		static void solve() {
			Scanner sc = new Scanner(System.in);
			int array[] = new int[5];
			int plus = 0;
			int max = 0;
			for(int  i = 0;i<array.length;i++) {
				array[i] = sc.nextInt();
				if(array[i]%10!=0) {
					plus =10 - array[i]%10;
					array[i]+=plus;
					max = Math.max(max, plus);
				}
			}
			System.out.println(array[0]+array[1]+array[2]+array[3]+array[4]-max);
			sc.close();
	}
	public static void main(String[] args) {
		solve();
	}

} Main
import java.util.*;
public class Main {
	
		static void solve() {
			Scanner sc = new Scanner(System.in);
			int array[] = new int[5];
			int plus = 0;
			int max = 0;
			for(int  i = 0;i<array.length;i++) {
				array[i] = sc.nextInt();
				if(array[i]%10!=0) {
					plus =10 - array[i]%10;
					array[i]+=plus;
					max = Math.max(max, plus);
				}
			}
			System.out.println(array[0]+array[1]+array[2]+array[3]+array[4]-max);
			sc.close();
	}
	public static void main(String[] args) {
		solve();
	}

}
