using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main()
    {
        //var N = int.Parse(ReadLine());
        var a = new int[5];
        for (int i = 0; i < 5; i++)
        {
            a[i] = int.Parse(ReadLine());
        }
       var b= a.ToList().OrderBy(x => (x-1) % 10).ToArray();
        var c = b[0] % 10;
        var ans = 0;
        for (int i = 0; i < 5; i++)
        {
            ans += (a[i] + 9) / 10*10;
        }
        ans +=-10+ c;
        WriteLine(ans);
    }
}
