using System;
class Program
{
    static void Main(string[] args)
    {
        int[] a = new int[5];
        for (int i = 0; i < 5; i++)
        {
            a[i] = int.Parse(Console.ReadLine());
        }
        int cTime = 0;
        int min = int.MaxValue;
        int num = -1;
        for (int j = 0; j < 5; j++)
        {
            if (a[j] % 10 < min)
            {
                min = a[j] % 10;
                num = j;
            }
        }

        for (int i = 0; i < 5; i++)
        {
            if (i != num)
                cTime += a[i] + 10 - a[i] % 10;
        }
        cTime += a[num];
        Console.WriteLine(cTime);
    }
}