function main(input) {
  var N = input[0]-0;
  var ans = 0;
  for(var i=111;i<=999;i+=111){
    if(N<=i){
      ans=i;
      break;
    }
  }
  console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))
