import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		int intAns = 0;
		
		for (int i = 1; i < 10; i++) {
			
			n -= 111;
			
			if (n <= 0) {
				intAns = i;
				break;
			}
		}
		
		String ans = String.valueOf(intAns);
		
		System.out.println(ans + ans + ans);
	}
} 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 intAns = 0;
		
		for (int i = 1; i < 10; i++) {
			
			n -= 111;
			
			if (n <= 0) {
				intAns = i;
				break;
			}
		}
		
		String ans = String.valueOf(intAns);
		
		System.out.println(ans + ans + ans);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		int intAns = 0;
		
		for (int i = 1; i < 10; i++) {
			
			n -= 111;
			
			if (n <= 0) {
				intAns = i;
				break;
			}
		}
		
		String ans = String.valueOf(intAns);
		
		System.out.println(ans + ans + ans);
	} main {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		int intAns = 0;
		
		for (int i = 1; i < 10; i++) {
			
			n -= 111;
			
			if (n <= 0) {
				intAns = i;
				break;
			}
		}
		
		String ans = String.valueOf(intAns);
		
		System.out.println(ans + ans + ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int intAns = 0; intAns 0 for (int i = 1; i < 10; i++) {
			
			n -= 111;
			
			if (n <= 0) {
				intAns = i;
				break;
			}
		} int i = 1; int i = 1; i 1 i < 10 i 10 i++ i++ i {
			
			n -= 111;
			
			if (n <= 0) {
				intAns = i;
				break;
			}
		} {
			
			n -= 111;
			
			if (n <= 0) {
				intAns = i;
				break;
			}
		} n -= 111 n 111 if (n <= 0) {
				intAns = i;
				break;
			} n <= 0 n 0 {
				intAns = i;
				break;
			} intAns = i intAns i break; String ans = String.valueOf(intAns); ans String.valueOf(intAns) String.valueOf String intAns System.out.println(ans + ans + ans) System.out.println System.out System System.out ans + ans + ans ans + ans + ans ans ans ans String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		int intAns = 0;
		
		for (int i = 1; i < 10; i++) {
			
			n -= 111;
			
			if (n <= 0) {
				intAns = i;
				break;
			}
		}
		
		String ans = String.valueOf(intAns);
		
		System.out.println(ans + ans + ans);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		int intAns = 0;
		
		for (int i = 1; i < 10; i++) {
			
			n -= 111;
			
			if (n <= 0) {
				intAns = i;
				break;
			}
		}
		
		String ans = String.valueOf(intAns);
		
		System.out.println(ans + ans + ans);
	}
} 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 intAns = 0;
		
		for (int i = 1; i < 10; i++) {
			
			n -= 111;
			
			if (n <= 0) {
				intAns = i;
				break;
			}
		}
		
		String ans = String.valueOf(intAns);
		
		System.out.println(ans + ans + ans);
	}
}