n = gets.to_i
if n <= 111
  p 111
elsif n <= 222
  p 222
elsif n <= 333
  p 333
elsif n <= 444
  p 444
elsif n <= 555
  p 555
elsif n <= 666
  p 666
elsif n <= 777
  p 777
elsif n <= 888
  p 888
elsif n <= 999
  p 999
end