n = gets.to_i
arr = [111,222,333,444,555,666,777,888,999]

def what_number_take_part_in(n,arr)
  if n <= 111 ; puts "111" ; return ; end
  
  8.times.with_index do |i|
    if n > arr[i] && n <= arr[i+1] 
      puts arr[i+1]
      break
    end
  end
end

what_number_take_part_in(n,arr)
