import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			for (int i = 111; i <= 999; i += 111) {
				if (i >= n) {
					System.out.println(i);
					return;
				}
			}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			for (int i = 111; i <= 999; i += 111) {
				if (i >= n) {
					System.out.println(i);
					return;
				}
			}
		}
	}
} Main public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			for (int i = 111; i <= 999; i += 111) {
				if (i >= n) {
					System.out.println(i);
					return;
				}
			}
		}
	} main {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			for (int i = 111; i <= 999; i += 111) {
				if (i >= n) {
					System.out.println(i);
					return;
				}
			}
		}
	} try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			for (int i = 111; i <= 999; i += 111) {
				if (i >= n) {
					System.out.println(i);
					return;
				}
			}
		} {
			int n = scanner.nextInt();
			for (int i = 111; i <= 999; i += 111) {
				if (i >= n) {
					System.out.println(i);
					return;
				}
			}
		} Scanner scanner = new Scanner(System.in) Scanner scanner = new Scanner(System.in) new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner for (int i = 111; i <= 999; i += 111) {
				if (i >= n) {
					System.out.println(i);
					return;
				}
			} int i = 111; int i = 111; i 111 i <= 999 i 999 i += 111 i += 111 i 111 {
				if (i >= n) {
					System.out.println(i);
					return;
				}
			} {
				if (i >= n) {
					System.out.println(i);
					return;
				}
			} if (i >= n) {
					System.out.println(i);
					return;
				} i >= n i n {
					System.out.println(i);
					return;
				} System.out.println(i) System.out.println System.out System System.out i return; String[] args args public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			for (int i = 111; i <= 999; i += 111) {
				if (i >= n) {
					System.out.println(i);
					return;
				}
			}
		}
	}
} public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			for (int i = 111; i <= 999; i += 111) {
				if (i >= n) {
					System.out.println(i);
					return;
				}
			}
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			for (int i = 111; i <= 999; i += 111) {
				if (i >= n) {
					System.out.println(i);
					return;
				}
			}
		}
	}
}
