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

arr = [a,b,c,d,e]

sum = 0
m = 10
arr.each do |i|
  sum += (i+9) / 10 * 10
  t = i % 10
  t += 10 if t == 0
  m = [m,t].min
end

if m == 10
  puts sum
else
  puts sum - 10 + m
end