import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String input = scan.nextLine();
		scan.close();

		int x = Integer.parseInt(input);
		for(int i=1; i<10; i++) {
			int a = i*100+i*10+i;
			if(x<=a) {
				System.out.println(a);
				return;
			}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String input = scan.nextLine();
		scan.close();

		int x = Integer.parseInt(input);
		for(int i=1; i<10; i++) {
			int a = i*100+i*10+i;
			if(x<=a) {
				System.out.println(a);
				return;
			}
		}
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String input = scan.nextLine();
		scan.close();

		int x = Integer.parseInt(input);
		for(int i=1; i<10; i++) {
			int a = i*100+i*10+i;
			if(x<=a) {
				System.out.println(a);
				return;
			}
		}
	} main {
		Scanner scan = new Scanner(System.in);
		String input = scan.nextLine();
		scan.close();

		int x = Integer.parseInt(input);
		for(int i=1; i<10; i++) {
			int a = i*100+i*10+i;
			if(x<=a) {
				System.out.println(a);
				return;
			}
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String input = scan.nextLine(); input scan.nextLine() scan.nextLine scan scan.close() scan.close scan int x = Integer.parseInt(input); x Integer.parseInt(input) Integer.parseInt Integer input for(int i=1; i<10; i++) {
			int a = i*100+i*10+i;
			if(x<=a) {
				System.out.println(a);
				return;
			}
		} int i=1; int i=1; i 1 i<10 i 10 i++ i++ i {
			int a = i*100+i*10+i;
			if(x<=a) {
				System.out.println(a);
				return;
			}
		} {
			int a = i*100+i*10+i;
			if(x<=a) {
				System.out.println(a);
				return;
			}
		} int a = i*100+i*10+i; a i*100+i*10+i i*100+i*10+i i*100 i 100 i*10 i 10 i if(x<=a) {
				System.out.println(a);
				return;
			} x<=a x a {
				System.out.println(a);
				return;
			} System.out.println(a) System.out.println System.out System System.out a return; String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String input = scan.nextLine();
		scan.close();

		int x = Integer.parseInt(input);
		for(int i=1; i<10; i++) {
			int a = i*100+i*10+i;
			if(x<=a) {
				System.out.println(a);
				return;
			}
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String input = scan.nextLine();
		scan.close();

		int x = Integer.parseInt(input);
		for(int i=1; i<10; i++) {
			int a = i*100+i*10+i;
			if(x<=a) {
				System.out.println(a);
				return;
			}
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String input = scan.nextLine();
		scan.close();

		int x = Integer.parseInt(input);
		for(int i=1; i<10; i++) {
			int a = i*100+i*10+i;
			if(x<=a) {
				System.out.println(a);
				return;
			}
		}
	}
}