import java.util.*;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int N = sc.nextInt();
        while (!isAllSame(N)) {
            N++;
        }

        System.out.println(N);
    }

    private static boolean isAllSame(int N) {
        String str = String.valueOf(N);
        char[] chars = str.toCharArray();

        char c = chars[0];
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] != c) return false;
        }
        return true;
    }

} import java.util.*; util.* java public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int N = sc.nextInt();
        while (!isAllSame(N)) {
            N++;
        }

        System.out.println(N);
    }

    private static boolean isAllSame(int N) {
        String str = String.valueOf(N);
        char[] chars = str.toCharArray();

        char c = chars[0];
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] != c) return false;
        }
        return true;
    }

} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
        int N = sc.nextInt();
        while (!isAllSame(N)) {
            N++;
        }

        System.out.println(N);
    } main {
        int N = sc.nextInt();
        while (!isAllSame(N)) {
            N++;
        }

        System.out.println(N);
    } int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc while (!isAllSame(N)) {
            N++;
        } !isAllSame(N) isAllSame(N) isAllSame N {
            N++;
        } N++ N System.out.println(N) System.out.println System.out System System.out N String[] args args private static boolean isAllSame(int N) {
        String str = String.valueOf(N);
        char[] chars = str.toCharArray();

        char c = chars[0];
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] != c) return false;
        }
        return true;
    } isAllSame {
        String str = String.valueOf(N);
        char[] chars = str.toCharArray();

        char c = chars[0];
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] != c) return false;
        }
        return true;
    } String str = String.valueOf(N); str String.valueOf(N) String.valueOf String N char[] chars = str.toCharArray(); chars str.toCharArray() str.toCharArray str char c = chars[0]; c chars[0] chars 0 for (int i = 0; i < chars.length; i++) {
            if (chars[i] != c) return false;
        } int i = 0; int i = 0; i 0 i < chars.length i chars.length chars chars.length i++ i++ i {
            if (chars[i] != c) return false;
        } {
            if (chars[i] != c) return false;
        } if (chars[i] != c) return false; chars[i] != c chars[i] chars i c return false; false return true; true int N N public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int N = sc.nextInt();
        while (!isAllSame(N)) {
            N++;
        }

        System.out.println(N);
    }

    private static boolean isAllSame(int N) {
        String str = String.valueOf(N);
        char[] chars = str.toCharArray();

        char c = chars[0];
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] != c) return false;
        }
        return true;
    }

} public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int N = sc.nextInt();
        while (!isAllSame(N)) {
            N++;
        }

        System.out.println(N);
    }

    private static boolean isAllSame(int N) {
        String str = String.valueOf(N);
        char[] chars = str.toCharArray();

        char c = chars[0];
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] != c) return false;
        }
        return true;
    }

} Main
import java.util.*;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int N = sc.nextInt();
        while (!isAllSame(N)) {
            N++;
        }

        System.out.println(N);
    }

    private static boolean isAllSame(int N) {
        String str = String.valueOf(N);
        char[] chars = str.toCharArray();

        char c = chars[0];
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] != c) return false;
        }
        return true;
    }

}