import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] abc = {111, 222, 333, 444, 555, 666, 777, 888, 999, 1111};
        for(int i=0; i<abc.length;i++){
            if(n <= abc[i]){
                System.out.println(abc[i]);
                return;
            }
        }
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] abc = {111, 222, 333, 444, 555, 666, 777, 888, 999, 1111};
        for(int i=0; i<abc.length;i++){
            if(n <= abc[i]){
                System.out.println(abc[i]);
                return;
            }
        }
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] abc = {111, 222, 333, 444, 555, 666, 777, 888, 999, 1111};
        for(int i=0; i<abc.length;i++){
            if(n <= abc[i]){
                System.out.println(abc[i]);
                return;
            }
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] abc = {111, 222, 333, 444, 555, 666, 777, 888, 999, 1111};
        for(int i=0; i<abc.length;i++){
            if(n <= abc[i]){
                System.out.println(abc[i]);
                return;
            }
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] abc = {111, 222, 333, 444, 555, 666, 777, 888, 999, 1111}; abc {111, 222, 333, 444, 555, 666, 777, 888, 999, 1111} 111 222 333 444 555 666 777 888 999 1111 for(int i=0; i<abc.length;i++){
            if(n <= abc[i]){
                System.out.println(abc[i]);
                return;
            }
        } int i=0; int i=0; i 0 i<abc.length i abc.length abc abc.length i++ i++ i {
            if(n <= abc[i]){
                System.out.println(abc[i]);
                return;
            }
        } {
            if(n <= abc[i]){
                System.out.println(abc[i]);
                return;
            }
        } if(n <= abc[i]){
                System.out.println(abc[i]);
                return;
            } n <= abc[i] n abc[i] abc i {
                System.out.println(abc[i]);
                return;
            } System.out.println(abc[i]) System.out.println System.out System System.out abc[i] abc i return; String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] abc = {111, 222, 333, 444, 555, 666, 777, 888, 999, 1111};
        for(int i=0; i<abc.length;i++){
            if(n <= abc[i]){
                System.out.println(abc[i]);
                return;
            }
        }
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] abc = {111, 222, 333, 444, 555, 666, 777, 888, 999, 1111};
        for(int i=0; i<abc.length;i++){
            if(n <= abc[i]){
                System.out.println(abc[i]);
                return;
            }
        }
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] abc = {111, 222, 333, 444, 555, 666, 777, 888, 999, 1111};
        for(int i=0; i<abc.length;i++){
            if(n <= abc[i]){
                System.out.println(abc[i]);
                return;
            }
        }
    }
}