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

class Program
{
    static void Main()
    {
        List<int> wait = new List<int>();
        int ans = 0;
        for (int i = 0; i < 5; i++)
        {
            int cin = int.Parse(Console.ReadLine());
            ans += cin;
            if (cin % 10 != 0)
            {
                ans += 10 - cin % 10;
                wait.Add(10 - cin % 10);
            }
        }
        Console.WriteLine(ans - wait.Max());
    }
}