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

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

			int min = 123;
			int temp = 0;

			for(int i = 0; i < 5; i++)
			{
				for(int j = 0; i < 5; i++)
				{
					if(i == j)
					{
						continue;
					}

					temp += time[j] + (time[j] % 10);
				}

				if(temp < min)
				{
					min = temp;
				}
			}

			Console.WriteLine(min);
		}
	}
}
