import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double min = 10;
		double ans = 0;
		for (int i = 0; i < 5; i++) {
			double A = sc.nextInt();
			ans += Math.ceil(A / 10) * 10;
			double a = A % 10;
			if (min > a&&a!=0) {
				min = a;
			}
		}
		sc.close();
		int ans2=(int)(ans-(10-min));
		System.out.println(ans2);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double min = 10;
		double ans = 0;
		for (int i = 0; i < 5; i++) {
			double A = sc.nextInt();
			ans += Math.ceil(A / 10) * 10;
			double a = A % 10;
			if (min > a&&a!=0) {
				min = a;
			}
		}
		sc.close();
		int ans2=(int)(ans-(10-min));
		System.out.println(ans2);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double min = 10;
		double ans = 0;
		for (int i = 0; i < 5; i++) {
			double A = sc.nextInt();
			ans += Math.ceil(A / 10) * 10;
			double a = A % 10;
			if (min > a&&a!=0) {
				min = a;
			}
		}
		sc.close();
		int ans2=(int)(ans-(10-min));
		System.out.println(ans2);
	} main {
		Scanner sc = new Scanner(System.in);
		double min = 10;
		double ans = 0;
		for (int i = 0; i < 5; i++) {
			double A = sc.nextInt();
			ans += Math.ceil(A / 10) * 10;
			double a = A % 10;
			if (min > a&&a!=0) {
				min = a;
			}
		}
		sc.close();
		int ans2=(int)(ans-(10-min));
		System.out.println(ans2);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) double min = 10; min 10 double ans = 0; ans 0 for (int i = 0; i < 5; i++) {
			double A = sc.nextInt();
			ans += Math.ceil(A / 10) * 10;
			double a = A % 10;
			if (min > a&&a!=0) {
				min = a;
			}
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			double A = sc.nextInt();
			ans += Math.ceil(A / 10) * 10;
			double a = A % 10;
			if (min > a&&a!=0) {
				min = a;
			}
		} {
			double A = sc.nextInt();
			ans += Math.ceil(A / 10) * 10;
			double a = A % 10;
			if (min > a&&a!=0) {
				min = a;
			}
		} double A = sc.nextInt(); A sc.nextInt() sc.nextInt sc ans += Math.ceil(A / 10) * 10 ans Math.ceil(A / 10) * 10 Math.ceil(A / 10) Math.ceil Math A / 10 A 10 10 double a = A % 10; a A % 10 A 10 if (min > a&&a!=0) {
				min = a;
			} min > a&&a!=0 min > a min a a!=0 a 0 {
				min = a;
			} min = a min a sc.close() sc.close sc int ans2=(int)(ans-(10-min)); ans2 (int)(ans-(10-min)) ans (10-min) 10 min System.out.println(ans2) System.out.println System.out System System.out ans2 String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double min = 10;
		double ans = 0;
		for (int i = 0; i < 5; i++) {
			double A = sc.nextInt();
			ans += Math.ceil(A / 10) * 10;
			double a = A % 10;
			if (min > a&&a!=0) {
				min = a;
			}
		}
		sc.close();
		int ans2=(int)(ans-(10-min));
		System.out.println(ans2);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double min = 10;
		double ans = 0;
		for (int i = 0; i < 5; i++) {
			double A = sc.nextInt();
			ans += Math.ceil(A / 10) * 10;
			double a = A % 10;
			if (min > a&&a!=0) {
				min = a;
			}
		}
		sc.close();
		int ans2=(int)(ans-(10-min));
		System.out.println(ans2);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double min = 10;
		double ans = 0;
		for (int i = 0; i < 5; i++) {
			double A = sc.nextInt();
			ans += Math.ceil(A / 10) * 10;
			double a = A % 10;
			if (min > a&&a!=0) {
				min = a;
			}
		}
		sc.close();
		int ans2=(int)(ans-(10-min));
		System.out.println(ans2);
	}
}
