
namespace AtCorder_B
{
    class Program
    {
        static void Main(string[] args)
        {

            var input = Enumerable.Range(0, 5).Select(i => Console.ReadLine()).Select(x => int.Parse(x)).ToArray();
            var xxx = input.OrderBy(x => (x + 9) % 10);
            var last = xxx.First();
            var total = xxx.Skip(1).Select(x => ((x + 9) / 10) * 10).Sum() + last;
            Console.WriteLine(total);
        }
    }
}
