using System;

namespace AtCoderABC123B
{
    class Program
    {
        static void Main(string[] args)
        {
            double[] dishTime = new double[5];
            for(int i = 0; i < 5; i++) { 
                string[] line = Console.ReadLine().Split(' ');
                dishTime[i] = double.Parse(line[0]);
            }
            double sum = 0;
            double min = 123;
            foreach(double i in dishTime) {
                sum += Math.Ceiling(i/10) * 10;
                if(min>((Math.Ceiling(i/10) * 10)-i))
                {
                    min = Math.Ceiling(i/10) * 10 - i;
                }
            }
            Console.Write((int)sum - min);
        }
    }
}
