n = gets.to_i
if n >= 100 && n <= 111
  p 111
elsif n >= 111 && n <= 222
  p 222
elsif n >= 223 && n <= 333
  p 333
elsif n >= 334 && n <= 444
  p 444
elsif n >= 445 && n <= 555
  p 555
elsif n >= 556 && n <= 666
  p 666
elsif n >= 667 && n <= 777
  p 777
elsif n >= 778 && n <= 888
  p 888
elsif n >= 889 && n <= 999
  p 999
end