using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProconTemplate
{
    class Doing
    {
        public class Record
        {
            public int RawValue { get; set; }

            public int Fraction { get => RawValue % 10; }

            public int MaxTime
            { get
                {
                    if(Fraction == 0)
                    {
                        return RawValue;
                    }
                    else
                    {
                        return RawValue + (10 - Fraction);
                    }
                }
            }
        }


        public static void Main(string[] args)
        {
            var inList = new List<Record>();
            for (int iLoop = 0; iLoop < 5; iLoop++)
            {
                inList.Add(new Record() { RawValue = int.Parse(Console.ReadLine()) });
            }

            var max = inList.Sum(x => x.MaxTime);
            var lastList = inList.Where(x => x.Fraction != 0);
            if (!lastList.Any())
            {
                Console.WriteLine(max);
            }
            else
            {
                var last = lastList.OrderBy(x => x.Fraction).First();
                Console.WriteLine(max - last.MaxTime + last.RawValue);
            }
        }
    }
}
