import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int thrdDigit = Integer.parseInt(String.valueOf(n).substring(0, 1));
        int repdigit = thrdDigit * 100 + thrdDigit * 10 + thrdDigit;

        if (n <= repdigit) {
            System.out.println(repdigit);
            return;
        }
        int nextRepDigit = (thrdDigit + 1) * 100 + (thrdDigit + 1) * 10 + thrdDigit + 1;
        System.out.println(nextRepDigit);

    }

} 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 thrdDigit = Integer.parseInt(String.valueOf(n).substring(0, 1));
        int repdigit = thrdDigit * 100 + thrdDigit * 10 + thrdDigit;

        if (n <= repdigit) {
            System.out.println(repdigit);
            return;
        }
        int nextRepDigit = (thrdDigit + 1) * 100 + (thrdDigit + 1) * 10 + thrdDigit + 1;
        System.out.println(nextRepDigit);

    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int thrdDigit = Integer.parseInt(String.valueOf(n).substring(0, 1));
        int repdigit = thrdDigit * 100 + thrdDigit * 10 + thrdDigit;

        if (n <= repdigit) {
            System.out.println(repdigit);
            return;
        }
        int nextRepDigit = (thrdDigit + 1) * 100 + (thrdDigit + 1) * 10 + thrdDigit + 1;
        System.out.println(nextRepDigit);

    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int thrdDigit = Integer.parseInt(String.valueOf(n).substring(0, 1));
        int repdigit = thrdDigit * 100 + thrdDigit * 10 + thrdDigit;

        if (n <= repdigit) {
            System.out.println(repdigit);
            return;
        }
        int nextRepDigit = (thrdDigit + 1) * 100 + (thrdDigit + 1) * 10 + thrdDigit + 1;
        System.out.println(nextRepDigit);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int thrdDigit = Integer.parseInt(String.valueOf(n).substring(0, 1)); thrdDigit Integer.parseInt(String.valueOf(n).substring(0, 1)) Integer.parseInt Integer String.valueOf(n).substring(0, 1) String.valueOf(n).substring String.valueOf(n) String.valueOf String n 0 1 int repdigit = thrdDigit * 100 + thrdDigit * 10 + thrdDigit; repdigit thrdDigit * 100 + thrdDigit * 10 + thrdDigit thrdDigit * 100 + thrdDigit * 10 + thrdDigit thrdDigit * 100 thrdDigit 100 thrdDigit * 10 thrdDigit 10 thrdDigit if (n <= repdigit) {
            System.out.println(repdigit);
            return;
        } n <= repdigit n repdigit {
            System.out.println(repdigit);
            return;
        } System.out.println(repdigit) System.out.println System.out System System.out repdigit return; int nextRepDigit = (thrdDigit + 1) * 100 + (thrdDigit + 1) * 10 + thrdDigit + 1; nextRepDigit (thrdDigit + 1) * 100 + (thrdDigit + 1) * 10 + thrdDigit + 1 thrdDigit (thrdDigit + 1) * 100 + (thrdDigit + 1) * 10 + thrdDigit + 1 (thrdDigit + 1) * 100 (thrdDigit + 1) thrdDigit 1 100 (thrdDigit + 1) * 10 (thrdDigit + 1) thrdDigit 1 10 thrdDigit 1 System.out.println(nextRepDigit) System.out.println System.out System System.out nextRepDigit String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int thrdDigit = Integer.parseInt(String.valueOf(n).substring(0, 1));
        int repdigit = thrdDigit * 100 + thrdDigit * 10 + thrdDigit;

        if (n <= repdigit) {
            System.out.println(repdigit);
            return;
        }
        int nextRepDigit = (thrdDigit + 1) * 100 + (thrdDigit + 1) * 10 + thrdDigit + 1;
        System.out.println(nextRepDigit);

    }

} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int thrdDigit = Integer.parseInt(String.valueOf(n).substring(0, 1));
        int repdigit = thrdDigit * 100 + thrdDigit * 10 + thrdDigit;

        if (n <= repdigit) {
            System.out.println(repdigit);
            return;
        }
        int nextRepDigit = (thrdDigit + 1) * 100 + (thrdDigit + 1) * 10 + thrdDigit + 1;
        System.out.println(nextRepDigit);

    }

} 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 thrdDigit = Integer.parseInt(String.valueOf(n).substring(0, 1));
        int repdigit = thrdDigit * 100 + thrdDigit * 10 + thrdDigit;

        if (n <= repdigit) {
            System.out.println(repdigit);
            return;
        }
        int nextRepDigit = (thrdDigit + 1) * 100 + (thrdDigit + 1) * 10 + thrdDigit + 1;
        System.out.println(nextRepDigit);

    }

}
