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

namespace atcorder_BeginnerContest_123
{
    class Program
    {

        static void Main(string[] args)
        {

            int[] pointArr = new int[5];
            int lastIdx = 0;
            int lastVal = 0;
            int minLen = 10;

            for (int i = 0; i < 5; i++)
            {
                pointArr[i] = int.Parse(Console.ReadLine());
                int modVal = pointArr[i] % 10;
                if ((0 != modVal) &&(modVal < minLen))
                {
                    minLen = modVal;
                    lastVal = pointArr[i];
                    lastIdx = i;
                }

                if (0 < modVal)
                {
                    pointArr[i] += 10 - modVal;
                }

            }

            int ret = 0;
            for(int i = 0; i < 5; i++)
            {
                if (i != lastIdx)
                {
                    ret += pointArr[i];
                }
                else
                {
                    ret += lastVal;
                }
            }

            Console.WriteLine(ret);

        }

    }
}

