using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using static System.Math;
class Program
{
    public static void Main(string[] args)
    {
        var v = Enumerable
            .Range(0, 5)
            .Select(_ => int.Parse(Console.ReadLine()))
            .Select(x => new { V = x, R = ((x + 9) / 10 * 10), A = (x % 10) == 0 ? 0 : (10 - x) })
            .ToLookup(x => x.A == 0);

        int i = 0;
        int sum = 0;
        foreach (var item in v[true])
        {
            sum += item.V;
            i++;
        }
        foreach (var item in v[false])
        {
            sum += (i == 4)
                ? item.V
                : item.R;
            i++;
        }

        Console.WriteLine(sum);
    }
}