using System;
using System.Collections;

namespace test
{
    class test
    {
        static void Main(string[] args)
        {
            ArrayList al = new ArrayList();

            for(int i = 0; i <= 4; i++)
            {
                al.Add(Console.ReadLine());
            }

            int output = 0;
            int min = 9;
            foreach (object a in al)
            {
                string b = a.ToString();
                int hikaku = int.Parse(b.Substring(b.Length-1, 1));
                if (min > hikaku && hikaku != 0)
                {
                    min = int.Parse(b.Substring(b.Length-1, 1));
                }
                output += int.Parse(b);
                output = (output + 9) / 10 * 10;
            }
            output = output - 10 + min;
            Console.WriteLine(output);
        }
    }
}