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());
            }
            var nlist = _list.Where(x => x % 10 != 0).ToList();
            var tlist= _list.Where(x => x % 10 == 0).ToList();
            tlist.Sort((a, b) => a % 10 - b % 10);
            tlist.AddRange(nlist);
            var total = tlist
                .Select(
                (x, i) =>
                {
                    if (i < 4)
                    {
                        return x % 10 != 0 ? Math.Ceiling(x / 10.0) * 10 : x;
                    }
                    else
                    {
                        return x;
                    }
                }
                ).Sum();
            WriteLine(total);
        }
        static int ReadInput()
        {
            return int.Parse(ReadLine());
        }

    }

}