import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		// 初期化
		int[] list = new int[5];
		int[] check = {9,0,8,7,6,5,4,3,2,1};
		
		Scanner sc = new Scanner(System.in);
		list[0] = sc.nextInt();
		list[1] = sc.nextInt();
		list[2] = sc.nextInt();
		list[3] = sc.nextInt();
		list[4] = sc.nextInt();

		int result=0;
		int cnt=1;
		for(int i=0;i<check.length;i++) {
			for(int j=0;j<list.length;j++) {
				int amari = list[j] % 10;
				if(amari == check[i]) {
					if(cnt!=5) {
						if(amari != 0) {
							result += list[j] + 10 - amari;
						}
						else {
							result += list[j];
						}
					}
					else {
						result += list[j];
					}
					cnt++;
				}	
			}
		}
		System.out.println(result);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		
		// 初期化
		int[] list = new int[5];
		int[] check = {9,0,8,7,6,5,4,3,2,1};
		
		Scanner sc = new Scanner(System.in);
		list[0] = sc.nextInt();
		list[1] = sc.nextInt();
		list[2] = sc.nextInt();
		list[3] = sc.nextInt();
		list[4] = sc.nextInt();

		int result=0;
		int cnt=1;
		for(int i=0;i<check.length;i++) {
			for(int j=0;j<list.length;j++) {
				int amari = list[j] % 10;
				if(amari == check[i]) {
					if(cnt!=5) {
						if(amari != 0) {
							result += list[j] + 10 - amari;
						}
						else {
							result += list[j];
						}
					}
					else {
						result += list[j];
					}
					cnt++;
				}	
			}
		}
		System.out.println(result);
	}
} Main public static void main(String[] args) {
		
		// 初期化
		int[] list = new int[5];
		int[] check = {9,0,8,7,6,5,4,3,2,1};
		
		Scanner sc = new Scanner(System.in);
		list[0] = sc.nextInt();
		list[1] = sc.nextInt();
		list[2] = sc.nextInt();
		list[3] = sc.nextInt();
		list[4] = sc.nextInt();

		int result=0;
		int cnt=1;
		for(int i=0;i<check.length;i++) {
			for(int j=0;j<list.length;j++) {
				int amari = list[j] % 10;
				if(amari == check[i]) {
					if(cnt!=5) {
						if(amari != 0) {
							result += list[j] + 10 - amari;
						}
						else {
							result += list[j];
						}
					}
					else {
						result += list[j];
					}
					cnt++;
				}	
			}
		}
		System.out.println(result);
	} main {
		
		// 初期化
		int[] list = new int[5];
		int[] check = {9,0,8,7,6,5,4,3,2,1};
		
		Scanner sc = new Scanner(System.in);
		list[0] = sc.nextInt();
		list[1] = sc.nextInt();
		list[2] = sc.nextInt();
		list[3] = sc.nextInt();
		list[4] = sc.nextInt();

		int result=0;
		int cnt=1;
		for(int i=0;i<check.length;i++) {
			for(int j=0;j<list.length;j++) {
				int amari = list[j] % 10;
				if(amari == check[i]) {
					if(cnt!=5) {
						if(amari != 0) {
							result += list[j] + 10 - amari;
						}
						else {
							result += list[j];
						}
					}
					else {
						result += list[j];
					}
					cnt++;
				}	
			}
		}
		System.out.println(result);
	} int[] list = new int[5]; list new int[5] 5 int[] check = {9,0,8,7,6,5,4,3,2,1}; check {9,0,8,7,6,5,4,3,2,1} 9 0 8 7 6 5 4 3 2 1 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) list[0] = sc.nextInt() list[0] list 0 sc.nextInt() sc.nextInt sc list[1] = sc.nextInt() list[1] list 1 sc.nextInt() sc.nextInt sc list[2] = sc.nextInt() list[2] list 2 sc.nextInt() sc.nextInt sc list[3] = sc.nextInt() list[3] list 3 sc.nextInt() sc.nextInt sc list[4] = sc.nextInt() list[4] list 4 sc.nextInt() sc.nextInt sc int result=0; result 0 int cnt=1; cnt 1 for(int i=0;i<check.length;i++) {
			for(int j=0;j<list.length;j++) {
				int amari = list[j] % 10;
				if(amari == check[i]) {
					if(cnt!=5) {
						if(amari != 0) {
							result += list[j] + 10 - amari;
						}
						else {
							result += list[j];
						}
					}
					else {
						result += list[j];
					}
					cnt++;
				}	
			}
		} int i=0; int i=0; i 0 i<check.length i check.length check check.length i++ i++ i {
			for(int j=0;j<list.length;j++) {
				int amari = list[j] % 10;
				if(amari == check[i]) {
					if(cnt!=5) {
						if(amari != 0) {
							result += list[j] + 10 - amari;
						}
						else {
							result += list[j];
						}
					}
					else {
						result += list[j];
					}
					cnt++;
				}	
			}
		} {
			for(int j=0;j<list.length;j++) {
				int amari = list[j] % 10;
				if(amari == check[i]) {
					if(cnt!=5) {
						if(amari != 0) {
							result += list[j] + 10 - amari;
						}
						else {
							result += list[j];
						}
					}
					else {
						result += list[j];
					}
					cnt++;
				}	
			}
		} for(int j=0;j<list.length;j++) {
				int amari = list[j] % 10;
				if(amari == check[i]) {
					if(cnt!=5) {
						if(amari != 0) {
							result += list[j] + 10 - amari;
						}
						else {
							result += list[j];
						}
					}
					else {
						result += list[j];
					}
					cnt++;
				}	
			} int j=0; int j=0; j 0 j<list.length j list.length list list.length j++ j++ j {
				int amari = list[j] % 10;
				if(amari == check[i]) {
					if(cnt!=5) {
						if(amari != 0) {
							result += list[j] + 10 - amari;
						}
						else {
							result += list[j];
						}
					}
					else {
						result += list[j];
					}
					cnt++;
				}	
			} {
				int amari = list[j] % 10;
				if(amari == check[i]) {
					if(cnt!=5) {
						if(amari != 0) {
							result += list[j] + 10 - amari;
						}
						else {
							result += list[j];
						}
					}
					else {
						result += list[j];
					}
					cnt++;
				}	
			} int amari = list[j] % 10; amari list[j] % 10 list[j] list j 10 if(amari == check[i]) {
					if(cnt!=5) {
						if(amari != 0) {
							result += list[j] + 10 - amari;
						}
						else {
							result += list[j];
						}
					}
					else {
						result += list[j];
					}
					cnt++;
				} amari == check[i] amari check[i] check i {
					if(cnt!=5) {
						if(amari != 0) {
							result += list[j] + 10 - amari;
						}
						else {
							result += list[j];
						}
					}
					else {
						result += list[j];
					}
					cnt++;
				} if(cnt!=5) {
						if(amari != 0) {
							result += list[j] + 10 - amari;
						}
						else {
							result += list[j];
						}
					}
					else {
						result += list[j];
					} cnt!=5 cnt 5 {
						if(amari != 0) {
							result += list[j] + 10 - amari;
						}
						else {
							result += list[j];
						}
					} if(amari != 0) {
							result += list[j] + 10 - amari;
						}
						else {
							result += list[j];
						} amari != 0 amari 0 {
							result += list[j] + 10 - amari;
						} result += list[j] + 10 - amari result list[j] + 10 - amari list[j] + 10 list[j] list j 10 amari {
							result += list[j];
						} result += list[j] result list[j] list j {
						result += list[j];
					} result += list[j] result list[j] list j cnt++ cnt System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

	public static void main(String[] args) {
		
		// 初期化
		int[] list = new int[5];
		int[] check = {9,0,8,7,6,5,4,3,2,1};
		
		Scanner sc = new Scanner(System.in);
		list[0] = sc.nextInt();
		list[1] = sc.nextInt();
		list[2] = sc.nextInt();
		list[3] = sc.nextInt();
		list[4] = sc.nextInt();

		int result=0;
		int cnt=1;
		for(int i=0;i<check.length;i++) {
			for(int j=0;j<list.length;j++) {
				int amari = list[j] % 10;
				if(amari == check[i]) {
					if(cnt!=5) {
						if(amari != 0) {
							result += list[j] + 10 - amari;
						}
						else {
							result += list[j];
						}
					}
					else {
						result += list[j];
					}
					cnt++;
				}	
			}
		}
		System.out.println(result);
	}
} public class Main {

	public static void main(String[] args) {
		
		// 初期化
		int[] list = new int[5];
		int[] check = {9,0,8,7,6,5,4,3,2,1};
		
		Scanner sc = new Scanner(System.in);
		list[0] = sc.nextInt();
		list[1] = sc.nextInt();
		list[2] = sc.nextInt();
		list[3] = sc.nextInt();
		list[4] = sc.nextInt();

		int result=0;
		int cnt=1;
		for(int i=0;i<check.length;i++) {
			for(int j=0;j<list.length;j++) {
				int amari = list[j] % 10;
				if(amari == check[i]) {
					if(cnt!=5) {
						if(amari != 0) {
							result += list[j] + 10 - amari;
						}
						else {
							result += list[j];
						}
					}
					else {
						result += list[j];
					}
					cnt++;
				}	
			}
		}
		System.out.println(result);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		// 初期化
		int[] list = new int[5];
		int[] check = {9,0,8,7,6,5,4,3,2,1};
		
		Scanner sc = new Scanner(System.in);
		list[0] = sc.nextInt();
		list[1] = sc.nextInt();
		list[2] = sc.nextInt();
		list[3] = sc.nextInt();
		list[4] = sc.nextInt();

		int result=0;
		int cnt=1;
		for(int i=0;i<check.length;i++) {
			for(int j=0;j<list.length;j++) {
				int amari = list[j] % 10;
				if(amari == check[i]) {
					if(cnt!=5) {
						if(amari != 0) {
							result += list[j] + 10 - amari;
						}
						else {
							result += list[j];
						}
					}
					else {
						result += list[j];
					}
					cnt++;
				}	
			}
		}
		System.out.println(result);
	}
}