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

class Bmondai
{
    static void Main()
    {
        var line = new List<int>();
        var min = int.MaxValue;
        var minIndex = 0;
        for (int i=0;i<5;++i)
        {
            var a = Int32.Parse(Console.ReadLine());
            line.Add(a);
            var ten = a % 10;
            if (ten !=0 && ten < min)
            {
                min = ten;
                minIndex = i;
            }
            if(ten != 0)
            {
                line[i] += (10 - ten);
            }
        }
        var ans = line.Sum()-(min!=0?10-min:0);
        Console.WriteLine(ans);
    }
}