import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		for (int i = 111; i < 1000; i = i + 111) {
			if(n <= i) {
				System.out.println(i);
				break;
			}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		for (int i = 111; i < 1000; i = i + 111) {
			if(n <= i) {
				System.out.println(i);
				break;
			}
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		for (int i = 111; i < 1000; i = i + 111) {
			if(n <= i) {
				System.out.println(i);
				break;
			}
		}
	} main {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		for (int i = 111; i < 1000; i = i + 111) {
			if(n <= i) {
				System.out.println(i);
				break;
			}
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuilder sb = new StringBuilder(); sb new StringBuilder() int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for (int i = 111; i < 1000; i = i + 111) {
			if(n <= i) {
				System.out.println(i);
				break;
			}
		} int i = 111; int i = 111; i 111 i < 1000 i 1000 i = i + 111 i = i + 111 i i + 111 i 111 {
			if(n <= i) {
				System.out.println(i);
				break;
			}
		} {
			if(n <= i) {
				System.out.println(i);
				break;
			}
		} if(n <= i) {
				System.out.println(i);
				break;
			} n <= i n i {
				System.out.println(i);
				break;
			} System.out.println(i) System.out.println System.out System System.out i break; String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		for (int i = 111; i < 1000; i = i + 111) {
			if(n <= i) {
				System.out.println(i);
				break;
			}
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		for (int i = 111; i < 1000; i = i + 111) {
			if(n <= i) {
				System.out.println(i);
				break;
			}
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		for (int i = 111; i < 1000; i = i + 111) {
			if(n <= i) {
				System.out.println(i);
				break;
			}
		}
	}
}
