import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int ans = 0;
		int rem = 10;
		for (int i = 0; i < 5; i++) {
			int b = sc.nextInt();
			if(b%10==0) {
				ans += b;
			}else {
				ans += (b/10+1)*10;
				rem = Math.min(rem,b-b/10*10);
			}
		}
		System.out.println((rem==10)?ans:ans-(10-rem));
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int ans = 0;
		int rem = 10;
		for (int i = 0; i < 5; i++) {
			int b = sc.nextInt();
			if(b%10==0) {
				ans += b;
			}else {
				ans += (b/10+1)*10;
				rem = Math.min(rem,b-b/10*10);
			}
		}
		System.out.println((rem==10)?ans:ans-(10-rem));
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int ans = 0;
		int rem = 10;
		for (int i = 0; i < 5; i++) {
			int b = sc.nextInt();
			if(b%10==0) {
				ans += b;
			}else {
				ans += (b/10+1)*10;
				rem = Math.min(rem,b-b/10*10);
			}
		}
		System.out.println((rem==10)?ans:ans-(10-rem));
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int ans = 0;
		int rem = 10;
		for (int i = 0; i < 5; i++) {
			int b = sc.nextInt();
			if(b%10==0) {
				ans += b;
			}else {
				ans += (b/10+1)*10;
				rem = Math.min(rem,b-b/10*10);
			}
		}
		System.out.println((rem==10)?ans:ans-(10-rem));
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int ans = 0; ans 0 int rem = 10; rem 10 for (int i = 0; i < 5; i++) {
			int b = sc.nextInt();
			if(b%10==0) {
				ans += b;
			}else {
				ans += (b/10+1)*10;
				rem = Math.min(rem,b-b/10*10);
			}
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			int b = sc.nextInt();
			if(b%10==0) {
				ans += b;
			}else {
				ans += (b/10+1)*10;
				rem = Math.min(rem,b-b/10*10);
			}
		} {
			int b = sc.nextInt();
			if(b%10==0) {
				ans += b;
			}else {
				ans += (b/10+1)*10;
				rem = Math.min(rem,b-b/10*10);
			}
		} int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc if(b%10==0) {
				ans += b;
			}else {
				ans += (b/10+1)*10;
				rem = Math.min(rem,b-b/10*10);
			} b%10==0 b%10 b 10 0 {
				ans += b;
			} ans += b ans b {
				ans += (b/10+1)*10;
				rem = Math.min(rem,b-b/10*10);
			} ans += (b/10+1)*10 ans (b/10+1)*10 (b/10+1) b/10 b 10 1 10 rem = Math.min(rem,b-b/10*10) rem Math.min(rem,b-b/10*10) Math.min Math rem b-b/10*10 b b/10*10 b/10 b 10 10 System.out.println((rem==10)?ans:ans-(10-rem)) System.out.println System.out System System.out (rem==10)?ans:ans-(10-rem) (rem==10) rem 10 ans ans-(10-rem) ans (10-rem) 10 rem sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int ans = 0;
		int rem = 10;
		for (int i = 0; i < 5; i++) {
			int b = sc.nextInt();
			if(b%10==0) {
				ans += b;
			}else {
				ans += (b/10+1)*10;
				rem = Math.min(rem,b-b/10*10);
			}
		}
		System.out.println((rem==10)?ans:ans-(10-rem));
		sc.close();
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int ans = 0;
		int rem = 10;
		for (int i = 0; i < 5; i++) {
			int b = sc.nextInt();
			if(b%10==0) {
				ans += b;
			}else {
				ans += (b/10+1)*10;
				rem = Math.min(rem,b-b/10*10);
			}
		}
		System.out.println((rem==10)?ans:ans-(10-rem));
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int ans = 0;
		int rem = 10;
		for (int i = 0; i < 5; i++) {
			int b = sc.nextInt();
			if(b%10==0) {
				ans += b;
			}else {
				ans += (b/10+1)*10;
				rem = Math.min(rem,b-b/10*10);
			}
		}
		System.out.println((rem==10)?ans:ans-(10-rem));
		sc.close();
	}
}