using System;
using System.Linq;

public class Program {
    public static void Main(){
        // Your code here!
        var inputs = new OrderTime[5];
        
        for (var index = 0;index < 5;index++) {
            var input = int.Parse(Console.ReadLine());
            inputs[index] = new OrderTime {
                MakingTime = input,
                WaitingTime = (10 - (input % 10)) % 10, 
            };
        }
        
        var sum = 0;
        foreach (var input in inputs) {
            sum += input.MakingTime + input.WaitingTime;
        }
        
        var remain = inputs
            .Where(input => input.WaitingTime != 0)
            .OrderByDescending(input => input.WaitingTime)
            .FirstOrDefault();
        if (remain != null) {
            sum -= (10 - remain.WaitingTime);
        }
        
        Console.WriteLine(sum);
    }
}

public class OrderTime {
    public int MakingTime { get; set; }
    
    public int WaitingTime { get; set; }
}

