"use strict";
function Main(input) {
    let N = input.split("\n")[0] - 0;
    const d = (v) => v * 100 + v * 10 + v;
    for (let n = 1; n <= 9; n++) {
        let ans = d(n);
        if (ans >= N) {
            console.log(ans);
            return;
        };
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
