using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
class FiveAntennas
{
    static void Main(string[] args)
    {
        var cook = new int[5];
        for (int i = 0; i < 5; i++)
        {
            cook[i] = int.Parse(Console.ReadLine());
        }

        var one = cook.Select(a => a % 10).Select(a => a + 1).ToList();
        var minIndex = one.IndexOf(one.Min());

        for (int i = 0; i < 5; i++)
        {
            if (i != minIndex)
            {
                cook[i] = (int)Math.Ceiling((double)cook[i] / 10) * 10;
            }
        }
        Console.WriteLine(cook.Sum());
    }
}