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();
            var roundSum = ABCDE.Select(x => Math.Ceiling((double)x / 10) * 10).Sum();
            var min = ABCDE.Select(x => x % 10).All(x => x == 0) ? 0 : ABCDE.Select(x => x % 10).Where(x => x != 0).Min();

            Console.WriteLine(roundSum + min - 10);
        }
    }
}
