import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int S = getInt(sc.nextLine());
      
        if(S <= 111){
          println("111");
          return;
        }else if(S <= 222){
          println("222");
          return;
        }else if(S <= 333){
          println("333");
          return;
        }else if(S <= 444){
          println("444");
          return;
        }else if(S <= 555){
          println("555");
          return;
        }else if(S <= 666){
          println("666");
          return;
        }else if(S <= 777){
          println("777");
          return;
        }else if(S <= 888){
          println("888");
          return;
        }else{
          println(999);
          return;
        }
        
    }
    static long getLong(String val) {return Long.parseLong(val);}
    static int getInt(String val) {
        return Integer.parseInt(val);
    }

    static void println(String val){System.out.println(val);};
    static void println(int val){System.out.println(val);};
    static void println(long val){System.out.println(val);};
    static void println(Object val){System.out.println(val);};
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int S = getInt(sc.nextLine());
      
        if(S <= 111){
          println("111");
          return;
        }else if(S <= 222){
          println("222");
          return;
        }else if(S <= 333){
          println("333");
          return;
        }else if(S <= 444){
          println("444");
          return;
        }else if(S <= 555){
          println("555");
          return;
        }else if(S <= 666){
          println("666");
          return;
        }else if(S <= 777){
          println("777");
          return;
        }else if(S <= 888){
          println("888");
          return;
        }else{
          println(999);
          return;
        }
        
    }
    static long getLong(String val) {return Long.parseLong(val);}
    static int getInt(String val) {
        return Integer.parseInt(val);
    }

    static void println(String val){System.out.println(val);};
    static void println(int val){System.out.println(val);};
    static void println(long val){System.out.println(val);};
    static void println(Object val){System.out.println(val);};
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int S = getInt(sc.nextLine());
      
        if(S <= 111){
          println("111");
          return;
        }else if(S <= 222){
          println("222");
          return;
        }else if(S <= 333){
          println("333");
          return;
        }else if(S <= 444){
          println("444");
          return;
        }else if(S <= 555){
          println("555");
          return;
        }else if(S <= 666){
          println("666");
          return;
        }else if(S <= 777){
          println("777");
          return;
        }else if(S <= 888){
          println("888");
          return;
        }else{
          println(999);
          return;
        }
        
    } main {
        Scanner sc = new Scanner(System.in);
        int S = getInt(sc.nextLine());
      
        if(S <= 111){
          println("111");
          return;
        }else if(S <= 222){
          println("222");
          return;
        }else if(S <= 333){
          println("333");
          return;
        }else if(S <= 444){
          println("444");
          return;
        }else if(S <= 555){
          println("555");
          return;
        }else if(S <= 666){
          println("666");
          return;
        }else if(S <= 777){
          println("777");
          return;
        }else if(S <= 888){
          println("888");
          return;
        }else{
          println(999);
          return;
        }
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int S = getInt(sc.nextLine()); S getInt(sc.nextLine()) getInt sc.nextLine() sc.nextLine sc if(S <= 111){
          println("111");
          return;
        }else if(S <= 222){
          println("222");
          return;
        }else if(S <= 333){
          println("333");
          return;
        }else if(S <= 444){
          println("444");
          return;
        }else if(S <= 555){
          println("555");
          return;
        }else if(S <= 666){
          println("666");
          return;
        }else if(S <= 777){
          println("777");
          return;
        }else if(S <= 888){
          println("888");
          return;
        }else{
          println(999);
          return;
        } S <= 111 S 111 {
          println("111");
          return;
        } println("111") println "111" return; if(S <= 222){
          println("222");
          return;
        }else if(S <= 333){
          println("333");
          return;
        }else if(S <= 444){
          println("444");
          return;
        }else if(S <= 555){
          println("555");
          return;
        }else if(S <= 666){
          println("666");
          return;
        }else if(S <= 777){
          println("777");
          return;
        }else if(S <= 888){
          println("888");
          return;
        }else{
          println(999);
          return;
        } S <= 222 S 222 {
          println("222");
          return;
        } println("222") println "222" return; if(S <= 333){
          println("333");
          return;
        }else if(S <= 444){
          println("444");
          return;
        }else if(S <= 555){
          println("555");
          return;
        }else if(S <= 666){
          println("666");
          return;
        }else if(S <= 777){
          println("777");
          return;
        }else if(S <= 888){
          println("888");
          return;
        }else{
          println(999);
          return;
        } S <= 333 S 333 {
          println("333");
          return;
        } println("333") println "333" return; if(S <= 444){
          println("444");
          return;
        }else if(S <= 555){
          println("555");
          return;
        }else if(S <= 666){
          println("666");
          return;
        }else if(S <= 777){
          println("777");
          return;
        }else if(S <= 888){
          println("888");
          return;
        }else{
          println(999);
          return;
        } S <= 444 S 444 {
          println("444");
          return;
        } println("444") println "444" return; if(S <= 555){
          println("555");
          return;
        }else if(S <= 666){
          println("666");
          return;
        }else if(S <= 777){
          println("777");
          return;
        }else if(S <= 888){
          println("888");
          return;
        }else{
          println(999);
          return;
        } S <= 555 S 555 {
          println("555");
          return;
        } println("555") println "555" return; if(S <= 666){
          println("666");
          return;
        }else if(S <= 777){
          println("777");
          return;
        }else if(S <= 888){
          println("888");
          return;
        }else{
          println(999);
          return;
        } S <= 666 S 666 {
          println("666");
          return;
        } println("666") println "666" return; if(S <= 777){
          println("777");
          return;
        }else if(S <= 888){
          println("888");
          return;
        }else{
          println(999);
          return;
        } S <= 777 S 777 {
          println("777");
          return;
        } println("777") println "777" return; if(S <= 888){
          println("888");
          return;
        }else{
          println(999);
          return;
        } S <= 888 S 888 {
          println("888");
          return;
        } println("888") println "888" return; {
          println(999);
          return;
        } println(999) println 999 return; String[] args args static long getLong(String val) {return Long.parseLong(val);} getLong {return Long.parseLong(val);} return Long.parseLong(val); Long.parseLong(val) Long.parseLong Long val String val val static int getInt(String val) {
        return Integer.parseInt(val);
    } getInt {
        return Integer.parseInt(val);
    } return Integer.parseInt(val); Integer.parseInt(val) Integer.parseInt Integer val String val val static void println(String val){System.out.println(val);} println {System.out.println(val);} System.out.println(val) System.out.println System.out System System.out val String val val static void println(int val){System.out.println(val);} println {System.out.println(val);} System.out.println(val) System.out.println System.out System System.out val int val val static void println(long val){System.out.println(val);} println {System.out.println(val);} System.out.println(val) System.out.println System.out System System.out val long val val static void println(Object val){System.out.println(val);} println {System.out.println(val);} System.out.println(val) System.out.println System.out System System.out val Object val val public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int S = getInt(sc.nextLine());
      
        if(S <= 111){
          println("111");
          return;
        }else if(S <= 222){
          println("222");
          return;
        }else if(S <= 333){
          println("333");
          return;
        }else if(S <= 444){
          println("444");
          return;
        }else if(S <= 555){
          println("555");
          return;
        }else if(S <= 666){
          println("666");
          return;
        }else if(S <= 777){
          println("777");
          return;
        }else if(S <= 888){
          println("888");
          return;
        }else{
          println(999);
          return;
        }
        
    }
    static long getLong(String val) {return Long.parseLong(val);}
    static int getInt(String val) {
        return Integer.parseInt(val);
    }

    static void println(String val){System.out.println(val);};
    static void println(int val){System.out.println(val);};
    static void println(long val){System.out.println(val);};
    static void println(Object val){System.out.println(val);};
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int S = getInt(sc.nextLine());
      
        if(S <= 111){
          println("111");
          return;
        }else if(S <= 222){
          println("222");
          return;
        }else if(S <= 333){
          println("333");
          return;
        }else if(S <= 444){
          println("444");
          return;
        }else if(S <= 555){
          println("555");
          return;
        }else if(S <= 666){
          println("666");
          return;
        }else if(S <= 777){
          println("777");
          return;
        }else if(S <= 888){
          println("888");
          return;
        }else{
          println(999);
          return;
        }
        
    }
    static long getLong(String val) {return Long.parseLong(val);}
    static int getInt(String val) {
        return Integer.parseInt(val);
    }

    static void println(String val){System.out.println(val);};
    static void println(int val){System.out.println(val);};
    static void println(long val){System.out.println(val);};
    static void println(Object val){System.out.println(val);};
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int S = getInt(sc.nextLine());
      
        if(S <= 111){
          println("111");
          return;
        }else if(S <= 222){
          println("222");
          return;
        }else if(S <= 333){
          println("333");
          return;
        }else if(S <= 444){
          println("444");
          return;
        }else if(S <= 555){
          println("555");
          return;
        }else if(S <= 666){
          println("666");
          return;
        }else if(S <= 777){
          println("777");
          return;
        }else if(S <= 888){
          println("888");
          return;
        }else{
          println(999);
          return;
        }
        
    }
    static long getLong(String val) {return Long.parseLong(val);}
    static int getInt(String val) {
        return Integer.parseInt(val);
    }

    static void println(String val){System.out.println(val);};
    static void println(int val){System.out.println(val);};
    static void println(long val){System.out.println(val);};
    static void println(Object val){System.out.println(val);};
}
