
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int[] list = new int[5];
		int max = 0;
		int plus = 0;
		for(int i = 0; i < 5; i++) {

			list[i] = Integer.parseInt(scan.nextLine());

			if(list[i] % 10 != 0) {
				plus = 10 - list[i] % 10;
				list[i] += plus;
				max = Math.max(max, plus);
			}
		}

		System.out.println(list[0] + list[1] + list[2] + list[3] + list[4] - max);
	}
} import java.util.Scanner; Scanner java.util public class Main{

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int[] list = new int[5];
		int max = 0;
		int plus = 0;
		for(int i = 0; i < 5; i++) {

			list[i] = Integer.parseInt(scan.nextLine());

			if(list[i] % 10 != 0) {
				plus = 10 - list[i] % 10;
				list[i] += plus;
				max = Math.max(max, plus);
			}
		}

		System.out.println(list[0] + list[1] + list[2] + list[3] + list[4] - max);
	}
} Main public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int[] list = new int[5];
		int max = 0;
		int plus = 0;
		for(int i = 0; i < 5; i++) {

			list[i] = Integer.parseInt(scan.nextLine());

			if(list[i] % 10 != 0) {
				plus = 10 - list[i] % 10;
				list[i] += plus;
				max = Math.max(max, plus);
			}
		}

		System.out.println(list[0] + list[1] + list[2] + list[3] + list[4] - max);
	} main {

		Scanner scan = new Scanner(System.in);

		int[] list = new int[5];
		int max = 0;
		int plus = 0;
		for(int i = 0; i < 5; i++) {

			list[i] = Integer.parseInt(scan.nextLine());

			if(list[i] % 10 != 0) {
				plus = 10 - list[i] % 10;
				list[i] += plus;
				max = Math.max(max, plus);
			}
		}

		System.out.println(list[0] + list[1] + list[2] + list[3] + list[4] - max);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int[] list = new int[5]; list new int[5] 5 int max = 0; max 0 int plus = 0; plus 0 for(int i = 0; i < 5; i++) {

			list[i] = Integer.parseInt(scan.nextLine());

			if(list[i] % 10 != 0) {
				plus = 10 - list[i] % 10;
				list[i] += plus;
				max = Math.max(max, plus);
			}
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {

			list[i] = Integer.parseInt(scan.nextLine());

			if(list[i] % 10 != 0) {
				plus = 10 - list[i] % 10;
				list[i] += plus;
				max = Math.max(max, plus);
			}
		} {

			list[i] = Integer.parseInt(scan.nextLine());

			if(list[i] % 10 != 0) {
				plus = 10 - list[i] % 10;
				list[i] += plus;
				max = Math.max(max, plus);
			}
		} list[i] = Integer.parseInt(scan.nextLine()) list[i] list i Integer.parseInt(scan.nextLine()) Integer.parseInt Integer scan.nextLine() scan.nextLine scan if(list[i] % 10 != 0) {
				plus = 10 - list[i] % 10;
				list[i] += plus;
				max = Math.max(max, plus);
			} list[i] % 10 != 0 list[i] % 10 list[i] list i 10 0 {
				plus = 10 - list[i] % 10;
				list[i] += plus;
				max = Math.max(max, plus);
			} plus = 10 - list[i] % 10 plus 10 - list[i] % 10 10 list[i] % 10 list[i] list i 10 list[i] += plus list[i] list i plus max = Math.max(max, plus) max Math.max(max, plus) Math.max Math max plus System.out.println(list[0] + list[1] + list[2] + list[3] + list[4] - max) System.out.println System.out System System.out list[0] + list[1] + list[2] + list[3] + list[4] - max list[0] + list[1] + list[2] + list[3] + list[4] list[3] list[2] list[0] + list[1] + list[2] + list[3] + list[4] list[0] list 0 list[1] list 1 list[2] list 2 list[3] list 3 list[4] list 4 max String[] args args public class Main{

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int[] list = new int[5];
		int max = 0;
		int plus = 0;
		for(int i = 0; i < 5; i++) {

			list[i] = Integer.parseInt(scan.nextLine());

			if(list[i] % 10 != 0) {
				plus = 10 - list[i] % 10;
				list[i] += plus;
				max = Math.max(max, plus);
			}
		}

		System.out.println(list[0] + list[1] + list[2] + list[3] + list[4] - max);
	}
} public class Main{

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int[] list = new int[5];
		int max = 0;
		int plus = 0;
		for(int i = 0; i < 5; i++) {

			list[i] = Integer.parseInt(scan.nextLine());

			if(list[i] % 10 != 0) {
				plus = 10 - list[i] % 10;
				list[i] += plus;
				max = Math.max(max, plus);
			}
		}

		System.out.println(list[0] + list[1] + list[2] + list[3] + list[4] - max);
	}
} Main

import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int[] list = new int[5];
		int max = 0;
		int plus = 0;
		for(int i = 0; i < 5; i++) {

			list[i] = Integer.parseInt(scan.nextLine());

			if(list[i] % 10 != 0) {
				plus = 10 - list[i] % 10;
				list[i] += plus;
				max = Math.max(max, plus);
			}
		}

		System.out.println(list[0] + list[1] + list[2] + list[3] + list[4] - max);
	}
}
