import java.util.*;

public class Main {
	public static void main(String[] args) {
		int[] values = {111,222,333,444,555,666,777,888,999};
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.nextLine());
		for(int i = 0; i < values.length; i++) {
			if(values[i] >= N) {
				System.out.println(values[i]);
				return;
			}
		}
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		int[] values = {111,222,333,444,555,666,777,888,999};
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.nextLine());
		for(int i = 0; i < values.length; i++) {
			if(values[i] >= N) {
				System.out.println(values[i]);
				return;
			}
		}
	}
} Main public static void main(String[] args) {
		int[] values = {111,222,333,444,555,666,777,888,999};
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.nextLine());
		for(int i = 0; i < values.length; i++) {
			if(values[i] >= N) {
				System.out.println(values[i]);
				return;
			}
		}
	} main {
		int[] values = {111,222,333,444,555,666,777,888,999};
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.nextLine());
		for(int i = 0; i < values.length; i++) {
			if(values[i] >= N) {
				System.out.println(values[i]);
				return;
			}
		}
	} int[] values = {111,222,333,444,555,666,777,888,999}; values {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 = Integer.parseInt(sc.nextLine()); N Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc for(int i = 0; i < values.length; i++) {
			if(values[i] >= N) {
				System.out.println(values[i]);
				return;
			}
		} int i = 0; int i = 0; i 0 i < values.length i values.length values values.length i++ i++ i {
			if(values[i] >= N) {
				System.out.println(values[i]);
				return;
			}
		} {
			if(values[i] >= N) {
				System.out.println(values[i]);
				return;
			}
		} if(values[i] >= N) {
				System.out.println(values[i]);
				return;
			} values[i] >= N values[i] values i N {
				System.out.println(values[i]);
				return;
			} System.out.println(values[i]) System.out.println System.out System System.out values[i] values i return; String[] args args public class Main {
	public static void main(String[] args) {
		int[] values = {111,222,333,444,555,666,777,888,999};
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.nextLine());
		for(int i = 0; i < values.length; i++) {
			if(values[i] >= N) {
				System.out.println(values[i]);
				return;
			}
		}
	}
} public class Main {
	public static void main(String[] args) {
		int[] values = {111,222,333,444,555,666,777,888,999};
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.nextLine());
		for(int i = 0; i < values.length; i++) {
			if(values[i] >= N) {
				System.out.println(values[i]);
				return;
			}
		}
	}
} Main
import java.util.*;

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