'use strict';
const main = input => {
  let n = parseInt(input[0]);
  while(Math.floor(n/100) != n%10 || Math.floor((n%100)/10) != n%10) n++;
  console.log(n);
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));