import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int[] dish = new int[5];
		boolean[] t = new boolean[5];
		int max = 0;
		int min = 0;
		int time = 0;
		Scanner sc = new Scanner(System.in);
		//최대 최소 인덱스 구함
		for (int i = 0; i < dish.length; i++) {
			dish[i] = sc.nextInt();
			if(dish[i]%10==0)
				continue;
			max = dish[max]%10>dish[i]%10?max:i;
			min = dish[min]%10<dish[i]%10?min:i;
		}
		if(max == min){
			max = 0;
			min = 4;
		}
		t[max] = t[min] = true;
		
		time += (int)Math.ceil((double)dish[max]/10)*10;
		for (int i = 0; i < 5; i++) {
			if(!t[i])
				time += (int)Math.ceil((double)dish[i]/10)*10;
		}
		time += dish[min];
		
		System.out.println(time);
	}

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

	public static void main(String[] args) {
		int[] dish = new int[5];
		boolean[] t = new boolean[5];
		int max = 0;
		int min = 0;
		int time = 0;
		Scanner sc = new Scanner(System.in);
		//최대 최소 인덱스 구함
		for (int i = 0; i < dish.length; i++) {
			dish[i] = sc.nextInt();
			if(dish[i]%10==0)
				continue;
			max = dish[max]%10>dish[i]%10?max:i;
			min = dish[min]%10<dish[i]%10?min:i;
		}
		if(max == min){
			max = 0;
			min = 4;
		}
		t[max] = t[min] = true;
		
		time += (int)Math.ceil((double)dish[max]/10)*10;
		for (int i = 0; i < 5; i++) {
			if(!t[i])
				time += (int)Math.ceil((double)dish[i]/10)*10;
		}
		time += dish[min];
		
		System.out.println(time);
	}

} Main public static void main(String[] args) {
		int[] dish = new int[5];
		boolean[] t = new boolean[5];
		int max = 0;
		int min = 0;
		int time = 0;
		Scanner sc = new Scanner(System.in);
		//최대 최소 인덱스 구함
		for (int i = 0; i < dish.length; i++) {
			dish[i] = sc.nextInt();
			if(dish[i]%10==0)
				continue;
			max = dish[max]%10>dish[i]%10?max:i;
			min = dish[min]%10<dish[i]%10?min:i;
		}
		if(max == min){
			max = 0;
			min = 4;
		}
		t[max] = t[min] = true;
		
		time += (int)Math.ceil((double)dish[max]/10)*10;
		for (int i = 0; i < 5; i++) {
			if(!t[i])
				time += (int)Math.ceil((double)dish[i]/10)*10;
		}
		time += dish[min];
		
		System.out.println(time);
	} main {
		int[] dish = new int[5];
		boolean[] t = new boolean[5];
		int max = 0;
		int min = 0;
		int time = 0;
		Scanner sc = new Scanner(System.in);
		//최대 최소 인덱스 구함
		for (int i = 0; i < dish.length; i++) {
			dish[i] = sc.nextInt();
			if(dish[i]%10==0)
				continue;
			max = dish[max]%10>dish[i]%10?max:i;
			min = dish[min]%10<dish[i]%10?min:i;
		}
		if(max == min){
			max = 0;
			min = 4;
		}
		t[max] = t[min] = true;
		
		time += (int)Math.ceil((double)dish[max]/10)*10;
		for (int i = 0; i < 5; i++) {
			if(!t[i])
				time += (int)Math.ceil((double)dish[i]/10)*10;
		}
		time += dish[min];
		
		System.out.println(time);
	} int[] dish = new int[5]; dish new int[5] 5 boolean[] t = new boolean[5]; t new boolean[5] 5 int max = 0; max 0 int min = 0; min 0 int time = 0; time 0 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) for (int i = 0; i < dish.length; i++) {
			dish[i] = sc.nextInt();
			if(dish[i]%10==0)
				continue;
			max = dish[max]%10>dish[i]%10?max:i;
			min = dish[min]%10<dish[i]%10?min:i;
		} int i = 0; int i = 0; i 0 i < dish.length i dish.length dish dish.length i++ i++ i {
			dish[i] = sc.nextInt();
			if(dish[i]%10==0)
				continue;
			max = dish[max]%10>dish[i]%10?max:i;
			min = dish[min]%10<dish[i]%10?min:i;
		} {
			dish[i] = sc.nextInt();
			if(dish[i]%10==0)
				continue;
			max = dish[max]%10>dish[i]%10?max:i;
			min = dish[min]%10<dish[i]%10?min:i;
		} dish[i] = sc.nextInt() dish[i] dish i sc.nextInt() sc.nextInt sc if(dish[i]%10==0)
				continue; dish[i]%10==0 dish[i]%10 dish[i] dish i 10 0 continue; max = dish[max]%10>dish[i]%10?max:i max dish[max]%10>dish[i]%10?max:i dish[max]%10>dish[i]%10 dish[max]%10 dish[max] dish max 10 dish[i]%10 dish[i] dish i 10 max i min = dish[min]%10<dish[i]%10?min:i min dish[min]%10<dish[i]%10?min:i dish[min]%10<dish[i]%10 dish[min]%10 dish[min] dish min 10 dish[i]%10 dish[i] dish i 10 min i if(max == min){
			max = 0;
			min = 4;
		} max == min max min {
			max = 0;
			min = 4;
		} max = 0 max 0 min = 4 min 4 t[max] = t[min] = true t[max] t max t[min] = true t[min] t min true time += (int)Math.ceil((double)dish[max]/10)*10 time (int)Math.ceil((double)dish[max]/10)*10 (int)Math.ceil((double)dish[max]/10) Math.ceil Math (double)dish[max]/10 (double)dish[max] dish max 10 10 for (int i = 0; i < 5; i++) {
			if(!t[i])
				time += (int)Math.ceil((double)dish[i]/10)*10;
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			if(!t[i])
				time += (int)Math.ceil((double)dish[i]/10)*10;
		} {
			if(!t[i])
				time += (int)Math.ceil((double)dish[i]/10)*10;
		} if(!t[i])
				time += (int)Math.ceil((double)dish[i]/10)*10; !t[i] t[i] t i time += (int)Math.ceil((double)dish[i]/10)*10 time (int)Math.ceil((double)dish[i]/10)*10 (int)Math.ceil((double)dish[i]/10) Math.ceil Math (double)dish[i]/10 (double)dish[i] dish i 10 10 time += dish[min] time dish[min] dish min System.out.println(time) System.out.println System.out System System.out time String[] args args public class Main {

	public static void main(String[] args) {
		int[] dish = new int[5];
		boolean[] t = new boolean[5];
		int max = 0;
		int min = 0;
		int time = 0;
		Scanner sc = new Scanner(System.in);
		//최대 최소 인덱스 구함
		for (int i = 0; i < dish.length; i++) {
			dish[i] = sc.nextInt();
			if(dish[i]%10==0)
				continue;
			max = dish[max]%10>dish[i]%10?max:i;
			min = dish[min]%10<dish[i]%10?min:i;
		}
		if(max == min){
			max = 0;
			min = 4;
		}
		t[max] = t[min] = true;
		
		time += (int)Math.ceil((double)dish[max]/10)*10;
		for (int i = 0; i < 5; i++) {
			if(!t[i])
				time += (int)Math.ceil((double)dish[i]/10)*10;
		}
		time += dish[min];
		
		System.out.println(time);
	}

} public class Main {

	public static void main(String[] args) {
		int[] dish = new int[5];
		boolean[] t = new boolean[5];
		int max = 0;
		int min = 0;
		int time = 0;
		Scanner sc = new Scanner(System.in);
		//최대 최소 인덱스 구함
		for (int i = 0; i < dish.length; i++) {
			dish[i] = sc.nextInt();
			if(dish[i]%10==0)
				continue;
			max = dish[max]%10>dish[i]%10?max:i;
			min = dish[min]%10<dish[i]%10?min:i;
		}
		if(max == min){
			max = 0;
			min = 4;
		}
		t[max] = t[min] = true;
		
		time += (int)Math.ceil((double)dish[max]/10)*10;
		for (int i = 0; i < 5; i++) {
			if(!t[i])
				time += (int)Math.ceil((double)dish[i]/10)*10;
		}
		time += dish[min];
		
		System.out.println(time);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int[] dish = new int[5];
		boolean[] t = new boolean[5];
		int max = 0;
		int min = 0;
		int time = 0;
		Scanner sc = new Scanner(System.in);
		//최대 최소 인덱스 구함
		for (int i = 0; i < dish.length; i++) {
			dish[i] = sc.nextInt();
			if(dish[i]%10==0)
				continue;
			max = dish[max]%10>dish[i]%10?max:i;
			min = dish[min]%10<dish[i]%10?min:i;
		}
		if(max == min){
			max = 0;
			min = 4;
		}
		t[max] = t[min] = true;
		
		time += (int)Math.ceil((double)dish[max]/10)*10;
		for (int i = 0; i < 5; i++) {
			if(!t[i])
				time += (int)Math.ceil((double)dish[i]/10)*10;
		}
		time += dish[min];
		
		System.out.println(time);
	}

}