import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n[] = new int[6];
		int n2[] = new int[6];
		int n3[] = new int[6];
		for (int i = 1; i <= 5; i++) {
			n[i] = sc.nextInt();

			if (n[i] % 10 == 0) {
				n2[i] = n[i];
				n3[i] = 10;
			} else {

				n3[i] = n[i] % 10;
				n2[i] = n[i] + (10-n3[i]);
			}
		}
		int min=n3[1]+1;
		int minn=0;
		for (int i = 1; i <= 5; i++) {
			if(min>n3[i]){
				min=n3[i];
			minn=i;
			}
}

int ans=n2[1]+n2[2]+n2[3]+n2[4]+n2[5]-n2[minn]+n[minn];
System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n[] = new int[6];
		int n2[] = new int[6];
		int n3[] = new int[6];
		for (int i = 1; i <= 5; i++) {
			n[i] = sc.nextInt();

			if (n[i] % 10 == 0) {
				n2[i] = n[i];
				n3[i] = 10;
			} else {

				n3[i] = n[i] % 10;
				n2[i] = n[i] + (10-n3[i]);
			}
		}
		int min=n3[1]+1;
		int minn=0;
		for (int i = 1; i <= 5; i++) {
			if(min>n3[i]){
				min=n3[i];
			minn=i;
			}
}

int ans=n2[1]+n2[2]+n2[3]+n2[4]+n2[5]-n2[minn]+n[minn];
System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n[] = new int[6];
		int n2[] = new int[6];
		int n3[] = new int[6];
		for (int i = 1; i <= 5; i++) {
			n[i] = sc.nextInt();

			if (n[i] % 10 == 0) {
				n2[i] = n[i];
				n3[i] = 10;
			} else {

				n3[i] = n[i] % 10;
				n2[i] = n[i] + (10-n3[i]);
			}
		}
		int min=n3[1]+1;
		int minn=0;
		for (int i = 1; i <= 5; i++) {
			if(min>n3[i]){
				min=n3[i];
			minn=i;
			}
}

int ans=n2[1]+n2[2]+n2[3]+n2[4]+n2[5]-n2[minn]+n[minn];
System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);

		int n[] = new int[6];
		int n2[] = new int[6];
		int n3[] = new int[6];
		for (int i = 1; i <= 5; i++) {
			n[i] = sc.nextInt();

			if (n[i] % 10 == 0) {
				n2[i] = n[i];
				n3[i] = 10;
			} else {

				n3[i] = n[i] % 10;
				n2[i] = n[i] + (10-n3[i]);
			}
		}
		int min=n3[1]+1;
		int minn=0;
		for (int i = 1; i <= 5; i++) {
			if(min>n3[i]){
				min=n3[i];
			minn=i;
			}
}

