import java.util.Scanner;
import java.lang.*;
import java.io.*;

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

		Scanner scanner = new Scanner(System.in);
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		int C = scanner.nextInt();
		int D = scanner.nextInt();
		int E = scanner.nextInt();
		int a = A % 10;
		if (a == 0) {
			a += 10;
		}
		int b = B % 10;
		if (b == 0) {
			b += 10;
		}
		int c = C % 10;
		if (c == 0) {
			c += 10;
		}
		int d = D % 10;
		if (d == 0) {
			d += 10;
		}
		int e = E % 10;
		if (e == 0) {
			e += 10;
		}
		int T = 0;
		int min = 100;
		int[] data = { a, b, c, d, e};
		for(int i = 0; i < data.length; i++) {
			min = Math.min(min,data[i]);
		}
		//System.out.println(min);
		T = A+B+C+D+E+40-a-b-c-d-e+min;
		System.out.println(T);
	}
} import java.util.Scanner; Scanner java.util import java.lang.*; lang.* java import java.io.*; io.* java public class Main {
	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		int C = scanner.nextInt();
		int D = scanner.nextInt();
		int E = scanner.nextInt();
		int a = A % 10;
		if (a == 0) {
			a += 10;
		}
		int b = B % 10;
		if (b == 0) {
			b += 10;
		}
		int c = C % 10;
		if (c == 0) {
			c += 10;
		}
		int d = D % 10;
		if (d == 0) {
			d += 10;
		}
		int e = E % 10;
		if (e == 0) {
			e += 10;
		}
		int T = 0;
		int min = 100;
		int[] data = { a, b, c, d, e};
		for(int i = 0; i < data.length; i++) {
			min = Math.min(min,data[i]);
		}
		//System.out.println(min);
		T = A+B+C+D+E+40-a-b-c-d-e+min;
		System.out.println(T);
	}
} Main public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		int C = scanner.nextInt();
		int D = scanner.nextInt();
		int E = scanner.nextInt();
		int a = A % 10;
		if (a == 0) {
			a += 10;
		}
		int b = B % 10;
		if (b == 0) {
			b += 10;
		}
		int c = C % 10;
		if (c == 0) {
			c += 10;
		}
		int d = D % 10;
		if (d == 0) {
			d += 10;
		}
		int e = E % 10;
		if (e == 0) {
			e += 10;
		}
		int T = 0;
		int min = 100;
		int[] data = { a, b, c, d, e};
		for(int i = 0; i < data.length; i++) {
			min = Math.min(min,data[i]);
		}
		//System.out.println(min);
		T = A+B+C+D+E+40-a-b-c-d-e+min;
		System.out.println(T);
	} main {

		Scanner scanner = new Scanner(System.in);
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		int C = scanner.nextInt();
		int D = scanner.nextInt();
		int E = scanner.nextInt();
		int a = A % 10;
		if (a == 0) {
			a += 10;
		}
		int b = B % 10;
		if (b == 0) {
			b += 10;
		}
		int c = C % 10;
		if (c == 0) {
			c += 10;
		}
		int d = D % 10;
		if (d == 0) {
			d += 10;
		}
		int e = E % 10;
		if (e == 0) {
			e += 10;
		}
		int T = 0;
		int min = 100;
		int[] data = { a, b, c, d, e};
		for(int i = 0; i < data.length; i++) {
			min = Math.min(min,data[i]);
		}
		//System.out.println(min);
		T = A+B+C+D+E+40-a-b-c-d-e+min;
		System.out.println(T);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int A = scanner.nextInt(); A scanner.nextInt() scanner.nextInt scanner int B = scanner.nextInt(); B scanner.nextInt() scanner.nextInt scanner int C = scanner.nextInt(); C scanner.nextInt() scanner.nextInt scanner int D = scanner.nextInt(); D scanner.nextInt() scanner.nextInt scanner int E = scanner.nextInt(); E scanner.nextInt() scanner.nextInt scanner int a = A % 10; a A % 10 A 10 if (a == 0) {
			a += 10;
		} a == 0 a 0 {
			a += 10;
		} a += 10 a 10 int b = B % 10; b B % 10 B 10 if (b == 0) {
			b += 10;
		} b == 0 b 0 {
			b += 10;
		} b += 10 b 10 int c = C % 10; c C % 10 C 10 if (c == 0) {
			c += 10;
		} c == 0 c 0 {
			c += 10;
		} c += 10 c 10 int d = D % 10; d D % 10 D 10 if (d == 0) {
			d += 10;
		} d == 0 d 0 {
			d += 10;
		} d += 10 d 10 int e = E % 10; e E % 10 E 10 if (e == 0) {
			e += 10;
		} e == 0 e 0 {
			e += 10;
		} e += 10 e 10 int T = 0; T 0 int min = 100; min 100 int[] data = { a, b, c, d, e}; data { a, b, c, d, e} a b c d e for(int i = 0; i < data.length; i++) {
			min = Math.min(min,data[i]);
		} int i = 0; int i = 0; i 0 i < data.length i data.length data data.length i++ i++ i {
			min = Math.min(min,data[i]);
		} {
			min = Math.min(min,data[i]);
		} min = Math.min(min,data[i]) min Math.min(min,data[i]) Math.min Math min data[i] data i T = A+B+C+D+E+40-a-b-c-d-e+min T A+B+C+D+E+40-a-b-c-d-e+min A+B+C+D+E+40-a-b-c-d-e d c b A+B+C+D+E+40-a-b-c-d-e A+B+C+D+E+40 E D C A+B+C+D+E+40 A B C D E 40 a b c d e min System.out.println(T) System.out.println System.out System System.out T String[] args args public class Main {
	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		int C = scanner.nextInt();
		int D = scanner.nextInt();
		int E = scanner.nextInt();
		int a = A % 10;
		if (a == 0) {
			a += 10;
		}
		int b = B % 10;
		if (b == 0) {
			b += 10;
		}
		int c = C % 10;
		if (c == 0) {
			c += 10;
		}
		int d = D % 10;
		if (d == 0) {
			d += 10;
		}
		int e = E % 10;
		if (e == 0) {
			e += 10;
		}
		int T = 0;
		int min = 100;
		int[] data = { a, b, c, d, e};
		for(int i = 0; i < data.length; i++) {
			min = Math.min(min,data[i]);
		}
		//System.out.println(min);
		T = A+B+C+D+E+40-a-b-c-d-e+min;
		System.out.println(T);
	}
} public class Main {
	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		int C = scanner.nextInt();
		int D = scanner.nextInt();
		int E = scanner.nextInt();
		int a = A % 10;
		if (a == 0) {
			a += 10;
		}
		int b = B % 10;
		if (b == 0) {
			b += 10;
		}
		int c = C % 10;
		if (c == 0) {
			c += 10;
		}
		int d = D % 10;
		if (d == 0) {
			d += 10;
		}
		int e = E % 10;
		if (e == 0) {
			e += 10;
		}
		int T = 0;
		int min = 100;
		int[] data = { a, b, c, d, e};
		for(int i = 0; i < data.length; i++) {
			min = Math.min(min,data[i]);
		}
		//System.out.println(min);
		T = A+B+C+D+E+40-a-b-c-d-e+min;
		System.out.println(T);
	}
} Main
import java.util.Scanner;
import java.lang.*;
import java.io.*;

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

		Scanner scanner = new Scanner(System.in);
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		int C = scanner.nextInt();
		int D = scanner.nextInt();
		int E = scanner.nextInt();
		int a = A % 10;
		if (a == 0) {
			a += 10;
		}
		int b = B % 10;
		if (b == 0) {
			b += 10;
		}
		int c = C % 10;
		if (c == 0) {
			c += 10;
		}
		int d = D % 10;
		if (d == 0) {
			d += 10;
		}
		int e = E % 10;
		if (e == 0) {
			e += 10;
		}
		int T = 0;
		int min = 100;
		int[] data = { a, b, c, d, e};
		for(int i = 0; i < data.length; i++) {
			min = Math.min(min,data[i]);
		}
		//System.out.println(min);
		T = A+B+C+D+E+40-a-b-c-d-e+min;
		System.out.println(T);
	}
}