import java.util.*;

public class Main {
	public static void main(String[] args) {
		Integer list[] = { 111, 222, 333, 444, 555, 666, 777, 888, 999 };

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ret = 0;
		for (int i = n; true; i++) {
			if (Arrays.asList(list).contains(i)) {
				ret = i;
				break;
			}
		}

		System.out.println(ret);

		sc.close();
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Integer list[] = { 111, 222, 333, 444, 555, 666, 777, 888, 999 };

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ret = 0;
		for (int i = n; true; i++) {
			if (Arrays.asList(list).contains(i)) {
				ret = i;
				break;
			}
		}

		System.out.println(ret);

		sc.close();
	}
} Main public static void main(String[] args) {
		Integer list[] = { 111, 222, 333, 444, 555, 666, 777, 888, 999 };

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ret = 0;
		for (int i = n; true; i++) {
			if (Arrays.asList(list).contains(i)) {
				ret = i;
				break;
			}
		}

		System.out.println(ret);

		sc.close();
	} main {
		Integer list[] = { 111, 222, 333, 444, 555, 666, 777, 888, 999 };

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ret = 0;
		for (int i = n; true; i++) {
			if (Arrays.asList(list).contains(i)) {
				ret = i;
				break;
			}
		}

		System.out.println(ret);

		sc.close();
	} Integer list[] = { 111, 222, 333, 444, 555, 666, 777, 888, 999 }; list { 111, 222, 333, 444, 555, 666, 777, 888, 999 } 111 222 333 444 555 666 777 888 999 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int ret = 0; ret 0 for (int i = n; true; i++) {
			if (Arrays.asList(list).contains(i)) {
				ret = i;
				break;
			}
		} int i = n; int i = n; i n true i++ i++ i {
			if (Arrays.asList(list).contains(i)) {
				ret = i;
				break;
			}
		} {
			if (Arrays.asList(list).contains(i)) {
				ret = i;
				break;
			}
		} if (Arrays.asList(list).contains(i)) {
				ret = i;
				break;
			} Arrays.asList(list).contains(i) Arrays.asList(list).contains Arrays.asList(list) Arrays.asList Arrays list i {
				ret = i;
				break;
			} ret = i ret i break; System.out.println(ret) System.out.println System.out System System.out ret sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Integer list[] = { 111, 222, 333, 444, 555, 666, 777, 888, 999 };

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ret = 0;
		for (int i = n; true; i++) {
			if (Arrays.asList(list).contains(i)) {
				ret = i;
				break;
			}
		}

		System.out.println(ret);

		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Integer list[] = { 111, 222, 333, 444, 555, 666, 777, 888, 999 };

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ret = 0;
		for (int i = n; true; i++) {
			if (Arrays.asList(list).contains(i)) {
				ret = i;
				break;
			}
		}

		System.out.println(ret);

		sc.close();
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Integer list[] = { 111, 222, 333, 444, 555, 666, 777, 888, 999 };

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ret = 0;
		for (int i = n; true; i++) {
			if (Arrays.asList(list).contains(i)) {
				ret = i;
				break;
			}
		}

		System.out.println(ret);

		sc.close();
	}
}