import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String strN = Integer.toString(N);
        
        String first = strN.substring(0,1);
        int fnum = Integer.valueOf(first);
        int compare = Integer.valueOf(first + first + first);
        
        if( compare >= N){
            System.out.println(compare);
        }else{
            String second = String.valueOf(fnum+1) + String.valueOf(fnum+1) + String.valueOf(fnum+1);
            System.out.println( second );
        }
        
        
        
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String strN = Integer.toString(N);
        
        String first = strN.substring(0,1);
        int fnum = Integer.valueOf(first);
        int compare = Integer.valueOf(first + first + first);
        
        if( compare >= N){
            System.out.println(compare);
        }else{
            String second = String.valueOf(fnum+1) + String.valueOf(fnum+1) + String.valueOf(fnum+1);
            System.out.println( second );
        }
        
        
        
    }
} Main public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String strN = Integer.toString(N);
        
        String first = strN.substring(0,1);
        int fnum = Integer.valueOf(first);
        int compare = Integer.valueOf(first + first + first);
        
        if( compare >= N){
            System.out.println(compare);
        }else{
            String second = String.valueOf(fnum+1) + String.valueOf(fnum+1) + String.valueOf(fnum+1);
            System.out.println( second );
        }
        
        
        
    } main {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String strN = Integer.toString(N);
        
        String first = strN.substring(0,1);
        int fnum = Integer.valueOf(first);
        int compare = Integer.valueOf(first + first + first);
        
        if( compare >= N){
            System.out.println(compare);
        }else{
            String second = String.valueOf(fnum+1) + String.valueOf(fnum+1) + String.valueOf(fnum+1);
            System.out.println( second );
        }
        
        
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc String strN = Integer.toString(N); strN Integer.toString(N) Integer.toString Integer N String first = strN.substring(0,1); first strN.substring(0,1) strN.substring strN 0 1 int fnum = Integer.valueOf(first); fnum Integer.valueOf(first) Integer.valueOf Integer first int compare = Integer.valueOf(first + first + first); compare Integer.valueOf(first + first + first) Integer.valueOf Integer first + first + first first + first + first first first first if( compare >= N){
            System.out.println(compare);
        }else{
            String second = String.valueOf(fnum+1) + String.valueOf(fnum+1) + String.valueOf(fnum+1);
            System.out.println( second );
        } compare >= N compare N {
            System.out.println(compare);
        } System.out.println(compare) System.out.println System.out System System.out compare {
            String second = String.valueOf(fnum+1) + String.valueOf(fnum+1) + String.valueOf(fnum+1);
            System.out.println( second );
        } String second = String.valueOf(fnum+1) + String.valueOf(fnum+1) + String.valueOf(fnum+1); second String.valueOf(fnum+1) + String.valueOf(fnum+1) + String.valueOf(fnum+1) String.valueOf(fnum+1) + String.valueOf(fnum+1) + String.valueOf(fnum+1) String.valueOf(fnum+1) String.valueOf String fnum+1 fnum 1 String.valueOf(fnum+1) String.valueOf String fnum+1 fnum 1 String.valueOf(fnum+1) String.valueOf String fnum+1 fnum 1 System.out.println( second ) System.out.println System.out System System.out second String[] args args public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String strN = Integer.toString(N);
        
        String first = strN.substring(0,1);
        int fnum = Integer.valueOf(first);
        int compare = Integer.valueOf(first + first + first);
        
        if( compare >= N){
            System.out.println(compare);
        }else{
            String second = String.valueOf(fnum+1) + String.valueOf(fnum+1) + String.valueOf(fnum+1);
            System.out.println( second );
        }
        
        
        
    }
} public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String strN = Integer.toString(N);
        
        String first = strN.substring(0,1);
        int fnum = Integer.valueOf(first);
        int compare = Integer.valueOf(first + first + first);
        
        if( compare >= N){
            System.out.println(compare);
        }else{
            String second = String.valueOf(fnum+1) + String.valueOf(fnum+1) + String.valueOf(fnum+1);
            System.out.println( second );
        }
        
        
        
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String strN = Integer.toString(N);
        
        String first = strN.substring(0,1);
        int fnum = Integer.valueOf(first);
        int compare = Integer.valueOf(first + first + first);
        
        if( compare >= N){
            System.out.println(compare);
        }else{
            String second = String.valueOf(fnum+1) + String.valueOf(fnum+1) + String.valueOf(fnum+1);
            System.out.println( second );
        }
        
        
        
    }
}
