import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();
		if(n % 111 == 0) {
			System.out.println(n);
		}else {
			for(int i = 111; i <= 999; 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 scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();
		if(n % 111 == 0) {
			System.out.println(n);
		}else {
			for(int i = 111; i <= 999; i+=111) {
				if(n <= i) {
					System.out.println(i);
					break;
				}
			}
		}
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();
		if(n % 111 == 0) {
			System.out.println(n);
		}else {
			for(int i = 111; i <= 999; i+=111) {
				if(n <= i) {
					System.out.println(i);
					break;
				}
			}
		}
	} main {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();
		if(n % 111 == 0) {
			System.out.println(n);
		}else {
			for(int i = 111; i <= 999; i+=111) {
				if(n <= i) {
					System.out.println(i);
					break;
				}
			}
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan scan.close() scan.close scan if(n % 111 == 0) {
			System.out.println(n);
		}else {
			for(int i = 111; i <= 999; i+=111) {
				if(n <= i) {
					System.out.println(i);
					break;
				}
			}
		} n % 111 == 0 n % 111 n 111 0 {
			System.out.println(n);
		} System.out.println(n) System.out.println System.out System System.out n {
			for(int i = 111; i <= 999; i+=111) {
				if(n <= i) {
					System.out.println(i);
					break;
				}
			}
		} for(int i = 111; i <= 999; i+=111) {
				if(n <= i) {
					System.out.println(i);
					break;
				}
			} int i = 111; int i = 111; i 111 i <= 999 i 999 i+=111 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 scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();
		if(n % 111 == 0) {
			System.out.println(n);
		}else {
			for(int i = 111; i <= 999; i+=111) {
				if(n <= i) {
					System.out.println(i);
					break;
				}
			}
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();
		if(n % 111 == 0) {
			System.out.println(n);
		}else {
			for(int i = 111; i <= 999; 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 scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();
		if(n % 111 == 0) {
			System.out.println(n);
		}else {
			for(int i = 111; i <= 999; i+=111) {
				if(n <= i) {
					System.out.println(i);
					break;
				}
			}
		}
	}
}