import java.net.SecureCacheResponse;
import java.util.*;

public class Main {

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

        int res = 0;
        for (int i = n; i <= 999; i++) {
            if (i == 111 || i == 222 || i == 333 || i == 444 || i == 555
            || i == 666 || i == 777 || i == 888 || i == 999) {
                res = i;
                break;
            }
        }

        System.out.println(res);
    }
} import java.net.SecureCacheResponse; SecureCacheResponse java.net import java.util.*; util.* java public class Main {

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

        int res = 0;
        for (int i = n; i <= 999; i++) {
            if (i == 111 || i == 222 || i == 333 || i == 444 || i == 555
            || i == 666 || i == 777 || i == 888 || i == 999) {
                res = i;
                break;
            }
        }

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

        int res = 0;
        for (int i = n; i <= 999; i++) {
            if (i == 111 || i == 222 || i == 333 || i == 444 || i == 555
            || i == 666 || i == 777 || i == 888 || i == 999) {
                res = i;
                break;
            }
        }

        System.out.println(res);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int res = 0;
        for (int i = n; i <= 999; i++) {
            if (i == 111 || i == 222 || i == 333 || i == 444 || i == 555
            || i == 666 || i == 777 || i == 888 || i == 999) {
                res = i;
                break;
            }
        }

        System.out.println(res);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int res = 0; res 0 for (int i = n; i <= 999; i++) {
            if (i == 111 || i == 222 || i == 333 || i == 444 || i == 555
            || i == 666 || i == 777 || i == 888 || i == 999) {
                res = i;
                break;
            }
        } int i = n; int i = n; i n i <= 999 i 999 i++ i++ i {
            if (i == 111 || i == 222 || i == 333 || i == 444 || i == 555
            || i == 666 || i == 777 || i == 888 || i == 999) {
                res = i;
                break;
            }
        } {
            if (i == 111 || i == 222 || i == 333 || i == 444 || i == 555
            || i == 666 || i == 777 || i == 888 || i == 999) {
                res = i;
                break;
            }
        } if (i == 111 || i == 222 || i == 333 || i == 444 || i == 555
            || i == 666 || i == 777 || i == 888 || i == 999) {
                res = i;
                break;
            } i == 111 || i == 222 || i == 333 || i == 444 || i == 555
            || i == 666 || i == 777 || i == 888 || i == 999 i == 888 i == 777 i == 666 i == 555 i == 444 i == 333 i == 111 || i == 222 || i == 333 || i == 444 || i == 555
            || i == 666 || i == 777 || i == 888 || i == 999 i == 111 i 111 i == 222 i 222 i == 333 i 333 i == 444 i 444 i == 555 i 555 i == 666 i 666 i == 777 i 777 i == 888 i 888 i == 999 i 999 {
                res = i;
                break;
            } res = i res i break; System.out.println(res) System.out.println System.out System System.out res String[] args args public class Main {

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

        int res = 0;
        for (int i = n; i <= 999; i++) {
            if (i == 111 || i == 222 || i == 333 || i == 444 || i == 555
            || i == 666 || i == 777 || i == 888 || i == 999) {
                res = i;
                break;
            }
        }

        System.out.println(res);
    }
} public class Main {

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

        int res = 0;
        for (int i = n; i <= 999; i++) {
            if (i == 111 || i == 222 || i == 333 || i == 444 || i == 555
            || i == 666 || i == 777 || i == 888 || i == 999) {
                res = i;
                break;
            }
        }

        System.out.println(res);
    }
} Main
import java.net.SecureCacheResponse;
import java.util.*;

public class Main {

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

        int res = 0;
        for (int i = n; i <= 999; i++) {
            if (i == 111 || i == 222 || i == 333 || i == 444 || i == 555
            || i == 666 || i == 777 || i == 888 || i == 999) {
                res = i;
                break;
            }
        }

        System.out.println(res);
    }
}
