import java.util.*;

class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[5];
		for(int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
		}
		int time = 0;
		
		int min = 10;
		int sub = 0;
		for(int i = 0; i < a.length; i++) {
			int tmp = a[i]%10;
			
			if( tmp < min && tmp != 0) {
				sub = i;
				min = tmp;
			}
		}
		int tmpi = a[4];
		a[4] = a[sub];
		a[sub] = tmpi;
		
		for(int i = 0; i < a.length-1; i++) {
			if(a[i]%10 == 0) {
				time += a[i];
			}else {
				int tmp = a[i]%10;
				time += a[i] + (10-tmp);
			}
		}
	
			time += a[4];
	
			System.out.println(time);
	}
} import java.util.*; util.* java class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[5];
		for(int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
		}
		int time = 0;
		
		int min = 10;
		int sub = 0;
		for(int i = 0; i < a.length; i++) {
			int tmp = a[i]%10;
			
			if( tmp < min && tmp != 0) {
				sub = i;
				min = tmp;
			}
		}
		int tmpi = a[4];
		a[4] = a[sub];
		a[sub] = tmpi;
		
		for(int i = 0; i < a.length-1; i++) {
			if(a[i]%10 == 0) {
				time += a[i];
			}else {
				int tmp = a[i]%10;
				time += a[i] + (10-tmp);
			}
		}
	
			time += a[4];
	
			System.out.println(time);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[5];
		for(int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
		}
		int time = 0;
		
		int min = 10;
		int sub = 0;
		for(int i = 0; i < a.length; i++) {
			int tmp = a[i]%10;
			
			if( tmp < min && tmp != 0) {
				sub = i;
				min = tmp;
			}
		}
		int tmpi = a[4];
		a[4] = a[sub];
		a[sub] = tmpi;
		
		for(int i = 0; i < a.length-1; i++) {
			if(a[i]%10 == 0) {
				time += a[i];
			}else {
				int tmp = a[i]%10;
				time += a[i] + (10-tmp);
			}
		}
	
			time += a[4];
	
			System.out.println(time);
	} main {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[5];
		for(int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
		}
		int time = 0;
		
		int min = 10;
		int sub = 0;
		for(int i = 0; i < a.length; i++) {
			int tmp = a[i]%10;
			
			if( tmp < min && tmp != 0) {
				sub = i;
				min = tmp;
			}
		}
		int tmpi = a[4];
		a[4] = a[sub];
		a[sub] = tmpi;
		
		for(int i = 0; i < a.length-1; i++) {
			if(a[i]%10 == 0) {
				time += a[i];
			}else {
				int tmp = a[i]%10;
				time += a[i] + (10-tmp);
			}
		}
	
			time += a[4];
	
			System.out.println(time);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a[] = new int[5]; a new int[5] 5 for(int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
			a[i] = sc.nextInt();
		} {
			a[i] = sc.nextInt();
		} a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc int time = 0; time 0 int min = 10; min 10 int sub = 0; sub 0 for(int i = 0; i < a.length; i++) {
			int tmp = a[i]%10;
			
			if( tmp < min && tmp != 0) {
				sub = i;
				min = tmp;
			}
		} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
			int tmp = a[i]%10;
			
			if( tmp < min && tmp != 0) {
				sub = i;
				min = tmp;
			}
		} {
			int tmp = a[i]%10;
			
			if( tmp < min && tmp != 0) {
				sub = i;
				min = tmp;
			}
		} int tmp = a[i]%10; tmp a[i]%10 a[i] a i 10 if( tmp < min && tmp != 0) {
				sub = i;
				min = tmp;
			} tmp < min && tmp != 0 tmp < min tmp min tmp != 0 tmp 0 {
				sub = i;
				min = tmp;
			} sub = i sub i min = tmp min tmp int tmpi = a[4]; tmpi a[4] a 4 a[4] = a[sub] a[4] a 4 a[sub] a sub a[sub] = tmpi a[sub] a sub tmpi for(int i = 0; i < a.length-1; i++) {
			if(a[i]%10 == 0) {
				time += a[i];
			}else {
				int tmp = a[i]%10;
				time += a[i] + (10-tmp);
			}
		} int i = 0; int i = 0; i 0 i < a.length-1 i a.length-1 a.length a a.length 1 i++ i++ i {
			if(a[i]%10 == 0) {
				time += a[i];
			}else {
				int tmp = a[i]%10;
				time += a[i] + (10-tmp);
			}
		} {
			if(a[i]%10 == 0) {
				time += a[i];
			}else {
				int tmp = a[i]%10;
				time += a[i] + (10-tmp);
			}
		} if(a[i]%10 == 0) {
				time += a[i];
			}else {
				int tmp = a[i]%10;
				time += a[i] + (10-tmp);
			} a[i]%10 == 0 a[i]%10 a[i] a i 10 0 {
				time += a[i];
			} time += a[i] time a[i] a i {
				int tmp = a[i]%10;
				time += a[i] + (10-tmp);
			} int tmp = a[i]%10; tmp a[i]%10 a[i] a i 10 time += a[i] + (10-tmp) time a[i] + (10-tmp) a[i] a i (10-tmp) 10 tmp time += a[4] time a[4] a 4 System.out.println(time) System.out.println System.out System System.out time String[] args args
import java.util.*;

class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[5];
		for(int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
		}
		int time = 0;
		
		int min = 10;
		int sub = 0;
		for(int i = 0; i < a.length; i++) {
			int tmp = a[i]%10;
			
			if( tmp < min && tmp != 0) {
				sub = i;
				min = tmp;
			}
		}
		int tmpi = a[4];
		a[4] = a[sub];
		a[sub] = tmpi;
		
		for(int i = 0; i < a.length-1; i++) {
			if(a[i]%10 == 0) {
				time += a[i];
			}else {
				int tmp = a[i]%10;
				time += a[i] + (10-tmp);
			}
		}
	
			time += a[4];
	
			System.out.println(time);
	}
}
