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

namespace ConsoleApp
{
    class Program
    {
        static int N = 0;
        static void Main(string[] args)
        {
            var a = new List<int>();
            for (int i = 0; i < 5; i++)
            {
                a.Add(int.Parse(Console.ReadLine()));
            }

            var sum = 0;

            for (int i = 0; i < a.Count; i++)
            {
                if (a[i] % 10 == 0)
                {
                    sum += a[i];
                    a.RemoveAt(i);
                    i--;
                }
            }

            var min = 9;
            var min1Index = -1;
            for (int i = 0; i < a.Count; i++)
            {
                var num1 = a[i] % 10;
                if (num1 < min)
                {
                    min = num1;
                    min1Index = i;
                }
            }

            sum += a[min1Index];
            a.RemoveAt(min1Index);

            while (a.Count > 0)
            {
                sum += a[0] + (10 - a[0] % 10);
                a.RemoveAt(0);
            }

            Console.WriteLine(sum);
        }
    }
}