int ans=n2[1]+n2[2]+n2[3]+n2[4]+n2[5]-n2[minn]+n[minn];
System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n[] = new int[6]; n new int[6] 6 int n2[] = new int[6]; n2 new int[6] 6 int n3[] = new int[6]; n3 new int[6] 6 for (int i = 1; i <= 5; i++) {
			n[i] = sc.nextInt();

			if (n[i] % 10 == 0) {
				n2[i] = n[i];
				n3[i] = 10;
			} else {

				n3[i] = n[i] % 10;
				n2[i] = n[i] + (10-n3[i]);
			}
		} int i = 1; int i = 1; i 1 i <= 5 i 5 i++ i++ i {
			n[i] = sc.nextInt();

			if (n[i] % 10 == 0) {
				n2[i] = n[i];
				n3[i] = 10;
			} else {

				n3[i] = n[i] % 10;
				n2[i] = n[i] + (10-n3[i]);
			}
		} {
			n[i] = sc.nextInt();

			if (n[i] % 10 == 0) {
				n2[i] = n[i];
				n3[i] = 10;
			} else {

				n3[i] = n[i] % 10;
				n2[i] = n[i] + (10-n3[i]);
			}
		} n[i] = sc.nextInt() n[i] n i sc.nextInt() sc.nextInt sc if (n[i] % 10 == 0) {
				n2[i] = n[i];
				n3[i] = 10;
			} else {

				n3[i] = n[i] % 10;
				n2[i] = n[i] + (10-n3[i]);
			} n[i] % 10 == 0 n[i] % 10 n[i] n i 10 0 {
				n2[i] = n[i];
				n3[i] = 10;
			} n2[i] = n[i] n2[i] n2 i n[i] n i n3[i] = 10 n3[i] n3 i 10 {

				n3[i] = n[i] % 10;
				n2[i] = n[i] + (10-n3[i]);
			} n3[i] = n[i] % 10 n3[i] n3 i n[i] % 10 n[i] n i 10 n2[i] = n[i] + (10-n3[i]) n2[i] n2 i n[i] + (10-n3[i]) n[i] n i (10-n3[i]) 10 n3[i] n3 i int min=n3[1]+1; min n3[1]+1 n3[1] n3 1 1 int minn=0; minn 0 for (int i = 1; i <= 5; i++) {
			if(min>n3[i]){
				min=n3[i];
			minn=i;
			}
} int i = 1; int i = 1; i 1 i <= 5 i 5 i++ i++ i {
			if(min>n3[i]){
				min=n3[i];
			minn=i;
			}
} {
			if(min>n3[i]){
				min=n3[i];
			minn=i;
			}
} if(min>n3[i]){
				min=n3[i];
			minn=i;
			} min>n3[i] min n3[i] n3 i {
				min=n3[i];
			minn=i;
			} min=n3[i] min n3[i] n3 i minn=i minn i int ans=n2[1]+n2[2]+n2[3]+n2[4]+n2[5]-n2[minn]+n[minn]; ans n2[1]+n2[2]+n2[3]+n2[4]+n2[5]-n2[minn]+n[minn] n2[1]+n2[2]+n2[3]+n2[4]+n2[5]-n2[minn] n2[1]+n2[2]+n2[3]+n2[4]+n2[5] n2[4] n2[3] n2[1]+n2[2]+n2[3]+n2[4]+n2[5] n2[1] n2 1 n2[2] n2 2 n2[3] n2 3 n2[4] n2 4 n2[5] n2 5 n2[minn] n2 minn n[minn] n minn System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n[] = new int[6];
		int n2[] = new int[6];
		int n3[] = new int[6];
		for (int i = 1; i <= 5; i++) {
			n[i] = sc.nextInt();

			if (n[i] % 10 == 0) {
				n2[i] = n[i];
				n3[i] = 10;
			} else {

				n3[i] = n[i] % 10;
				n2[i] = n[i] + (10-n3[i]);
			}
		}
		int min=n3[1]+1;
		int minn=0;
		for (int i = 1; i <= 5; i++) {
			if(min>n3[i]){
				min=n3[i];
			minn=i;
			}
}

int ans=n2[1]+n2[2]+n2[3]+n2[4]+n2[5]-n2[minn]+n[minn];
System.out.println(ans);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n[] = new int[6];
		int n2[] = new int[6];
		int n3[] = new int[6];
		for (int i = 1; i <= 5; i++) {
			n[i] = sc.nextInt();

			if (n[i] % 10 == 0) {
				n2[i] = n[i];
				n3[i] = 10;
			} else {

				n3[i] = n[i] % 10;
				n2[i] = n[i] + (10-n3[i]);
			}
		}
		int min=n3[1]+1;
		int minn=0;
		for (int i = 1; i <= 5; i++) {
			if(min>n3[i]){
				min=n3[i];
			minn=i;
			}
}

int ans=n2[1]+n2[2]+n2[3]+n2[4]+n2[5]-n2[minn]+n[minn];
System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n[] = new int[6];
		int n2[] = new int[6];
		int n3[] = new int[6];
		for (int i = 1; i <= 5; i++) {
			n[i] = sc.nextInt();

			if (n[i] % 10 == 0) {
				n2[i] = n[i];
				n3[i] = 10;
			} else {

				n3[i] = n[i] % 10;
				n2[i] = n[i] + (10-n3[i]);
			}
		}
		int min=n3[1]+1;
		int minn=0;
		for (int i = 1; i <= 5; i++) {
			if(min>n3[i]){
				min=n3[i];
			minn=i;
			}
}

int ans=n2[1]+n2[2]+n2[3]+n2[4]+n2[5]-n2[minn]+n[minn];
System.out.println(ans);
	}
}