import java.util.Scanner;

public class Main {
	public static void main(String args[]) {	
		Scanner sc = new Scanner(System.in);
		int[] time = new int[5];
		for(int i=0;i<time.length;i++) {
			time[i] = Integer.parseInt(sc.next());
		}
		
		int[] los = new int[5];
		int totaltime = 0;
		for(int i=0;i<los.length;i++) {
			if(time[i]<10) {
				los[i] = 10-time[i];
			}else if(time[i]<100) {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}else {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}
		}
		
		for(int i=0 ;i<los.length;i++) {
			totaltime += time[i]+los[i];
		}
		int max=los[0],index=0;
		for(int i=1;i<los.length;i++) {
			if(los[i]>max) {
				max=los[i];
				index=i;
			}
		}
		
		System.out.println(totaltime-los[index]);
		
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String args[]) {	
		Scanner sc = new Scanner(System.in);
		int[] time = new int[5];
		for(int i=0;i<time.length;i++) {
			time[i] = Integer.parseInt(sc.next());
		}
		
		int[] los = new int[5];
		int totaltime = 0;
		for(int i=0;i<los.length;i++) {
			if(time[i]<10) {
				los[i] = 10-time[i];
			}else if(time[i]<100) {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}else {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}
		}
		
		for(int i=0 ;i<los.length;i++) {
			totaltime += time[i]+los[i];
		}
		int max=los[0],index=0;
		for(int i=1;i<los.length;i++) {
			if(los[i]>max) {
				max=los[i];
				index=i;
			}
		}
		
		System.out.println(totaltime-los[index]);
		
	}
} Main public static void main(String args[]) {	
		Scanner sc = new Scanner(System.in);
		int[] time = new int[5];
		for(int i=0;i<time.length;i++) {
			time[i] = Integer.parseInt(sc.next());
		}
		
		int[] los = new int[5];
		int totaltime = 0;
		for(int i=0;i<los.length;i++) {
			if(time[i]<10) {
				los[i] = 10-time[i];
			}else if(time[i]<100) {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}else {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}
		}
		
		for(int i=0 ;i<los.length;i++) {
			totaltime += time[i]+los[i];
		}
		int max=los[0],index=0;
		for(int i=1;i<los.length;i++) {
			if(los[i]>max) {
				max=los[i];
				index=i;
			}
		}
		
		System.out.println(totaltime-los[index]);
		
	} main {	
		Scanner sc = new Scanner(System.in);
		int[] time = new int[5];
		for(int i=0;i<time.length;i++) {
			time[i] = Integer.parseInt(sc.next());
		}
		
		int[] los = new int[5];
		int totaltime = 0;
		for(int i=0;i<los.length;i++) {
			if(time[i]<10) {
				los[i] = 10-time[i];
			}else if(time[i]<100) {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}else {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}
		}
		
		for(int i=0 ;i<los.length;i++) {
			totaltime += time[i]+los[i];
		}
		int max=los[0],index=0;
		for(int i=1;i<los.length;i++) {
			if(los[i]>max) {
				max=los[i];
				index=i;
			}
		}
		
		System.out.println(totaltime-los[index]);
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] time = new int[5]; time new int[5] 5 for(int i=0;i<time.length;i++) {
			time[i] = Integer.parseInt(sc.next());
		} int i=0; int i=0; i 0 i<time.length i time.length time time.length i++ i++ i {
			time[i] = Integer.parseInt(sc.next());
		} {
			time[i] = Integer.parseInt(sc.next());
		} time[i] = Integer.parseInt(sc.next()) time[i] time i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] los = new int[5]; los new int[5] 5 int totaltime = 0; totaltime 0 for(int i=0;i<los.length;i++) {
			if(time[i]<10) {
				los[i] = 10-time[i];
			}else if(time[i]<100) {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}else {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}
		} int i=0; int i=0; i 0 i<los.length i los.length los los.length i++ i++ i {
			if(time[i]<10) {
				los[i] = 10-time[i];
			}else if(time[i]<100) {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}else {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}
		} {
			if(time[i]<10) {
				los[i] = 10-time[i];
			}else if(time[i]<100) {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}else {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}
		} if(time[i]<10) {
				los[i] = 10-time[i];
			}else if(time[i]<100) {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}else {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			} time[i]<10 time[i] time i 10 {
				los[i] = 10-time[i];
			} los[i] = 10-time[i] los[i] los i 10-time[i] 10 time[i] time i if(time[i]<100) {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}else {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			} time[i]<100 time[i] time i 100 {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			} int t = (time[i]/10); t (time[i]/10) time[i] time i 10 los[i] = 10-(time[i]-t*10) los[i] los i 10-(time[i]-t*10) 10 (time[i]-t*10) time[i] time i t*10 t 10 if(los[i]==10) los[i]=0; los[i]==10 los[i] los i 10 los[i]=0 los[i] los i 0 {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			} int t = (time[i]/10); t (time[i]/10) time[i] time i 10 los[i] = 10-(time[i]-t*10) los[i] los i 10-(time[i]-t*10) 10 (time[i]-t*10) time[i] time i t*10 t 10 if(los[i]==10) los[i]=0; los[i]==10 los[i] los i 10 los[i]=0 los[i] los i 0 for(int i=0 ;i<los.length;i++) {
			totaltime += time[i]+los[i];
		} int i=0 ; int i=0 ; i 0 i<los.length i los.length los los.length i++ i++ i {
			totaltime += time[i]+los[i];
		} {
			totaltime += time[i]+los[i];
		} totaltime += time[i]+los[i] totaltime time[i]+los[i] time[i] time i los[i] los i int max=los[0] max los[0] los 0 index=0; index 0 for(int i=1;i<los.length;i++) {
			if(los[i]>max) {
				max=los[i];
				index=i;
			}
		} int i=1; int i=1; i 1 i<los.length i los.length los los.length i++ i++ i {
			if(los[i]>max) {
				max=los[i];
				index=i;
			}
		} {
			if(los[i]>max) {
				max=los[i];
				index=i;
			}
		} if(los[i]>max) {
				max=los[i];
				index=i;
			} los[i]>max los[i] los i max {
				max=los[i];
				index=i;
			} max=los[i] max los[i] los i index=i index i System.out.println(totaltime-los[index]) System.out.println System.out System System.out totaltime-los[index] totaltime los[index] los index String args[] args public class Main {
	public static void main(String args[]) {	
		Scanner sc = new Scanner(System.in);
		int[] time = new int[5];
		for(int i=0;i<time.length;i++) {
			time[i] = Integer.parseInt(sc.next());
		}
		
		int[] los = new int[5];
		int totaltime = 0;
		for(int i=0;i<los.length;i++) {
			if(time[i]<10) {
				los[i] = 10-time[i];
			}else if(time[i]<100) {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}else {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}
		}
		
		for(int i=0 ;i<los.length;i++) {
			totaltime += time[i]+los[i];
		}
		int max=los[0],index=0;
		for(int i=1;i<los.length;i++) {
			if(los[i]>max) {
				max=los[i];
				index=i;
			}
		}
		
		System.out.println(totaltime-los[index]);
		
	}
} public class Main {
	public static void main(String args[]) {	
		Scanner sc = new Scanner(System.in);
		int[] time = new int[5];
		for(int i=0;i<time.length;i++) {
			time[i] = Integer.parseInt(sc.next());
		}
		
		int[] los = new int[5];
		int totaltime = 0;
		for(int i=0;i<los.length;i++) {
			if(time[i]<10) {
				los[i] = 10-time[i];
			}else if(time[i]<100) {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}else {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}
		}
		
		for(int i=0 ;i<los.length;i++) {
			totaltime += time[i]+los[i];
		}
		int max=los[0],index=0;
		for(int i=1;i<los.length;i++) {
			if(los[i]>max) {
				max=los[i];
				index=i;
			}
		}
		
		System.out.println(totaltime-los[index]);
		
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {	
		Scanner sc = new Scanner(System.in);
		int[] time = new int[5];
		for(int i=0;i<time.length;i++) {
			time[i] = Integer.parseInt(sc.next());
		}
		
		int[] los = new int[5];
		int totaltime = 0;
		for(int i=0;i<los.length;i++) {
			if(time[i]<10) {
				los[i] = 10-time[i];
			}else if(time[i]<100) {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}else {
				int t = (time[i]/10);
				los[i] = 10-(time[i]-t*10);
				if(los[i]==10) los[i]=0;
			}
		}
		
		for(int i=0 ;i<los.length;i++) {
			totaltime += time[i]+los[i];
		}
		int max=los[0],index=0;
		for(int i=1;i<los.length;i++) {
			if(los[i]>max) {
				max=los[i];
				index=i;
			}
		}
		
		System.out.println(totaltime-los[index]);
		
	}
}
