using System;
using System.Linq;

namespace B___Five_Dishes
{
    class Program
    {
        static void Main(string[] args)
        {
            var ABCDE = new int[5].Select(_ => int.Parse(Console.ReadLine())).ToList();

            Console.WriteLine(ABCDE.Select(x => Math.Ceiling((double)x / 10) * 10).Sum() + ABCDE.Select(x => x % 10).Where(x => x!= 0).Min() - 10);
        }
    }
}
