using System;
using System.Linq;
using System.Collections.Generic;
class c
{
    static void Main()
    {
        var list = new List<int>();
        var ans = 0;
        for (int i = 0; i < 5; i++) list.Add(int.Parse(Console.ReadLine()));
        list = list.OrderBy(f => f % 10).ToList();
        Console.WriteLine(list.Where((f, g) => g != 4).Sum(f => (f - 1) / 10 * 10 + 10) + list.Last());
    }
}
