//package abc124.B;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int sum = 0, diff = 0;
		
		for (int i = 0; i < 5; i++) {
			int n = sc.nextInt();
			sum += (n + 10 - 1) / 10 * 10;
			if (n % 10 != 0) diff = Math.max(diff, 10 - n % 10);
		}
		
		System.out.println(sum - diff);
		
	}

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

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int sum = 0, diff = 0;
		
		for (int i = 0; i < 5; i++) {
			int n = sc.nextInt();
			sum += (n + 10 - 1) / 10 * 10;
			if (n % 10 != 0) diff = Math.max(diff, 10 - n % 10);
		}
		
		System.out.println(sum - diff);
		
	}

} Main public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int sum = 0, diff = 0;
		
		for (int i = 0; i < 5; i++) {
			int n = sc.nextInt();
			sum += (n + 10 - 1) / 10 * 10;
			if (n % 10 != 0) diff = Math.max(diff, 10 - n % 10);
		}
		
		System.out.println(sum - diff);
		
	} main {
		
		Scanner sc = new Scanner(System.in);
		
		int sum = 0, diff = 0;
		
		for (int i = 0; i < 5; i++) {
			int n = sc.nextInt();
			sum += (n + 10 - 1) / 10 * 10;
			if (n % 10 != 0) diff = Math.max(diff, 10 - n % 10);
		}
		
		System.out.println(sum - diff);
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int sum = 0 sum 0 diff = 0; diff 0 for (int i = 0; i < 5; i++) {
			int n = sc.nextInt();
			sum += (n + 10 - 1) / 10 * 10;
			if (n % 10 != 0) diff = Math.max(diff, 10 - n % 10);
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			int n = sc.nextInt();
			sum += (n + 10 - 1) / 10 * 10;
			if (n % 10 != 0) diff = Math.max(diff, 10 - n % 10);
		} {
			int n = sc.nextInt();
			sum += (n + 10 - 1) / 10 * 10;
			if (n % 10 != 0) diff = Math.max(diff, 10 - n % 10);
		} int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc sum += (n + 10 - 1) / 10 * 10 sum (n + 10 - 1) / 10 * 10 (n + 10 - 1) / 10 (n + 10 - 1) n + 10 n 10 1 10 10 if (n % 10 != 0) diff = Math.max(diff, 10 - n % 10); n % 10 != 0 n % 10 n 10 0 diff = Math.max(diff, 10 - n % 10) diff Math.max(diff, 10 - n % 10) Math.max Math diff 10 - n % 10 10 n % 10 n 10 System.out.println(sum - diff) System.out.println System.out System System.out sum - diff sum diff String[] args args public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int sum = 0, diff = 0;
		
		for (int i = 0; i < 5; i++) {
			int n = sc.nextInt();
			sum += (n + 10 - 1) / 10 * 10;
			if (n % 10 != 0) diff = Math.max(diff, 10 - n % 10);
		}
		
		System.out.println(sum - diff);
		
	}

} public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int sum = 0, diff = 0;
		
		for (int i = 0; i < 5; i++) {
			int n = sc.nextInt();
			sum += (n + 10 - 1) / 10 * 10;
			if (n % 10 != 0) diff = Math.max(diff, 10 - n % 10);
		}
		
		System.out.println(sum - diff);
		
	}

} Main
//package abc124.B;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int sum = 0, diff = 0;
		
		for (int i = 0; i < 5; i++) {
			int n = sc.nextInt();
			sum += (n + 10 - 1) / 10 * 10;
			if (n % 10 != 0) diff = Math.max(diff, 10 - n % 10);
		}
		
		System.out.println(sum - diff);
		
	}

}
