using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
	public class Program
	{
		static void Main(string[] args)
		{
			int[] dishes = new int[5];
			for (int i = 0; i < 5; i++) {
				dishes[i] = int.Parse(Console.ReadLine());
			}

			int ans = 0;
			int min = 0;
			for (int i = 0; i < 5; i++) {
				int m = dishes[i] % 10;
				ans += dishes[i];
				if (m > 0) {
					ans += 10 - m;
					if (min == 0 || min > m) {
						min = m;
					}
				}
			}
			ans = ans - (10 - min);

			Console.WriteLine(ans);
		}
	}
}