import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        int a = 111;
        for (int i=2; i<=10; i++){
            if (a >= n){
                System.out.println(a);
                return;
            }else{
                a = 111 * i;
            }
        }

    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        int a = 111;
        for (int i=2; i<=10; i++){
            if (a >= n){
                System.out.println(a);
                return;
            }else{
                a = 111 * i;
            }
        }

    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        int a = 111;
        for (int i=2; i<=10; i++){
            if (a >= n){
                System.out.println(a);
                return;
            }else{
                a = 111 * i;
            }
        }

    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        int a = 111;
        for (int i=2; i<=10; i++){
            if (a >= n){
                System.out.println(a);
                return;
            }else{
                a = 111 * i;
            }
        }

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int a = 111; a 111 for (int i=2; i<=10; i++){
            if (a >= n){
                System.out.println(a);
                return;
            }else{
                a = 111 * i;
            }
        } int i=2; int i=2; i 2 i<=10 i 10 i++ i++ i {
            if (a >= n){
                System.out.println(a);
                return;
            }else{
                a = 111 * i;
            }
        } {
            if (a >= n){
                System.out.println(a);
                return;
            }else{
                a = 111 * i;
            }
        } if (a >= n){
                System.out.println(a);
                return;
            }else{
                a = 111 * i;
            } a >= n a n {
                System.out.println(a);
                return;
            } System.out.println(a) System.out.println System.out System System.out a return; {
                a = 111 * i;
            } a = 111 * i a 111 * i 111 i String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        int a = 111;
        for (int i=2; i<=10; i++){
            if (a >= n){
                System.out.println(a);
                return;
            }else{
                a = 111 * i;
            }
        }

    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        int a = 111;
        for (int i=2; i<=10; i++){
            if (a >= n){
                System.out.println(a);
                return;
            }else{
                a = 111 * i;
            }
        }

    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        int a = 111;
        for (int i=2; i<=10; i++){
            if (a >= n){
                System.out.println(a);
                return;
            }else{
                a = 111 * i;
            }
        }

    }
}