namespace ABC123_B
{
    using System;
    using static System.Console;
    using System.Linq;
    using System.Collections.Generic;
    class Program
    {
        static void Main(string[] args)
        {
            var list = new List<int>();
            for (int i = 0; i < 5; i++)
            {
                list.Add(ReadInput());
            }

            list.Sort((a, b) => b % 10 - a % 10);

            var total = list
                .Select(
                (x, i) => i < 4 ? Math.Ceiling((decimal)x / 10) * 10 : x
                ).Sum();
            WriteLine(total);
        }
        static int ReadInput()
        {
            return int.Parse(ReadLine());
        }

    }

}