import java.util.Scanner;

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

		int[] N = {111, 222, 333, 444, 555, 666, 777, 888, 999};

		for(int i = 0;i < N.length; i++) {
			if(N[i] == n) {
				System.out.println(N[i]);
				break;
			} else if(N[0] > n) {
				System.out.println(N[0]);
				break;
			} else if(N[i] < n && n < N[i + 1]) {
				System.out.println(N[i + 1]);
				break;
			}
		}


	}
} 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[] N = {111, 222, 333, 444, 555, 666, 777, 888, 999};

		for(int i = 0;i < N.length; i++) {
			if(N[i] == n) {
				System.out.println(N[i]);
				break;
			} else if(N[0] > n) {
				System.out.println(N[0]);
				break;
			} else if(N[i] < n && n < N[i + 1]) {
				System.out.println(N[i + 1]);
				break;
			}
		}


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

		int[] N = {111, 222, 333, 444, 555, 666, 777, 888, 999};

		for(int i = 0;i < N.length; i++) {
			if(N[i] == n) {
				System.out.println(N[i]);
				break;
			} else if(N[0] > n) {
				System.out.println(N[0]);
				break;
			} else if(N[i] < n && n < N[i + 1]) {
				System.out.println(N[i + 1]);
				break;
			}
		}


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

		int[] N = {111, 222, 333, 444, 555, 666, 777, 888, 999};

		for(int i = 0;i < N.length; i++) {
			if(N[i] == n) {
				System.out.println(N[i]);
				break;
			} else if(N[0] > n) {
				System.out.println(N[0]);
				break;
			} else if(N[i] < n && n < N[i + 1]) {
				System.out.println(N[i + 1]);
				break;
			}
		}


	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] N = {111, 222, 333, 444, 555, 666, 777, 888, 999}; N {111, 222, 333, 444, 555, 666, 777, 888, 999} 111 222 333 444 555 666 777 888 999 for(int i = 0;i < N.length; i++) {
			if(N[i] == n) {
				System.out.println(N[i]);
				break;
			} else if(N[0] > n) {
				System.out.println(N[0]);
				break;
			} else if(N[i] < n && n < N[i + 1]) {
				System.out.println(N[i + 1]);
				break;
			}
		} int i = 0; int i = 0; i 0 i < N.length i N.length N N.length i++ i++ i {
			if(N[i] == n) {
				System.out.println(N[i]);
				break;
			} else if(N[0] > n) {
				System.out.println(N[0]);
				break;
			} else if(N[i] < n && n < N[i + 1]) {
				System.out.println(N[i + 1]);
				break;
			}
		} {
			if(N[i] == n) {
				System.out.println(N[i]);
				break;
			} else if(N[0] > n) {
				System.out.println(N[0]);
				break;
			} else if(N[i] < n && n < N[i + 1]) {
				System.out.println(N[i + 1]);
				break;
			}
		} if(N[i] == n) {
				System.out.println(N[i]);
				break;
			} else if(N[0] > n) {
				System.out.println(N[0]);
				break;
			} else if(N[i] < n && n < N[i + 1]) {
				System.out.println(N[i + 1]);
				break;
			} N[i] == n N[i] N i n {
				System.out.println(N[i]);
				break;
			} System.out.println(N[i]) System.out.println System.out System System.out N[i] N i break; if(N[0] > n) {
				System.out.println(N[0]);
				break;
			} else if(N[i] < n && n < N[i + 1]) {
				System.out.println(N[i + 1]);
				break;
			} N[0] > n N[0] N 0 n {
				System.out.println(N[0]);
				break;
			} System.out.println(N[0]) System.out.println System.out System System.out N[0] N 0 break; if(N[i] < n && n < N[i + 1]) {
				System.out.println(N[i + 1]);
				break;
			} N[i] < n && n < N[i + 1] N[i] < n N[i] N i n n < N[i + 1] n N[i + 1] N i + 1 i 1 {
				System.out.println(N[i + 1]);
				break;
			} System.out.println(N[i + 1]) System.out.println System.out System System.out N[i + 1] N i + 1 i 1 break; String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int[] N = {111, 222, 333, 444, 555, 666, 777, 888, 999};

		for(int i = 0;i < N.length; i++) {
			if(N[i] == n) {
				System.out.println(N[i]);
				break;
			} else if(N[0] > n) {
				System.out.println(N[0]);
				break;
			} else if(N[i] < n && n < N[i + 1]) {
				System.out.println(N[i + 1]);
				break;
			}
		}


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

		int[] N = {111, 222, 333, 444, 555, 666, 777, 888, 999};

		for(int i = 0;i < N.length; i++) {
			if(N[i] == n) {
				System.out.println(N[i]);
				break;
			} else if(N[0] > n) {
				System.out.println(N[0]);
				break;
			} else if(N[i] < n && n < N[i + 1]) {
				System.out.println(N[i + 1]);
				break;
			}
		}


	}
} 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[] N = {111, 222, 333, 444, 555, 666, 777, 888, 999};

		for(int i = 0;i < N.length; i++) {
			if(N[i] == n) {
				System.out.println(N[i]);
				break;
			} else if(N[0] > n) {
				System.out.println(N[0]);
				break;
			} else if(N[i] < n && n < N[i + 1]) {
				System.out.println(N[i + 1]);
				break;
			}
		}


	}
}