import java.util.*;
import java.awt.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(in);
        int n=sc.nextInt();
        for (int i = 1; i <= 9; i++) {
            if(n<=111*i){
                out.println(111*i);
                break;
            }
        }
    }
} import java.util.*; util.* java import java.awt.*; awt.* java import static java.lang.System.*; import static java.lang.System.*; import static java.lang.System.*; import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(in);
        int n=sc.nextInt();
        for (int i = 1; i <= 9; i++) {
            if(n<=111*i){
                out.println(111*i);
                break;
            }
        }
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(in);
        int n=sc.nextInt();
        for (int i = 1; i <= 9; i++) {
            if(n<=111*i){
                out.println(111*i);
                break;
            }
        }
    } main {
        Scanner sc = new Scanner(in);
        int n=sc.nextInt();
        for (int i = 1; i <= 9; i++) {
            if(n<=111*i){
                out.println(111*i);
                break;
            }
        }
    } Scanner sc = new Scanner(in); sc new Scanner(in) int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc for (int i = 1; i <= 9; i++) {
            if(n<=111*i){
                out.println(111*i);
                break;
            }
        } int i = 1; int i = 1; i 1 i <= 9 i 9 i++ i++ i {
            if(n<=111*i){
                out.println(111*i);
                break;
            }
        } {
            if(n<=111*i){
                out.println(111*i);
                break;
            }
        } if(n<=111*i){
                out.println(111*i);
                break;
            } n<=111*i n 111*i 111 i {
                out.println(111*i);
                break;
            } out.println(111*i) out.println out 111*i 111 i break; String[] args args public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(in);
        int n=sc.nextInt();
        for (int i = 1; i <= 9; i++) {
            if(n<=111*i){
                out.println(111*i);
                break;
            }
        }
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(in);
        int n=sc.nextInt();
        for (int i = 1; i <= 9; i++) {
            if(n<=111*i){
                out.println(111*i);
                break;
            }
        }
    }
} Main
import java.util.*;
import java.awt.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(in);
        int n=sc.nextInt();
        for (int i = 1; i <= 9; i++) {
            if(n<=111*i){
                out.println(111*i);
                break;
            }
        }
    }
}