import java.util.*;

/**
 * Main
 */
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int ans = 0;
		int min = 10;
		int trg = 0;

		for (int i = 0; i < 5; i++) {
			int X = sc.nextInt();
			if ((X - 1) % 10 < min) {
				trg = X;
				min = (X - 1) % 10;
			}
			if (X % 10 == 0) {
				ans += X;
			} else {
				ans += (X / 10) * 10 + 10;
			}
		}

		if (trg % 10 == 0) {
			ans -= trg;
		} else {
			ans -= (trg / 10) * 10 + 10;
		}
		ans += trg;
		sc.close();

		System.out.println(ans);
	}
}; import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int ans = 0;
		int min = 10;
		int trg = 0;

		for (int i = 0; i < 5; i++) {
			int X = sc.nextInt();
			if ((X - 1) % 10 < min) {
				trg = X;
				min = (X - 1) % 10;
			}
			if (X % 10 == 0) {
				ans += X;
			} else {
				ans += (X / 10) * 10 + 10;
			}
		}

		if (trg % 10 == 0) {
			ans -= trg;
		} else {
			ans -= (trg / 10) * 10 + 10;
		}
		ans += trg;
		sc.close();

		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int ans = 0;
		int min = 10;
		int trg = 0;

		for (int i = 0; i < 5; i++) {
			int X = sc.nextInt();
			if ((X - 1) % 10 < min) {
				trg = X;
				min = (X - 1) % 10;
			}
			if (X % 10 == 0) {
				ans += X;
			} else {
				ans += (X / 10) * 10 + 10;
			}
		}

		if (trg % 10 == 0) {
			ans -= trg;
		} else {
			ans -= (trg / 10) * 10 + 10;
		}
		ans += trg;
		sc.close();

		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int ans = 0;
		int min = 10;
		int trg = 0;

		for (int i = 0; i < 5; i++) {
			int X = sc.nextInt();
			if ((X - 1) % 10 < min) {
				trg = X;
				min = (X - 1) % 10;
			}
			if (X % 10 == 0) {
				ans += X;
			} else {
				ans += (X / 10) * 10 + 10;
			}
		}

		if (trg % 10 == 0) {
			ans -= trg;
		} else {
			ans -= (trg / 10) * 10 + 10;
		}
		ans += trg;
		sc.close();

		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int ans = 0; ans 0 int min = 10; min 10 int trg = 0; trg 0 for (int i = 0; i < 5; i++) {
			int X = sc.nextInt();
			if ((X - 1) % 10 < min) {
				trg = X;
				min = (X - 1) % 10;
			}
			if (X % 10 == 0) {
				ans += X;
			} else {
				ans += (X / 10) * 10 + 10;
			}
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			int X = sc.nextInt();
			if ((X - 1) % 10 < min) {
				trg = X;
				min = (X - 1) % 10;
			}
			if (X % 10 == 0) {
				ans += X;
			} else {
				ans += (X / 10) * 10 + 10;
			}
		} {
			int X = sc.nextInt();
			if ((X - 1) % 10 < min) {
				trg = X;
				min = (X - 1) % 10;
			}
			if (X % 10 == 0) {
				ans += X;
			} else {
				ans += (X / 10) * 10 + 10;
			}
		} int X = sc.nextInt(); X sc.nextInt() sc.nextInt sc if ((X - 1) % 10 < min) {
				trg = X;
				min = (X - 1) % 10;
			} (X - 1) % 10 < min (X - 1) % 10 (X - 1) X 1 10 min {
				trg = X;
				min = (X - 1) % 10;
			} trg = X trg X min = (X - 1) % 10 min (X - 1) % 10 (X - 1) X 1 10 if (X % 10 == 0) {
				ans += X;
			} else {
				ans += (X / 10) * 10 + 10;
			} X % 10 == 0 X % 10 X 10 0 {
				ans += X;
			} ans += X ans X {
				ans += (X / 10) * 10 + 10;
			} ans += (X / 10) * 10 + 10 ans (X / 10) * 10 + 10 (X / 10) * 10 (X / 10) X 10 10 10 if (trg % 10 == 0) {
			ans -= trg;
		} else {
			ans -= (trg / 10) * 10 + 10;
		} trg % 10 == 0 trg % 10 trg 10 0 {
			ans -= trg;
		} ans -= trg ans trg {
			ans -= (trg / 10) * 10 + 10;
		} ans -= (trg / 10) * 10 + 10 ans (trg / 10) * 10 + 10 (trg / 10) * 10 (trg / 10) trg 10 10 10 ans += trg ans trg sc.close() sc.close sc 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 ans = 0;
		int min = 10;
		int trg = 0;

		for (int i = 0; i < 5; i++) {
			int X = sc.nextInt();
			if ((X - 1) % 10 < min) {
				trg = X;
				min = (X - 1) % 10;
			}
			if (X % 10 == 0) {
				ans += X;
			} else {
				ans += (X / 10) * 10 + 10;
			}
		}

		if (trg % 10 == 0) {
			ans -= trg;
		} else {
			ans -= (trg / 10) * 10 + 10;
		}
		ans += trg;
		sc.close();

		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int ans = 0;
		int min = 10;
		int trg = 0;

		for (int i = 0; i < 5; i++) {
			int X = sc.nextInt();
			if ((X - 1) % 10 < min) {
				trg = X;
				min = (X - 1) % 10;
			}
			if (X % 10 == 0) {
				ans += X;
			} else {
				ans += (X / 10) * 10 + 10;
			}
		}

		if (trg % 10 == 0) {
			ans -= trg;
		} else {
			ans -= (trg / 10) * 10 + 10;
		}
		ans += trg;
		sc.close();

		System.out.println(ans);
	}
} Main
import java.util.*;

/**
 * Main
 */
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int ans = 0;
		int min = 10;
		int trg = 0;

		for (int i = 0; i < 5; i++) {
			int X = sc.nextInt();
			if ((X - 1) % 10 < min) {
				trg = X;
				min = (X - 1) % 10;
			}
			if (X % 10 == 0) {
				ans += X;
			} else {
				ans += (X / 10) * 10 + 10;
			}
		}

		if (trg % 10 == 0) {
			ans -= trg;
		} else {
			ans -= (trg / 10) * 10 + 10;
		}
		ans += trg;
		sc.close();

		System.out.println(ans);
	}
};
