import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int [] ryouri = new int[5];
		ryouri[0] = stdIn.nextInt();
		ryouri[1] = stdIn.nextInt();
		ryouri[2] = stdIn.nextInt();
		ryouri[3] = stdIn.nextInt();
		ryouri[4] = stdIn.nextInt();
		
		int [] time = new int[5];
		int cnt = 0;		
			
				for(int k = 1; k <=9; k++) {
					for(int j = 0; j <= 4; j++) {
					if(ryouri[j] % 10 == k) {
						time[cnt++] = ryouri[j];
					}
				}
			}
				for(int i = 0; i < time.length; i++) {
					if(ryouri[i] % 10 == 0) {
						time[cnt++] = ryouri[i];
					}
				}
		
		int ans = 0;
		for(int i = 4; i >= 0; i--) {
			if(i ==0) {
				ans += time[0];
				break;
			}
			while(true) {
				if(time[i]%10==0) {
					break;
				}
				time[i]++;
			}
			
			ans += time[i];
			
			
		}
			
		
		System.out.println(ans);
		
		
		
		
		
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int [] ryouri = new int[5];
		ryouri[0] = stdIn.nextInt();
		ryouri[1] = stdIn.nextInt();
		ryouri[2] = stdIn.nextInt();
		ryouri[3] = stdIn.nextInt();
		ryouri[4] = stdIn.nextInt();
		
		int [] time = new int[5];
		int cnt = 0;		
			
				for(int k = 1; k <=9; k++) {
					for(int j = 0; j <= 4; j++) {
					if(ryouri[j] % 10 == k) {
						time[cnt++] = ryouri[j];
					}
				}
			}
				for(int i = 0; i < time.length; i++) {
					if(ryouri[i] % 10 == 0) {
						time[cnt++] = ryouri[i];
					}
				}
		
		int ans = 0;
		for(int i = 4; i >= 0; i--) {
			if(i ==0) {
				ans += time[0];
				break;
			}
			while(true) {
				if(time[i]%10==0) {
					break;
				}
				time[i]++;
			}
			
			ans += time[i];
			
			
		}
			
		
		System.out.println(ans);
		
		
		
		
		
	}

} Main public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int [] ryouri = new int[5];
		ryouri[0] = stdIn.nextInt();
		ryouri[1] = stdIn.nextInt();
		ryouri[2] = stdIn.nextInt();
		ryouri[3] = stdIn.nextInt();
		ryouri[4] = stdIn.nextInt();
		
		int [] time = new int[5];
		int cnt = 0;		
			
				for(int k = 1; k <=9; k++) {
					for(int j = 0; j <= 4; j++) {
					if(ryouri[j] % 10 == k) {
						time[cnt++] = ryouri[j];
					}
				}
			}
				for(int i = 0; i < time.length; i++) {
					if(ryouri[i] % 10 == 0) {
						time[cnt++] = ryouri[i];
					}
				}
		
		int ans = 0;
		for(int i = 4; i >= 0; i--) {
			if(i ==0) {
				ans += time[0];
				break;
			}
			while(true) {
				if(time[i]%10==0) {
					break;
				}
				time[i]++;
			}
			
			ans += time[i];
			
			
		}
			
		
		System.out.println(ans);
		
		
		
		
		
	} main {
		Scanner stdIn = new Scanner(System.in);
		int [] ryouri = new int[5];
		ryouri[0] = stdIn.nextInt();
		ryouri[1] = stdIn.nextInt();
		ryouri[2] = stdIn.nextInt();
		ryouri[3] = stdIn.nextInt();
		ryouri[4] = stdIn.nextInt();
		
		int [] time = new int[5];
		int cnt = 0;		
			
				for(int k = 1; k <=9; k++) {
					for(int j = 0; j <= 4; j++) {
					if(ryouri[j] % 10 == k) {
						time[cnt++] = ryouri[j];
					}
				}
			}
				for(int i = 0; i < time.length; i++) {
					if(ryouri[i] % 10 == 0) {
						time[cnt++] = ryouri[i];
					}
				}
		
		int ans = 0;
		for(int i = 4; i >= 0; i--) {
			if(i ==0) {
				ans += time[0];
				break;
			}
			while(true) {
				if(time[i]%10==0) {
					break;
				}
				time[i]++;
			}
			
			ans += time[i];
			
			
		}
			
		
		System.out.println(ans);
		
		
		
		
		
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int [] ryouri = new int[5]; ryouri new int[5] 5 ryouri[0] = stdIn.nextInt() ryouri[0] ryouri 0 stdIn.nextInt() stdIn.nextInt stdIn ryouri[1] = stdIn.nextInt() ryouri[1] ryouri 1 stdIn.nextInt() stdIn.nextInt stdIn ryouri[2] = stdIn.nextInt() ryouri[2] ryouri 2 stdIn.nextInt() stdIn.nextInt stdIn ryouri[3] = stdIn.nextInt() ryouri[3] ryouri 3 stdIn.nextInt() stdIn.nextInt stdIn ryouri[4] = stdIn.nextInt() ryouri[4] ryouri 4 stdIn.nextInt() stdIn.nextInt stdIn int [] time = new int[5]; time new int[5] 5 int cnt = 0; cnt 0 for(int k = 1; k <=9; k++) {
					for(int j = 0; j <= 4; j++) {
					if(ryouri[j] % 10 == k) {
						time[cnt++] = ryouri[j];
					}
				}
			} int k = 1; int k = 1; k 1 k <=9 k 9 k++ k++ k {
					for(int j = 0; j <= 4; j++) {
					if(ryouri[j] % 10 == k) {
						time[cnt++] = ryouri[j];
					}
				}
			} {
					for(int j = 0; j <= 4; j++) {
					if(ryouri[j] % 10 == k) {
						time[cnt++] = ryouri[j];
					}
				}
			} for(int j = 0; j <= 4; j++) {
					if(ryouri[j] % 10 == k) {
						time[cnt++] = ryouri[j];
					}
				} int j = 0; int j = 0; j 0 j <= 4 j 4 j++ j++ j {
					if(ryouri[j] % 10 == k) {
						time[cnt++] = ryouri[j];
					}
				} {
					if(ryouri[j] % 10 == k) {
						time[cnt++] = ryouri[j];
					}
				} if(ryouri[j] % 10 == k) {
						time[cnt++] = ryouri[j];
					} ryouri[j] % 10 == k ryouri[j] % 10 ryouri[j] ryouri j 10 k {
						time[cnt++] = ryouri[j];
					} time[cnt++] = ryouri[j] time[cnt++] time cnt++ cnt ryouri[j] ryouri j for(int i = 0; i < time.length; i++) {
					if(ryouri[i] % 10 == 0) {
						time[cnt++] = ryouri[i];
					}
				} int i = 0; int i = 0; i 0 i < time.length i time.length time time.length i++ i++ i {
					if(ryouri[i] % 10 == 0) {
						time[cnt++] = ryouri[i];
					}
				} {
					if(ryouri[i] % 10 == 0) {
						time[cnt++] = ryouri[i];
					}
				} if(ryouri[i] % 10 == 0) {
						time[cnt++] = ryouri[i];
					} ryouri[i] % 10 == 0 ryouri[i] % 10 ryouri[i] ryouri i 10 0 {
						time[cnt++] = ryouri[i];
					} time[cnt++] = ryouri[i] time[cnt++] time cnt++ cnt ryouri[i] ryouri i int ans = 0; ans 0 for(int i = 4; i >= 0; i--) {
			if(i ==0) {
				ans += time[0];
				break;
			}
			while(true) {
				if(time[i]%10==0) {
					break;
				}
				time[i]++;
			}
			
			ans += time[i];
			
			
		} int i = 4; int i = 4; i 4 i >= 0 i 0 i-- i-- i {
			if(i ==0) {
				ans += time[0];
				break;
			}
			while(true) {
				if(time[i]%10==0) {
					break;
				}
				time[i]++;
			}
			
			ans += time[i];
			
			
		} {
			if(i ==0) {
				ans += time[0];
				break;
			}
			while(true) {
				if(time[i]%10==0) {
					break;
				}
				time[i]++;
			}
			
			ans += time[i];
			
			
		} if(i ==0) {
				ans += time[0];
				break;
			} i ==0 i 0 {
				ans += time[0];
				break;
			} ans += time[0] ans time[0] time 0 break; while(true) {
				if(time[i]%10==0) {
					break;
				}
				time[i]++;
			} true {
				if(time[i]%10==0) {
					break;
				}
				time[i]++;
			} if(time[i]%10==0) {
					break;
				} time[i]%10==0 time[i]%10 time[i] time i 10 0 {
					break;
				} break; time[i]++ time[i] time i ans += time[i] ans time[i] time i 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) {
		Scanner stdIn = new Scanner(System.in);
		int [] ryouri = new int[5];
		ryouri[0] = stdIn.nextInt();
		ryouri[1] = stdIn.nextInt();
		ryouri[2] = stdIn.nextInt();
		ryouri[3] = stdIn.nextInt();
		ryouri[4] = stdIn.nextInt();
		
		int [] time = new int[5];
		int cnt = 0;		
			
				for(int k = 1; k <=9; k++) {
					for(int j = 0; j <= 4; j++) {
					if(ryouri[j] % 10 == k) {
						time[cnt++] = ryouri[j];
					}
				}
			}
				for(int i = 0; i < time.length; i++) {
					if(ryouri[i] % 10 == 0) {
						time[cnt++] = ryouri[i];
					}
				}
		
		int ans = 0;
		for(int i = 4; i >= 0; i--) {
			if(i ==0) {
				ans += time[0];
				break;
			}
			while(true) {
				if(time[i]%10==0) {
					break;
				}
				time[i]++;
			}
			
			ans += time[i];
			
			
		}
			
		
		System.out.println(ans);
		
		
		
		
		
	}

} public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int [] ryouri = new int[5];
		ryouri[0] = stdIn.nextInt();
		ryouri[1] = stdIn.nextInt();
		ryouri[2] = stdIn.nextInt();
		ryouri[3] = stdIn.nextInt();
		ryouri[4] = stdIn.nextInt();
		
		int [] time = new int[5];
		int cnt = 0;		
			
				for(int k = 1; k <=9; k++) {
					for(int j = 0; j <= 4; j++) {
					if(ryouri[j] % 10 == k) {
						time[cnt++] = ryouri[j];
					}
				}
			}
				for(int i = 0; i < time.length; i++) {
					if(ryouri[i] % 10 == 0) {
						time[cnt++] = ryouri[i];
					}
				}
		
		int ans = 0;
		for(int i = 4; i >= 0; i--) {
			if(i ==0) {
				ans += time[0];
				break;
			}
			while(true) {
				if(time[i]%10==0) {
					break;
				}
				time[i]++;
			}
			
			ans += time[i];
			
			
		}
			
		
		System.out.println(ans);
		
		
		
		
		
	}

} Main
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int [] ryouri = new int[5];
		ryouri[0] = stdIn.nextInt();
		ryouri[1] = stdIn.nextInt();
		ryouri[2] = stdIn.nextInt();
		ryouri[3] = stdIn.nextInt();
		ryouri[4] = stdIn.nextInt();
		
		int [] time = new int[5];
		int cnt = 0;		
			
				for(int k = 1; k <=9; k++) {
					for(int j = 0; j <= 4; j++) {
					if(ryouri[j] % 10 == k) {
						time[cnt++] = ryouri[j];
					}
				}
			}
				for(int i = 0; i < time.length; i++) {
					if(ryouri[i] % 10 == 0) {
						time[cnt++] = ryouri[i];
					}
				}
		
		int ans = 0;
		for(int i = 4; i >= 0; i--) {
			if(i ==0) {
				ans += time[0];
				break;
			}
			while(true) {
				if(time[i]%10==0) {
					break;
				}
				time[i]++;
			}
			
			ans += time[i];
			
			
		}
			
		
		System.out.println(ans);
		
		
		
		
		
	}

}
