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

namespace abc123B
{
    class Program
    {
        static void Main(string[] args)
        {
            double max = 0;
            double[] a = new double[5];
            for (int i = 0; i<=4;i++)
            {
               a[i] = Convert.ToInt16(Console.ReadLine());
               if ((a[i]-1)%10<10-max )
                {
                    max = 10 - a[i] % 10;
                }
                a[i] = Math.Ceiling(a[i] / 10) * 10;
            }

            Console.WriteLine(a[0] +a[1]+a[2]+a[3]+a[4]-max);
            Console.ReadKey();
        }
    }
}
