import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		
		// 計算
		int result = 0;
		if(n <= 111){
		    result = 111;
		}else if(n <= 222){
		    result = 222;
		}else if(n <= 333){
		    result = 333;
		}else if(n <= 444){
		    result = 444;
		}else if(n <= 555){
		    result = 555;
		}else if(n <= 666){
		    result = 666;
		}else if(n <= 777){
		    result = 777;
		}else if(n <= 888){
		    result = 888;
		}else if(n <= 999){
		    result = 999;
		}
		
		
		// 出力
		System.out.println(result);
		
	}
} import java.util.*; util.* java import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; import java.math.BigInteger; BigInteger java.math public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		
		// 計算
		int result = 0;
		if(n <= 111){
		    result = 111;
		}else if(n <= 222){
		    result = 222;
		}else if(n <= 333){
		    result = 333;
		}else if(n <= 444){
		    result = 444;
		}else if(n <= 555){
		    result = 555;
		}else if(n <= 666){
		    result = 666;
		}else if(n <= 777){
		    result = 777;
		}else if(n <= 888){
		    result = 888;
		}else if(n <= 999){
		    result = 999;
		}
		
		
		// 出力
		System.out.println(result);
		
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		
		// 計算
		int result = 0;
		if(n <= 111){
		    result = 111;
		}else if(n <= 222){
		    result = 222;
		}else if(n <= 333){
		    result = 333;
		}else if(n <= 444){
		    result = 444;
		}else if(n <= 555){
		    result = 555;
		}else if(n <= 666){
		    result = 666;
		}else if(n <= 777){
		    result = 777;
		}else if(n <= 888){
		    result = 888;
		}else if(n <= 999){
		    result = 999;
		}
		
		
		// 出力
		System.out.println(result);
		
	} main {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		
		// 計算
		int result = 0;
		if(n <= 111){
		    result = 111;
		}else if(n <= 222){
		    result = 222;
		}else if(n <= 333){
		    result = 333;
		}else if(n <= 444){
		    result = 444;
		}else if(n <= 555){
		    result = 555;
		}else if(n <= 666){
		    result = 666;
		}else if(n <= 777){
		    result = 777;
		}else if(n <= 888){
		    result = 888;
		}else if(n <= 999){
		    result = 999;
		}
		
		
		// 出力
		System.out.println(result);
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int result = 0; result 0 if(n <= 111){
		    result = 111;
		}else if(n <= 222){
		    result = 222;
		}else if(n <= 333){
		    result = 333;
		}else if(n <= 444){
		    result = 444;
		}else if(n <= 555){
		    result = 555;
		}else if(n <= 666){
		    result = 666;
		}else if(n <= 777){
		    result = 777;
		}else if(n <= 888){
		    result = 888;
		}else if(n <= 999){
		    result = 999;
		} n <= 111 n 111 {
		    result = 111;
		} result = 111 result 111 if(n <= 222){
		    result = 222;
		}else if(n <= 333){
		    result = 333;
		}else if(n <= 444){
		    result = 444;
		}else if(n <= 555){
		    result = 555;
		}else if(n <= 666){
		    result = 666;
		}else if(n <= 777){
		    result = 777;
		}else if(n <= 888){
		    result = 888;
		}else if(n <= 999){
		    result = 999;
		} n <= 222 n 222 {
		    result = 222;
		} result = 222 result 222 if(n <= 333){
		    result = 333;
		}else if(n <= 444){
		    result = 444;
		}else if(n <= 555){
		    result = 555;
		}else if(n <= 666){
		    result = 666;
		}else if(n <= 777){
		    result = 777;
		}else if(n <= 888){
		    result = 888;
		}else if(n <= 999){
		    result = 999;
		} n <= 333 n 333 {
		    result = 333;
		} result = 333 result 333 if(n <= 444){
		    result = 444;
		}else if(n <= 555){
		    result = 555;
		}else if(n <= 666){
		    result = 666;
		}else if(n <= 777){
		    result = 777;
		}else if(n <= 888){
		    result = 888;
		}else if(n <= 999){
		    result = 999;
		} n <= 444 n 444 {
		    result = 444;
		} result = 444 result 444 if(n <= 555){
		    result = 555;
		}else if(n <= 666){
		    result = 666;
		}else if(n <= 777){
		    result = 777;
		}else if(n <= 888){
		    result = 888;
		}else if(n <= 999){
		    result = 999;
		} n <= 555 n 555 {
		    result = 555;
		} result = 555 result 555 if(n <= 666){
		    result = 666;
		}else if(n <= 777){
		    result = 777;
		}else if(n <= 888){
		    result = 888;
		}else if(n <= 999){
		    result = 999;
		} n <= 666 n 666 {
		    result = 666;
		} result = 666 result 666 if(n <= 777){
		    result = 777;
		}else if(n <= 888){
		    result = 888;
		}else if(n <= 999){
		    result = 999;
		} n <= 777 n 777 {
		    result = 777;
		} result = 777 result 777 if(n <= 888){
		    result = 888;
		}else if(n <= 999){
		    result = 999;
		} n <= 888 n 888 {
		    result = 888;
		} result = 888 result 888 if(n <= 999){
		    result = 999;
		} n <= 999 n 999 {
		    result = 999;
		} result = 999 result 999 System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		
		// 計算
		int result = 0;
		if(n <= 111){
		    result = 111;
		}else if(n <= 222){
		    result = 222;
		}else if(n <= 333){
		    result = 333;
		}else if(n <= 444){
		    result = 444;
		}else if(n <= 555){
		    result = 555;
		}else if(n <= 666){
		    result = 666;
		}else if(n <= 777){
		    result = 777;
		}else if(n <= 888){
		    result = 888;
		}else if(n <= 999){
		    result = 999;
		}
		
		
		// 出力
		System.out.println(result);
		
	}
} public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		
		// 計算
		int result = 0;
		if(n <= 111){
		    result = 111;
		}else if(n <= 222){
		    result = 222;
		}else if(n <= 333){
		    result = 333;
		}else if(n <= 444){
		    result = 444;
		}else if(n <= 555){
		    result = 555;
		}else if(n <= 666){
		    result = 666;
		}else if(n <= 777){
		    result = 777;
		}else if(n <= 888){
		    result = 888;
		}else if(n <= 999){
		    result = 999;
		}
		
		
		// 出力
		System.out.println(result);
		
	}
} Main
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		
		// 計算
		int result = 0;
		if(n <= 111){
		    result = 111;
		}else if(n <= 222){
		    result = 222;
		}else if(n <= 333){
		    result = 333;
		}else if(n <= 444){
		    result = 444;
		}else if(n <= 555){
		    result = 555;
		}else if(n <= 666){
		    result = 666;
		}else if(n <= 777){
		    result = 777;
		}else if(n <= 888){
		    result = 888;
		}else if(n <= 999){
		    result = 999;
		}
		
		
		// 出力
		System.out.println(result);
		
	}
}