import java.util.Scanner;
public class Main{

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int sum = 0;
		int[] array = new int[5];
		int[] count = new int[5];
		int max = 0;

		for(int i=0;i<5;i++) {
			array[i] = scan.nextInt();
		}

		boolean flg = true;
		for(int i=0;i<5;i++) {
		while(true) {
			if(array[i] % 10 == 0) {
				sum += array[i];
				flg = false;
				break;
			 }else {
				array[i]++;
				count[i]++;
			 }
			}
		}

		for(int i=0;i<5;i++) {
			max = Math.max(max, count[i]);
		}

		System.out.println(sum-max);
		scan.close();
	}

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

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int sum = 0;
		int[] array = new int[5];
		int[] count = new int[5];
		int max = 0;

		for(int i=0;i<5;i++) {
			array[i] = scan.nextInt();
		}

		boolean flg = true;
		for(int i=0;i<5;i++) {
		while(true) {
			if(array[i] % 10 == 0) {
				sum += array[i];
				flg = false;
				break;
			 }else {
				array[i]++;
				count[i]++;
			 }
			}
		}

		for(int i=0;i<5;i++) {
			max = Math.max(max, count[i]);
		}

		System.out.println(sum-max);
		scan.close();
	}

} Main public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int sum = 0;
		int[] array = new int[5];
		int[] count = new int[5];
		int max = 0;

		for(int i=0;i<5;i++) {
			array[i] = scan.nextInt();
		}

		boolean flg = true;
		for(int i=0;i<5;i++) {
		while(true) {
			if(array[i] % 10 == 0) {
				sum += array[i];
				flg = false;
				break;
			 }else {
				array[i]++;
				count[i]++;
			 }
			}
		}

		for(int i=0;i<5;i++) {
			max = Math.max(max, count[i]);
		}

		System.out.println(sum-max);
		scan.close();
	} main {

		Scanner scan = new Scanner(System.in);
		int sum = 0;
		int[] array = new int[5];
		int[] count = new int[5];
		int max = 0;

		for(int i=0;i<5;i++) {
			array[i] = scan.nextInt();
		}

		boolean flg = true;
		for(int i=0;i<5;i++) {
		while(true) {
			if(array[i] % 10 == 0) {
				sum += array[i];
				flg = false;
				break;
			 }else {
				array[i]++;
				count[i]++;
			 }
			}
		}

		for(int i=0;i<5;i++) {
			max = Math.max(max, count[i]);
		}

		System.out.println(sum-max);
		scan.close();
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int sum = 0; sum 0 int[] array = new int[5]; array new int[5] 5 int[] count = new int[5]; count new int[5] 5 int max = 0; max 0 for(int i=0;i<5;i++) {
			array[i] = scan.nextInt();
		} int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
			array[i] = scan.nextInt();
		} {
			array[i] = scan.nextInt();
		} array[i] = scan.nextInt() array[i] array i scan.nextInt() scan.nextInt scan boolean flg = true; flg true for(int i=0;i<5;i++) {
		while(true) {
			if(array[i] % 10 == 0) {
				sum += array[i];
				flg = false;
				break;
			 }else {
				array[i]++;
				count[i]++;
			 }
			}
		} int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
		while(true) {
			if(array[i] % 10 == 0) {
				sum += array[i];
				flg = false;
				break;
			 }else {
				array[i]++;
				count[i]++;
			 }
			}
		} {
		while(true) {
			if(array[i] % 10 == 0) {
				sum += array[i];
				flg = false;
				break;
			 }else {
				array[i]++;
				count[i]++;
			 }
			}
		} while(true) {
			if(array[i] % 10 == 0) {
				sum += array[i];
				flg = false;
				break;
			 }else {
				array[i]++;
				count[i]++;
			 }
			} true {
			if(array[i] % 10 == 0) {
				sum += array[i];
				flg = false;
				break;
			 }else {
				array[i]++;
				count[i]++;
			 }
			} if(array[i] % 10 == 0) {
				sum += array[i];
				flg = false;
				break;
			 }else {
				array[i]++;
				count[i]++;
			 } array[i] % 10 == 0 array[i] % 10 array[i] array i 10 0 {
				sum += array[i];
				flg = false;
				break;
			 } sum += array[i] sum array[i] array i flg = false flg false break; {
				array[i]++;
				count[i]++;
			 } array[i]++ array[i] array i count[i]++ count[i] count i for(int i=0;i<5;i++) {
			max = Math.max(max, count[i]);
		} int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
			max = Math.max(max, count[i]);
		} {
			max = Math.max(max, count[i]);
		} max = Math.max(max, count[i]) max Math.max(max, count[i]) Math.max Math max count[i] count i System.out.println(sum-max) System.out.println System.out System System.out sum-max sum max scan.close() scan.close scan String[] args args public class Main{

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int sum = 0;
		int[] array = new int[5];
		int[] count = new int[5];
		int max = 0;

		for(int i=0;i<5;i++) {
			array[i] = scan.nextInt();
		}

		boolean flg = true;
		for(int i=0;i<5;i++) {
		while(true) {
			if(array[i] % 10 == 0) {
				sum += array[i];
				flg = false;
				break;
			 }else {
				array[i]++;
				count[i]++;
			 }
			}
		}

		for(int i=0;i<5;i++) {
			max = Math.max(max, count[i]);
		}

		System.out.println(sum-max);
		scan.close();
	}

} public class Main{

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int sum = 0;
		int[] array = new int[5];
		int[] count = new int[5];
		int max = 0;

		for(int i=0;i<5;i++) {
			array[i] = scan.nextInt();
		}

		boolean flg = true;
		for(int i=0;i<5;i++) {
		while(true) {
			if(array[i] % 10 == 0) {
				sum += array[i];
				flg = false;
				break;
			 }else {
				array[i]++;
				count[i]++;
			 }
			}
		}

		for(int i=0;i<5;i++) {
			max = Math.max(max, count[i]);
		}

		System.out.println(sum-max);
		scan.close();
	}

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

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int sum = 0;
		int[] array = new int[5];
		int[] count = new int[5];
		int max = 0;

		for(int i=0;i<5;i++) {
			array[i] = scan.nextInt();
		}

		boolean flg = true;
		for(int i=0;i<5;i++) {
		while(true) {
			if(array[i] % 10 == 0) {
				sum += array[i];
				flg = false;
				break;
			 }else {
				array[i]++;
				count[i]++;
			 }
			}
		}

		for(int i=0;i<5;i++) {
			max = Math.max(max, count[i]);
		}

		System.out.println(sum-max);
		scan.close();
	}

}
