import java.util.*;
public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        while (true) {
            if (ok(n)) {
                System.out.println(n);
                return;
            }
            n++;
        }
    }
    public static boolean ok(int x) {
        boolean ret = true;
        int r = x % 10;
        while (x / 10 > 0) {
            x /= 10;
            if (x % 10 != r) ret = false;
            else r = x % 10;
        }
        return ret;
    }
} import java.util.*; util.* java public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        while (true) {
            if (ok(n)) {
                System.out.println(n);
                return;
            }
            n++;
        }
    }
    public static boolean ok(int x) {
        boolean ret = true;
        int r = x % 10;
        while (x / 10 > 0) {
            x /= 10;
            if (x % 10 != r) ret = false;
            else r = x % 10;
        }
        return ret;
    }
} Main public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        while (true) {
            if (ok(n)) {
                System.out.println(n);
                return;
            }
            n++;
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        while (true) {
            if (ok(n)) {
                System.out.println(n);
                return;
            }
            n++;
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc while (true) {
            if (ok(n)) {
                System.out.println(n);
                return;
            }
            n++;
        } true {
            if (ok(n)) {
                System.out.println(n);
                return;
            }
            n++;
        } if (ok(n)) {
                System.out.println(n);
                return;
            } ok(n) ok n {
                System.out.println(n);
                return;
            } System.out.println(n) System.out.println System.out System System.out n return; n++ n String args[] args public static boolean ok(int x) {
        boolean ret = true;
        int r = x % 10;
        while (x / 10 > 0) {
            x /= 10;
            if (x % 10 != r) ret = false;
            else r = x % 10;
        }
        return ret;
    } ok {
        boolean ret = true;
        int r = x % 10;
        while (x / 10 > 0) {
            x /= 10;
            if (x % 10 != r) ret = false;
            else r = x % 10;
        }
        return ret;
    } boolean ret = true; ret true int r = x % 10; r x % 10 x 10 while (x / 10 > 0) {
            x /= 10;
            if (x % 10 != r) ret = false;
            else r = x % 10;
        } x / 10 > 0 x / 10 x 10 0 {
            x /= 10;
            if (x % 10 != r) ret = false;
            else r = x % 10;
        } x /= 10 x 10 if (x % 10 != r) ret = false;
            else r = x % 10; x % 10 != r x % 10 x 10 r ret = false ret false r = x % 10 r x % 10 x 10 return ret; ret int x x public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        while (true) {
            if (ok(n)) {
                System.out.println(n);
                return;
            }
            n++;
        }
    }
    public static boolean ok(int x) {
        boolean ret = true;
        int r = x % 10;
        while (x / 10 > 0) {
            x /= 10;
            if (x % 10 != r) ret = false;
            else r = x % 10;
        }
        return ret;
    }
} public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        while (true) {
            if (ok(n)) {
                System.out.println(n);
                return;
            }
            n++;
        }
    }
    public static boolean ok(int x) {
        boolean ret = true;
        int r = x % 10;
        while (x / 10 > 0) {
            x /= 10;
            if (x % 10 != r) ret = false;
            else r = x % 10;
        }
        return ret;
    }
} Main
import java.util.*;
public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        while (true) {
            if (ok(n)) {
                System.out.println(n);
                return;
            }
            n++;
        }
    }
    public static boolean ok(int x) {
        boolean ret = true;
        int r = x % 10;
        while (x / 10 > 0) {
            x /= 10;
            if (x % 10 != r) ret = false;
            else r = x % 10;
        }
        return ret;
    }
}