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) {
        String s = String.valueOf(x);
        for (int i = 1; i < s.length(); i++) {
            if (s.charAt(i) != s.charAt(0)) return false;
        }
        return true;
    }
} 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) {
        String s = String.valueOf(x);
        for (int i = 1; i < s.length(); i++) {
            if (s.charAt(i) != s.charAt(0)) return false;
        }
        return true;
    }
} 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) {
        String s = String.valueOf(x);
        for (int i = 1; i < s.length(); i++) {
            if (s.charAt(i) != s.charAt(0)) return false;
        }
        return true;
    } ok {
        String s = String.valueOf(x);
        for (int i = 1; i < s.length(); i++) {
            if (s.charAt(i) != s.charAt(0)) return false;
        }
        return true;
    } String s = String.valueOf(x); s String.valueOf(x) String.valueOf String x for (int i = 1; i < s.length(); i++) {
            if (s.charAt(i) != s.charAt(0)) return false;
        } int i = 1; int i = 1; i 1 i < s.length() i s.length() s.length s i++ i++ i {
            if (s.charAt(i) != s.charAt(0)) return false;
        } {
            if (s.charAt(i) != s.charAt(0)) return false;
        } if (s.charAt(i) != s.charAt(0)) return false; s.charAt(i) != s.charAt(0) s.charAt(i) s.charAt s i s.charAt(0) s.charAt s 0 return false; false return true; true 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) {
        String s = String.valueOf(x);
        for (int i = 1; i < s.length(); i++) {
            if (s.charAt(i) != s.charAt(0)) return false;
        }
        return true;
    }
} 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) {
        String s = String.valueOf(x);
        for (int i = 1; i < s.length(); i++) {
            if (s.charAt(i) != s.charAt(0)) return false;
        }
        return true;
    }
} 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) {
        String s = String.valueOf(x);
        for (int i = 1; i < s.length(); i++) {
            if (s.charAt(i) != s.charAt(0)) return false;
        }
        return true;
    }
}