A = 5.times.map{gets.to_i}

ans = 10**18
5.times do |i|
  c = 0
  5.times do |j|
    if i == j
      c += A[j]
    else
      c += (A[j] + 9) / 10 * 10
    end
  end
  ans = [ans, c].min
end
puts ans
