import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int []a = new int [5];
		int []b = new int [5];
		int max = 0;
		int sum = 0;
		
		for(int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
			b[i] = (10 - (a[i] % 10))%10;
			max = Math.max(max, b[i]);
 		}
		for(int j = 0; j < 5; j++) {
			sum += a[j] + b[j] ;
		}
		
		System.out.println(sum - max);
	}

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

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int []a = new int [5];
		int []b = new int [5];
		int max = 0;
		int sum = 0;
		
		for(int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
			b[i] = (10 - (a[i] % 10))%10;
			max = Math.max(max, b[i]);
 		}
		for(int j = 0; j < 5; j++) {
			sum += a[j] + b[j] ;
		}
		
		System.out.println(sum - max);
	}

} Main public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int []a = new int [5];
		int []b = new int [5];
		int max = 0;
		int sum = 0;
		
		for(int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
			b[i] = (10 - (a[i] % 10))%10;
			max = Math.max(max, b[i]);
 		}
		for(int j = 0; j < 5; j++) {
			sum += a[j] + b[j] ;
		}
		
		System.out.println(sum - max);
	} main {
		
		Scanner sc = new Scanner(System.in);
		int []a = new int [5];
		int []b = new int [5];
		int max = 0;
		int sum = 0;
		
		for(int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
			b[i] = (10 - (a[i] % 10))%10;
			max = Math.max(max, b[i]);
 		}
		for(int j = 0; j < 5; j++) {
			sum += a[j] + b[j] ;
		}
		
		System.out.println(sum - max);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int []a = new int [5]; a new int [5] 5 int []b = new int [5]; b new int [5] 5 int max = 0; max 0 int sum = 0; sum 0 for(int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
			b[i] = (10 - (a[i] % 10))%10;
			max = Math.max(max, b[i]);
 		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			a[i] = sc.nextInt();
			b[i] = (10 - (a[i] % 10))%10;
			max = Math.max(max, b[i]);
 		} {
			a[i] = sc.nextInt();
			b[i] = (10 - (a[i] % 10))%10;
			max = Math.max(max, b[i]);
 		} a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc b[i] = (10 - (a[i] % 10))%10 b[i] b i (10 - (a[i] % 10))%10 (10 - (a[i] % 10)) 10 (a[i] % 10) a[i] a i 10 10 max = Math.max(max, b[i]) max Math.max(max, b[i]) Math.max Math max b[i] b i for(int j = 0; j < 5; j++) {
			sum += a[j] + b[j] ;
		} int j = 0; int j = 0; j 0 j < 5 j 5 j++ j++ j {
			sum += a[j] + b[j] ;
		} {
			sum += a[j] + b[j] ;
		} sum += a[j] + b[j] sum a[j] + b[j] a[j] a j b[j] b j System.out.println(sum - max) System.out.println System.out System System.out sum - max sum max String[] args args public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int []a = new int [5];
		int []b = new int [5];
		int max = 0;
		int sum = 0;
		
		for(int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
			b[i] = (10 - (a[i] % 10))%10;
			max = Math.max(max, b[i]);
 		}
		for(int j = 0; j < 5; j++) {
			sum += a[j] + b[j] ;
		}
		
		System.out.println(sum - max);
	}

} public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int []a = new int [5];
		int []b = new int [5];
		int max = 0;
		int sum = 0;
		
		for(int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
			b[i] = (10 - (a[i] % 10))%10;
			max = Math.max(max, b[i]);
 		}
		for(int j = 0; j < 5; j++) {
			sum += a[j] + b[j] ;
		}
		
		System.out.println(sum - max);
	}

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

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int []a = new int [5];
		int []b = new int [5];
		int max = 0;
		int sum = 0;
		
		for(int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
			b[i] = (10 - (a[i] % 10))%10;
			max = Math.max(max, b[i]);
 		}
		for(int j = 0; j < 5; j++) {
			sum += a[j] + b[j] ;
		}
		
		System.out.println(sum - max);
	}

}
