import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int a = scanner.nextInt(); //次に開催されるabcの回数
        int hoge;

        while(!isRepDigit(a)){
            a++;
        }
        hoge =a;

        out.println(hoge);
        out.flush();
    }

    private static boolean isRepDigit(int num){
        String str = String.valueOf(num);
        int len = str.length();
        boolean ret = true;
        for(int n = 0; n < len-1; n++) {
            if(str.charAt(n)!=str.charAt(n+1)){
                ret =false;
            }
        }
        return ret;
    }

} import java.io.PrintWriter; PrintWriter java.io import java.util.*; util.* java public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int a = scanner.nextInt(); //次に開催されるabcの回数
        int hoge;

        while(!isRepDigit(a)){
            a++;
        }
        hoge =a;

        out.println(hoge);
        out.flush();
    }

    private static boolean isRepDigit(int num){
        String str = String.valueOf(num);
        int len = str.length();
        boolean ret = true;
        for(int n = 0; n < len-1; n++) {
            if(str.charAt(n)!=str.charAt(n+1)){
                ret =false;
            }
        }
        return ret;
    }

} Main public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int a = scanner.nextInt(); //次に開催されるabcの回数
        int hoge;

        while(!isRepDigit(a)){
            a++;
        }
        hoge =a;

        out.println(hoge);
        out.flush();
    } main {

        Scanner scanner = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int a = scanner.nextInt(); //次に開催されるabcの回数
        int hoge;

        while(!isRepDigit(a)){
            a++;
        }
        hoge =a;

        out.println(hoge);
        out.flush();
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner int hoge; hoge while(!isRepDigit(a)){
            a++;
        } !isRepDigit(a) isRepDigit(a) isRepDigit a {
            a++;
        } a++ a hoge =a hoge a out.println(hoge) out.println out hoge out.flush() out.flush out String[] args args private static boolean isRepDigit(int num){
        String str = String.valueOf(num);
        int len = str.length();
        boolean ret = true;
        for(int n = 0; n < len-1; n++) {
            if(str.charAt(n)!=str.charAt(n+1)){
                ret =false;
            }
        }
        return ret;
    } isRepDigit {
        String str = String.valueOf(num);
        int len = str.length();
        boolean ret = true;
        for(int n = 0; n < len-1; n++) {
            if(str.charAt(n)!=str.charAt(n+1)){
                ret =false;
            }
        }
        return ret;
    } String str = String.valueOf(num); str String.valueOf(num) String.valueOf String num int len = str.length(); len str.length() str.length str boolean ret = true; ret true for(int n = 0; n < len-1; n++) {
            if(str.charAt(n)!=str.charAt(n+1)){
                ret =false;
            }
        } int n = 0; int n = 0; n 0 n < len-1 n len-1 len 1 n++ n++ n {
            if(str.charAt(n)!=str.charAt(n+1)){
                ret =false;
            }
        } {
            if(str.charAt(n)!=str.charAt(n+1)){
                ret =false;
            }
        } if(str.charAt(n)!=str.charAt(n+1)){
                ret =false;
            } str.charAt(n)!=str.charAt(n+1) str.charAt(n) str.charAt str n str.charAt(n+1) str.charAt str n+1 n 1 {
                ret =false;
            } ret =false ret false return ret; ret int num num public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int a = scanner.nextInt(); //次に開催されるabcの回数
        int hoge;

        while(!isRepDigit(a)){
            a++;
        }
        hoge =a;

        out.println(hoge);
        out.flush();
    }

    private static boolean isRepDigit(int num){
        String str = String.valueOf(num);
        int len = str.length();
        boolean ret = true;
        for(int n = 0; n < len-1; n++) {
            if(str.charAt(n)!=str.charAt(n+1)){
                ret =false;
            }
        }
        return ret;
    }

} public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int a = scanner.nextInt(); //次に開催されるabcの回数
        int hoge;

        while(!isRepDigit(a)){
            a++;
        }
        hoge =a;

        out.println(hoge);
        out.flush();
    }

    private static boolean isRepDigit(int num){
        String str = String.valueOf(num);
        int len = str.length();
        boolean ret = true;
        for(int n = 0; n < len-1; n++) {
            if(str.charAt(n)!=str.charAt(n+1)){
                ret =false;
            }
        }
        return ret;
    }

} Main
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int a = scanner.nextInt(); //次に開催されるabcの回数
        int hoge;

        while(!isRepDigit(a)){
            a++;
        }
        hoge =a;

        out.println(hoge);
        out.flush();
    }

    private static boolean isRepDigit(int num){
        String str = String.valueOf(num);
        int len = str.length();
        boolean ret = true;
        for(int n = 0; n < len-1; n++) {
            if(str.charAt(n)!=str.charAt(n+1)){
                ret =false;
            }
        }
        return ret;
    }

}
