import java.util.Scanner;

class Main{
	static final long MOD = 1000000007;

	static int H, W, K;
	static long[][] dp = new long[110][10];
	static int ans = 0;
	static long n = 0;




	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int	x = sc.nextInt();
		for(int i = x;i <= 999;i++){
			if(i == 111 || i == 222 || i == 333 || i== 444 || i == 555 || i == 666|| i == 777 || i== 888 || i == 999){
				System.out.println(i);
				return;
				

			}
		}

	}
}







class Pair implements Comparable{
	int from;		//p
	int end;		//y
	int num;
	int bango;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}
 import java.util.Scanner; Scanner java.util class Main{
	static final long MOD = 1000000007;

	static int H, W, K;
	static long[][] dp = new long[110][10];
	static int ans = 0;
	static long n = 0;




	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int	x = sc.nextInt();
		for(int i = x;i <= 999;i++){
			if(i == 111 || i == 222 || i == 333 || i== 444 || i == 555 || i == 666|| i == 777 || i== 888 || i == 999){
				System.out.println(i);
				return;
				

			}
		}

	}
} Main static final long MOD = 1000000007; MOD 1000000007 static int H H W W K; K static long[][] dp = new long[110][10]; dp new long[110][10] 110 10 static int ans = 0; ans 0 static long n = 0; n 0 public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int	x = sc.nextInt();
		for(int i = x;i <= 999;i++){
			if(i == 111 || i == 222 || i == 333 || i== 444 || i == 555 || i == 666|| i == 777 || i== 888 || i == 999){
				System.out.println(i);
				return;
				

			}
		}

	} main {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int	x = sc.nextInt();
		for(int i = x;i <= 999;i++){
			if(i == 111 || i == 222 || i == 333 || i== 444 || i == 555 || i == 666|| i == 777 || i== 888 || i == 999){
				System.out.println(i);
				return;
				

			}
		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int	x = sc.nextInt(); x sc.nextInt() sc.nextInt sc for(int i = x;i <= 999;i++){
			if(i == 111 || i == 222 || i == 333 || i== 444 || i == 555 || i == 666|| i == 777 || i== 888 || i == 999){
				System.out.println(i);
				return;
				

			}
		} int i = x; int i = x; i x i <= 999 i 999 i++ i++ i {
			if(i == 111 || i == 222 || i == 333 || i== 444 || i == 555 || i == 666|| i == 777 || i== 888 || i == 999){
				System.out.println(i);
				return;
				

			}
		} {
			if(i == 111 || i == 222 || i == 333 || i== 444 || i == 555 || i == 666|| i == 777 || i== 888 || i == 999){
				System.out.println(i);
				return;
				

			}
		} if(i == 111 || i == 222 || i == 333 || i== 444 || i == 555 || i == 666|| i == 777 || i== 888 || i == 999){
				System.out.println(i);
				return;
				

			} i == 111 || i == 222 || i == 333 || i== 444 || i == 555 || i == 666|| i == 777 || i== 888 || i == 999 i== 888 i == 777 i == 666 i == 555 i== 444 i == 333 i == 111 || i == 222 || i == 333 || i== 444 || i == 555 || i == 666|| i == 777 || i== 888 || i == 999 i == 111 i 111 i == 222 i 222 i == 333 i 333 i== 444 i 444 i == 555 i 555 i == 666 i 666 i == 777 i 777 i== 888 i 888 i == 999 i 999 {
				System.out.println(i);
				return;
				

			} System.out.println(i) System.out.println System.out System System.out i return; String[] args args class Pair implements Comparable{
	int from;		//p
	int end;		//y
	int num;
	int bango;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
} Pair int from;		//p from int end;		//y end int num; num int bango; bango @Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	} compareTo {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	} Pair otherpair = (Pair)other; otherpair (Pair)other return end - otherpair.end; end - otherpair.end end otherpair.end otherpair otherpair.end Object other other Comparable
import java.util.Scanner;

class Main{
	static final long MOD = 1000000007;

	static int H, W, K;
	static long[][] dp = new long[110][10];
	static int ans = 0;
	static long n = 0;




	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int	x = sc.nextInt();
		for(int i = x;i <= 999;i++){
			if(i == 111 || i == 222 || i == 333 || i== 444 || i == 555 || i == 666|| i == 777 || i== 888 || i == 999){
				System.out.println(i);
				return;
				

			}
		}

	}
}







class Pair implements Comparable{
	int from;		//p
	int end;		//y
	int num;
	int bango;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}

