a = Array.new(5)

5.times{ |i| a[i] = gets.to_i }

r = Array.new(5, 0)
b  = Array.new(5, 0)

# 5.times{ |i| r[i] = (a[i]).ceil(-1) - a[i] }

# r = a.map{ |k| k.ceil(-1) - k }
r = a.map{ |k| k%10 == 0 ? 0 : 10 - k%10 }
r.sort!
b = r[0, 4]

ans = a.inject(:+) + b.inject(:+)
puts ans

