using System;
using System.Collections.Generic;


public class B
{	
	public static void Main()
	{	
		long[] time = new long[5];
		for(int i = 0; i < 5; i++)
			time[i] = Int64.Parse(Console.ReadLine());
		
		long muda = 9;
		long result = 0;
		for(int i = 0; i < 5; i++)
		{
			if((time[i] % 10) == 0)
			{
				result += time[i];
			}
			else
			{
				result += ((time[i] + 10)/10)*10;
				muda = Math.Min(muda, time[i] % 10);
			}
		}
		
		result -= (10 - muda);			
		Console.WriteLine(result);
	}
}