import java.util.Scanner;

/**
 * ABC111B
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        for (int i = 1; i <= 9; i++) {
            if ((N / (i * 111) == 1 && N % (i * 111) == 0) || (N / (i * 111) == 0)) {
                System.out.println(i * 111);
                break;
            }
        }

        sc.close();
    }
} 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();

        for (int i = 1; i <= 9; i++) {
            if ((N / (i * 111) == 1 && N % (i * 111) == 0) || (N / (i * 111) == 0)) {
                System.out.println(i * 111);
                break;
            }
        }

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

        for (int i = 1; i <= 9; i++) {
            if ((N / (i * 111) == 1 && N % (i * 111) == 0) || (N / (i * 111) == 0)) {
                System.out.println(i * 111);
                break;
            }
        }

        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        for (int i = 1; i <= 9; i++) {
            if ((N / (i * 111) == 1 && N % (i * 111) == 0) || (N / (i * 111) == 0)) {
                System.out.println(i * 111);
                break;
            }
        }

        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc for (int i = 1; i <= 9; i++) {
            if ((N / (i * 111) == 1 && N % (i * 111) == 0) || (N / (i * 111) == 0)) {
                System.out.println(i * 111);
                break;
            }
        } int i = 1; int i = 1; i 1 i <= 9 i 9 i++ i++ i {
            if ((N / (i * 111) == 1 && N % (i * 111) == 0) || (N / (i * 111) == 0)) {
                System.out.println(i * 111);
                break;
            }
        } {
            if ((N / (i * 111) == 1 && N % (i * 111) == 0) || (N / (i * 111) == 0)) {
                System.out.println(i * 111);
                break;
            }
        } if ((N / (i * 111) == 1 && N % (i * 111) == 0) || (N / (i * 111) == 0)) {
                System.out.println(i * 111);
                break;
            } (N / (i * 111) == 1 && N % (i * 111) == 0) || (N / (i * 111) == 0) (N / (i * 111) == 1 && N % (i * 111) == 0) N / (i * 111) == 1 N / (i * 111) N (i * 111) i 111 1 N % (i * 111) == 0 N % (i * 111) N (i * 111) i 111 0 (N / (i * 111) == 0) N / (i * 111) N (i * 111) i 111 0 {
                System.out.println(i * 111);
                break;
            } System.out.println(i * 111) System.out.println System.out System System.out i * 111 i 111 break; sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        for (int i = 1; i <= 9; i++) {
            if ((N / (i * 111) == 1 && N % (i * 111) == 0) || (N / (i * 111) == 0)) {
                System.out.println(i * 111);
                break;
            }
        }

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

        for (int i = 1; i <= 9; i++) {
            if ((N / (i * 111) == 1 && N % (i * 111) == 0) || (N / (i * 111) == 0)) {
                System.out.println(i * 111);
                break;
            }
        }

        sc.close();
    }
} Main
import java.util.Scanner;

/**
 * ABC111B
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        for (int i = 1; i <= 9; i++) {
            if ((N / (i * 111) == 1 && N % (i * 111) == 0) || (N / (i * 111) == 0)) {
                System.out.println(i * 111);
                break;
            }
        }

        sc.close();
    }
}