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)
        {
            // 整数の入力
            int n = 5;
            int[] cookingTime = new int[n];
            int[] nextOrderTime = new int[n];
            for (int i = 0; i < n; i++)
            {
                cookingTime[i] = int.Parse(Console.ReadLine());
                nextOrderTime[i] = (cookingTime[i] + 9) / 10 * 10;
                //Console.WriteLine(cookingTime[i]+" "+nextOrderTime[i]);
            }
            int lastOrdersTime = 10;
            int lastOrder = n;
            for (int i = 0; i < n; i++)
            {
                if ((lastOrdersTime > cookingTime[i] % 10)&&(cookingTime[i] % 10!=0))
                {
                    lastOrdersTime = cookingTime[i] % 10;
                    lastOrder = i;
                }
            }
            int ans = 0;
            for (int i = 0; i < n; i++)
            {
                if (i != lastOrder)
                {
                    ans += nextOrderTime[i];
                }
            }
            ans += cookingTime[lastOrder];
            Console.WriteLine(ans);
        }
    }
}
