a = []
5.times do
  a << gets.to_i
end

last_order = a.min_by {|n| n % 10 == 0 ? 10 : n % 10 }
remain = 10 - last_order % 10
remain = 0 if remain == 10

sum = a.reduce(0) {|result, n| result += ((n-1)/10 + 1) * 10}
puts sum - remain