import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.close();

        for (int i = 1; i <= 9; i++) {
            int target = i * 111;
            if (n <= target) {
                System.out.println(target);
                break;
            }
        }
    }

} 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();
        sc.close();

        for (int i = 1; i <= 9; i++) {
            int target = i * 111;
            if (n <= target) {
                System.out.println(target);
                break;
            }
        }
    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.close();

        for (int i = 1; i <= 9; i++) {
            int target = i * 111;
            if (n <= target) {
                System.out.println(target);
                break;
            }
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.close();

        for (int i = 1; i <= 9; i++) {
            int target = i * 111;
            if (n <= target) {
                System.out.println(target);
                break;
            }
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc sc.close() sc.close sc for (int i = 1; i <= 9; i++) {
            int target = i * 111;
            if (n <= target) {
                System.out.println(target);
                break;
            }
        } int i = 1; int i = 1; i 1 i <= 9 i 9 i++ i++ i {
            int target = i * 111;
            if (n <= target) {
                System.out.println(target);
                break;
            }
        } {
            int target = i * 111;
            if (n <= target) {
                System.out.println(target);
                break;
            }
        } int target = i * 111; target i * 111 i 111 if (n <= target) {
                System.out.println(target);
                break;
            } n <= target n target {
                System.out.println(target);
                break;
            } System.out.println(target) System.out.println System.out System System.out target break; String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.close();

        for (int i = 1; i <= 9; i++) {
            int target = i * 111;
            if (n <= target) {
                System.out.println(target);
                break;
            }
        }
    }

} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.close();

        for (int i = 1; i <= 9; i++) {
            int target = i * 111;
            if (n <= target) {
                System.out.println(target);
                break;
            }
        }
    }

} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.close();

        for (int i = 1; i <= 9; i++) {
            int target = i * 111;
            if (n <= target) {
                System.out.println(target);
                break;
            }
        }
    }

}
