N = gets.chomp.to_i
contests=[0, 111,222,333,444,555,666,777,888,999,1000]

(contests.size()-1).times do |num|
  if (contests[num]..contests[num+1]).include?(N)
    print("#{contests[num+1]}")
    exit
  end
end
