using System;
using System.Linq;

public class Program{
    public static void Main(){
        
        int[] dishes = new int[5];
        
        for(var i = 0; i < 5; i++){
            dishes[i] = int.Parse(Console.ReadLine());
        }
        
        var min = 0;
        
        for(var i = 1; i < 5; i++){
            if(dishes[min] % 11 > dishes[i] % 11){
                min = i;
            }
        }
        for(var i = 0; i < 5; i++){
            if(i != min){
                dishes[i] = (int)Math.Ceiling((double)dishes[i] / 10) * 10;
            }
        }
        
        Console.WriteLine("{0}", dishes.Sum());
    }
}