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

sum = [a, b, c, d, e].map do |n|
  x = n / 10
  y = n % 10
  (y == 0 ? x : x + 1) * 10
end.reduce(&:+)
min = [a, b, c, d, e].map do |n|
  n % 10
end.min_by { |n| n == 0 ? 10 : n }
ans = sum - (min == 10 ? 0 : 10 - min)
puts ans
