import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.StringTokenizer;

import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String c = sc.next();
        String c1 = String.valueOf(c.charAt(0));
        String c11=String.valueOf(Integer.parseInt(c1)+1);
        
        String c2 = c1 + c1 + c1;
        String c21 = c11 + c11 + c11;
        
        String ans = "";
        if (Integer.parseInt(c2) >= Integer.parseInt(c)) {
        	ans = c2;
        } else {
        	ans = c21;
        }
        
    	System.out.println(ans);   
    
    }
    private static String change19(String str) {
    	if ("1".equals(str)) {
    		str="9";
    	} else if ("9".equals(str)) {
    		str="1";
    	}
    	
    	return str;
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.math.BigDecimal; BigDecimal java.math import java.util.Arrays; Arrays java.util import java.util.StringTokenizer; StringTokenizer java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String c = sc.next();
        String c1 = String.valueOf(c.charAt(0));
        String c11=String.valueOf(Integer.parseInt(c1)+1);
        
        String c2 = c1 + c1 + c1;
        String c21 = c11 + c11 + c11;
        
        String ans = "";
        if (Integer.parseInt(c2) >= Integer.parseInt(c)) {
        	ans = c2;
        } else {
        	ans = c21;
        }
        
    	System.out.println(ans);   
    
    }
    private static String change19(String str) {
    	if ("1".equals(str)) {
    		str="9";
    	} else if ("9".equals(str)) {
    		str="1";
    	}
    	
    	return str;
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String c = sc.next();
        String c1 = String.valueOf(c.charAt(0));
        String c11=String.valueOf(Integer.parseInt(c1)+1);
        
        String c2 = c1 + c1 + c1;
        String c21 = c11 + c11 + c11;
        
        String ans = "";
        if (Integer.parseInt(c2) >= Integer.parseInt(c)) {
        	ans = c2;
        } else {
        	ans = c21;
        }
        
    	System.out.println(ans);   
    
    } main {
        Scanner sc = new Scanner(System.in);
        String c = sc.next();
        String c1 = String.valueOf(c.charAt(0));
        String c11=String.valueOf(Integer.parseInt(c1)+1);
        
        String c2 = c1 + c1 + c1;
        String c21 = c11 + c11 + c11;
        
        String ans = "";
        if (Integer.parseInt(c2) >= Integer.parseInt(c)) {
        	ans = c2;
        } else {
        	ans = c21;
        }
        
    	System.out.println(ans);   
    
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String c = sc.next(); c sc.next() sc.next sc String c1 = String.valueOf(c.charAt(0)); c1 String.valueOf(c.charAt(0)) String.valueOf String c.charAt(0) c.charAt c 0 String c11=String.valueOf(Integer.parseInt(c1)+1); c11 String.valueOf(Integer.parseInt(c1)+1) String.valueOf String Integer.parseInt(c1)+1 Integer.parseInt(c1) Integer.parseInt Integer c1 1 String c2 = c1 + c1 + c1; c2 c1 + c1 + c1 c1 + c1 + c1 c1 c1 c1 String c21 = c11 + c11 + c11; c21 c11 + c11 + c11 c11 + c11 + c11 c11 c11 c11 String ans = ""; ans "" if (Integer.parseInt(c2) >= Integer.parseInt(c)) {
        	ans = c2;
        } else {
        	ans = c21;
        } Integer.parseInt(c2) >= Integer.parseInt(c) Integer.parseInt(c2) Integer.parseInt Integer c2 Integer.parseInt(c) Integer.parseInt Integer c {
        	ans = c2;
        } ans = c2 ans c2 {
        	ans = c21;
        } ans = c21 ans c21 System.out.println(ans) System.out.println System.out System System.out ans String[] args args private static String change19(String str) {
    	if ("1".equals(str)) {
    		str="9";
    	} else if ("9".equals(str)) {
    		str="1";
    	}
    	
    	return str;
    } change19 {
    	if ("1".equals(str)) {
    		str="9";
    	} else if ("9".equals(str)) {
    		str="1";
    	}
    	
    	return str;
    } if ("1".equals(str)) {
    		str="9";
    	} else if ("9".equals(str)) {
    		str="1";
    	} "1".equals(str) "1".equals "1" str {
    		str="9";
    	} str="9" str "9" if ("9".equals(str)) {
    		str="1";
    	} "9".equals(str) "9".equals "9" str {
    		str="1";
    	} str="1" str "1" return str; str String str str public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String c = sc.next();
        String c1 = String.valueOf(c.charAt(0));
        String c11=String.valueOf(Integer.parseInt(c1)+1);
        
        String c2 = c1 + c1 + c1;
        String c21 = c11 + c11 + c11;
        
        String ans = "";
        if (Integer.parseInt(c2) >= Integer.parseInt(c)) {
        	ans = c2;
        } else {
        	ans = c21;
        }
        
    	System.out.println(ans);   
    
    }
    private static String change19(String str) {
    	if ("1".equals(str)) {
    		str="9";
    	} else if ("9".equals(str)) {
    		str="1";
    	}
    	
    	return str;
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String c = sc.next();
        String c1 = String.valueOf(c.charAt(0));
        String c11=String.valueOf(Integer.parseInt(c1)+1);
        
        String c2 = c1 + c1 + c1;
        String c21 = c11 + c11 + c11;
        
        String ans = "";
        if (Integer.parseInt(c2) >= Integer.parseInt(c)) {
        	ans = c2;
        } else {
        	ans = c21;
        }
        
    	System.out.println(ans);   
    
    }
    private static String change19(String str) {
    	if ("1".equals(str)) {
    		str="9";
    	} else if ("9".equals(str)) {
    		str="1";
    	}
    	
    	return str;
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.StringTokenizer;

import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String c = sc.next();
        String c1 = String.valueOf(c.charAt(0));
        String c11=String.valueOf(Integer.parseInt(c1)+1);
        
        String c2 = c1 + c1 + c1;
        String c21 = c11 + c11 + c11;
        
        String ans = "";
        if (Integer.parseInt(c2) >= Integer.parseInt(c)) {
        	ans = c2;
        } else {
        	ans = c21;
        }
        
    	System.out.println(ans);   
    
    }
    private static String change19(String str) {
    	if ("1".equals(str)) {
    		str="9";
    	} else if ("9".equals(str)) {
    		str="1";
    	}
    	
    	return str;
    }
}