using System;
using System.Linq;

namespace B___Five_Dishes
{
    class Program
    {
        static void Main(string[] args)
        {
            var dishes = new int[5];
            dishes[0] = int.Parse(Console.ReadLine());
            dishes[1] = int.Parse(Console.ReadLine());
            dishes[2] = int.Parse(Console.ReadLine());
            dishes[3] = int.Parse(Console.ReadLine());
            dishes[4] = int.Parse(Console.ReadLine());

            var provideDishes = dishes.Select(x => x % 10).Where(x => x>0);

            int lastDish;
            if(provideDishes.Any())
            {
                lastDish = provideDishes.Min();
            }else
            {
                lastDish = 10;
            }

            var time = dishes.Select(s => (int)(Math.Ceiling((decimal)s/10)*10)).Sum() - 10 + (lastDish%10);

            Console.WriteLine(time);
        }
    }
}
