import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int result = 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 ){
                result = i;
                break;
            }
        }
        System.out.print(result);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int result = 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 ){
                result = i;
                break;
            }
        }
        System.out.print(result);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int result = 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 ){
                result = i;
                break;
            }
        }
        System.out.print(result);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int result = 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 ){
                result = i;
                break;
            }
        }
        System.out.print(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int result = 0; result 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 ){
                result = 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 ){
                result = i;
                break;
            }
        } {
            if(i == 111 || i == 222 || i == 333 || i == 444 || i == 555 || i == 666 || i == 777 || i == 888 || i == 999 ){
                result = i;
                break;
            }
        } if(i == 111 || i == 222 || i == 333 || i == 444 || i == 555 || i == 666 || i == 777 || i == 888 || i == 999 ){
                result = 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 {
                result = i;
                break;
            } result = i result i break; System.out.print(result) System.out.print System.out System System.out result String[] args args public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int result = 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 ){
                result = i;
                break;
            }
        }
        System.out.print(result);
    }
} public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int result = 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 ){
                result = i;
                break;
            }
        }
        System.out.print(result);
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int result = 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 ){
                result = i;
                break;
            }
        }
        System.out.print(result);
    }
}