import java.util.Scanner;

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

		int n = sc.nextInt();
		int ans = 999;
		for (int i = n; i < 1000; i++) {
			int a = i / 100;
			int b = i / 10 % 10;
			int c = i % 10;
			if (a == b && b == c && c == a) {
				ans = i;
				break;
			}
		}

		System.out.println(ans);
		sc.close();
	}

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

		int n = sc.nextInt();
		int ans = 999;
		for (int i = n; i < 1000; i++) {
			int a = i / 100;
			int b = i / 10 % 10;
			int c = i % 10;
			if (a == b && b == c && c == a) {
				ans = i;
				break;
			}
		}

		System.out.println(ans);
		sc.close();
	}

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

		int n = sc.nextInt();
		int ans = 999;
		for (int i = n; i < 1000; i++) {
			int a = i / 100;
			int b = i / 10 % 10;
			int c = i % 10;
			if (a == b && b == c && c == a) {
				ans = i;
				break;
			}
		}

		System.out.println(ans);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int ans = 999;
		for (int i = n; i < 1000; i++) {
			int a = i / 100;
			int b = i / 10 % 10;
			int c = i % 10;
			if (a == b && b == c && c == a) {
				ans = i;
				break;
			}
		}

		System.out.println(ans);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int ans = 999; ans 999 for (int i = n; i < 1000; i++) {
			int a = i / 100;
			int b = i / 10 % 10;
			int c = i % 10;
			if (a == b && b == c && c == a) {
				ans = i;
				break;
			}
		} int i = n; int i = n; i n i < 1000 i 1000 i++ i++ i {
			int a = i / 100;
			int b = i / 10 % 10;
			int c = i % 10;
			if (a == b && b == c && c == a) {
				ans = i;
				break;
			}
		} {
			int a = i / 100;
			int b = i / 10 % 10;
			int c = i % 10;
			if (a == b && b == c && c == a) {
				ans = i;
				break;
			}
		} int a = i / 100; a i / 100 i 100 int b = i / 10 % 10; b i / 10 % 10 i / 10 i 10 10 int c = i % 10; c i % 10 i 10 if (a == b && b == c && c == a) {
				ans = i;
				break;
			} a == b && b == c && c == a a == b && b == c && c == a a == b a b b == c b c c == a c a {
				ans = i;
				break;
			} ans = i ans i break; System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int ans = 999;
		for (int i = n; i < 1000; i++) {
			int a = i / 100;
			int b = i / 10 % 10;
			int c = i % 10;
			if (a == b && b == c && c == a) {
				ans = i;
				break;
			}
		}

		System.out.println(ans);
		sc.close();
	}

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

		int n = sc.nextInt();
		int ans = 999;
		for (int i = n; i < 1000; i++) {
			int a = i / 100;
			int b = i / 10 % 10;
			int c = i % 10;
			if (a == b && b == c && c == a) {
				ans = i;
				break;
			}
		}

		System.out.println(ans);
		sc.close();
	}

} Main
import java.util.Scanner;

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

		int n = sc.nextInt();
		int ans = 999;
		for (int i = n; i < 1000; i++) {
			int a = i / 100;
			int b = i / 10 % 10;
			int c = i % 10;
			if (a == b && b == c && c == a) {
				ans = i;
				break;
			}
		}

		System.out.println(ans);
		sc.close();
	}

}
