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

class Program
{
    static void Main(string[] args)
    {        
        List<int> list = new List<int>();
        List<int> list2 = new List<int>();
        for (var i = 0; i < 5; i++) {
            var a = int.Parse(Console.ReadLine());
            if (a % 10 == 0) {
                list.Add(a);
            } else {
                list2.Add(a);
            }
        }
        
        list2 = list2.OrderByDescending(d => d % 10).ToList();
        
        var sum = 0;
        for (var i = 0; i < list.Count; i++) {
            sum += list[i];    
        }
        for (var i = 0; i < list2.Count - 1; i++) {
            sum += list2[i] + (10 - list2[i] % 10);
        }
        sum += list2.Last();

        Console.WriteLine(sum);
    }
}
