import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n  =sc.nextInt();

        int hoge = n / 100;
        int reNum = hoge + hoge * 10 + hoge * 100;
        if (reNum < n) {
            reNum += 111;
        }

        System.out.println(reNum);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n  =sc.nextInt();

        int hoge = n / 100;
        int reNum = hoge + hoge * 10 + hoge * 100;
        if (reNum < n) {
            reNum += 111;
        }

        System.out.println(reNum);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n  =sc.nextInt();

        int hoge = n / 100;
        int reNum = hoge + hoge * 10 + hoge * 100;
        if (reNum < n) {
            reNum += 111;
        }

        System.out.println(reNum);
    } main {
        Scanner sc = new Scanner(System.in);

        int n  =sc.nextInt();

        int hoge = n / 100;
        int reNum = hoge + hoge * 10 + hoge * 100;
        if (reNum < n) {
            reNum += 111;
        }

        System.out.println(reNum);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n  =sc.nextInt(); n sc.nextInt() sc.nextInt sc int hoge = n / 100; hoge n / 100 n 100 int reNum = hoge + hoge * 10 + hoge * 100; reNum hoge + hoge * 10 + hoge * 100 hoge + hoge * 10 + hoge * 100 hoge hoge * 10 hoge 10 hoge * 100 hoge 100 if (reNum < n) {
            reNum += 111;
        } reNum < n reNum n {
            reNum += 111;
        } reNum += 111 reNum 111 System.out.println(reNum) System.out.println System.out System System.out reNum String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n  =sc.nextInt();

        int hoge = n / 100;
        int reNum = hoge + hoge * 10 + hoge * 100;
        if (reNum < n) {
            reNum += 111;
        }

        System.out.println(reNum);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n  =sc.nextInt();

        int hoge = n / 100;
        int reNum = hoge + hoge * 10 + hoge * 100;
        if (reNum < n) {
            reNum += 111;
        }

        System.out.println(reNum);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n  =sc.nextInt();

        int hoge = n / 100;
        int reNum = hoge + hoge * 10 + hoge * 100;
        if (reNum < n) {
            reNum += 111;
        }

        System.out.println(reNum);
    }
}
