import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = 5;
		long minute[] = new long[num];
		long rest[] = new long[num];
		long time = 0;
		for(int i = 0; i < num; i ++) {
			minute[i] = sc.nextLong();
			long need = (long)Math.ceil(minute[i] / 10.0) * 10;
			rest[i] = need - minute[i];
			time += need;
		}
		Arrays.sort(rest);
		time -= rest[num - 1];
		System.out.println(time);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = 5;
		long minute[] = new long[num];
		long rest[] = new long[num];
		long time = 0;
		for(int i = 0; i < num; i ++) {
			minute[i] = sc.nextLong();
			long need = (long)Math.ceil(minute[i] / 10.0) * 10;
			rest[i] = need - minute[i];
			time += need;
		}
		Arrays.sort(rest);
		time -= rest[num - 1];
		System.out.println(time);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = 5;
		long minute[] = new long[num];
		long rest[] = new long[num];
		long time = 0;
		for(int i = 0; i < num; i ++) {
			minute[i] = sc.nextLong();
			long need = (long)Math.ceil(minute[i] / 10.0) * 10;
			rest[i] = need - minute[i];
			time += need;
		}
		Arrays.sort(rest);
		time -= rest[num - 1];
		System.out.println(time);
	} main {
		Scanner sc = new Scanner(System.in);
		int num = 5;
		long minute[] = new long[num];
		long rest[] = new long[num];
		long time = 0;
		for(int i = 0; i < num; i ++) {
			minute[i] = sc.nextLong();
			long need = (long)Math.ceil(minute[i] / 10.0) * 10;
			rest[i] = need - minute[i];
			time += need;
		}
		Arrays.sort(rest);
		time -= rest[num - 1];
		System.out.println(time);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int num = 5; num 5 long minute[] = new long[num]; minute new long[num] num long rest[] = new long[num]; rest new long[num] num long time = 0; time 0 for(int i = 0; i < num; i ++) {
			minute[i] = sc.nextLong();
			long need = (long)Math.ceil(minute[i] / 10.0) * 10;
			rest[i] = need - minute[i];
			time += need;
		} int i = 0; int i = 0; i 0 i < num i num i ++ i ++ i {
			minute[i] = sc.nextLong();
			long need = (long)Math.ceil(minute[i] / 10.0) * 10;
			rest[i] = need - minute[i];
			time += need;
		} {
			minute[i] = sc.nextLong();
			long need = (long)Math.ceil(minute[i] / 10.0) * 10;
			rest[i] = need - minute[i];
			time += need;
		} minute[i] = sc.nextLong() minute[i] minute i sc.nextLong() sc.nextLong sc long need = (long)Math.ceil(minute[i] / 10.0) * 10; need (long)Math.ceil(minute[i] / 10.0) * 10 (long)Math.ceil(minute[i] / 10.0) Math.ceil Math minute[i] / 10.0 minute[i] minute i 10.0 10 rest[i] = need - minute[i] rest[i] rest i need - minute[i] need minute[i] minute i time += need time need Arrays.sort(rest) Arrays.sort Arrays rest time -= rest[num - 1] time rest[num - 1] rest num - 1 num 1 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) {
		Scanner sc = new Scanner(System.in);
		int num = 5;
		long minute[] = new long[num];
		long rest[] = new long[num];
		long time = 0;
		for(int i = 0; i < num; i ++) {
			minute[i] = sc.nextLong();
			long need = (long)Math.ceil(minute[i] / 10.0) * 10;
			rest[i] = need - minute[i];
			time += need;
		}
		Arrays.sort(rest);
		time -= rest[num - 1];
		System.out.println(time);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = 5;
		long minute[] = new long[num];
		long rest[] = new long[num];
		long time = 0;
		for(int i = 0; i < num; i ++) {
			minute[i] = sc.nextLong();
			long need = (long)Math.ceil(minute[i] / 10.0) * 10;
			rest[i] = need - minute[i];
			time += need;
		}
		Arrays.sort(rest);
		time -= rest[num - 1];
		System.out.println(time);
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = 5;
		long minute[] = new long[num];
		long rest[] = new long[num];
		long time = 0;
		for(int i = 0; i < num; i ++) {
			minute[i] = sc.nextLong();
			long need = (long)Math.ceil(minute[i] / 10.0) * 10;
			rest[i] = need - minute[i];
			time += need;
		}
		Arrays.sort(rest);
		time -= rest[num - 1];
		System.out.println(time);
	}
}