import java.util.*;

class Main{

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int ans = 0;

		for(int i = 1; i<10; i++){
			int a = 111;
			if((a*i) >= N){
				ans = a*i;
				break;
			}
		}

		System.out.println(ans);


	}
} import java.util.*; util.* java class Main{

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int ans = 0;

		for(int i = 1; i<10; i++){
			int a = 111;
			if((a*i) >= N){
				ans = a*i;
				break;
			}
		}

		System.out.println(ans);


	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int ans = 0;

		for(int i = 1; i<10; i++){
			int a = 111;
			if((a*i) >= N){
				ans = a*i;
				break;
			}
		}

		System.out.println(ans);


	} main {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int ans = 0;

		for(int i = 1; i<10; i++){
			int a = 111;
			if((a*i) >= N){
				ans = a*i;
				break;
			}
		}

		System.out.println(ans);


	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int ans = 0; ans 0 for(int i = 1; i<10; i++){
			int a = 111;
			if((a*i) >= N){
				ans = a*i;
				break;
			}
		} int i = 1; int i = 1; i 1 i<10 i 10 i++ i++ i {
			int a = 111;
			if((a*i) >= N){
				ans = a*i;
				break;
			}
		} {
			int a = 111;
			if((a*i) >= N){
				ans = a*i;
				break;
			}
		} int a = 111; a 111 if((a*i) >= N){
				ans = a*i;
				break;
			} (a*i) >= N (a*i) a i N {
				ans = a*i;
				break;
			} ans = a*i ans a*i a i break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;

class Main{

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int ans = 0;

		for(int i = 1; i<10; i++){
			int a = 111;
			if((a*i) >= N){
				ans = a*i;
				break;
			}
		}

		System.out.println(ans);


	}
}