a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i

orders = [a,b,c,d,e].sort_by {|x|
    x1 = x % 10
    if x1 == 0
        x1 = 10
    end
    x1
}

last_order = orders.shift

total_time = last_order +  orders.reduce(0) {|acc, n| 
        n1 = n % 10
        c = 0
        if n1 != 0
            c = 10 - n1
        end
        acc = acc + n + c
        puts acc
        acc
    }

puts total_time
