import java.util.Scanner;

class Main {
	public static void main(String[] args) {
	
	Scanner stdIn = new Scanner(System.in);
	
	int n = stdIn.nextShort();
	int n1 = 1;
	int n2;
	
	do {
	
		n2 = 100*n1 + 10*n1 + n1;
		
		if (n <= n2) {
			System.out.println(n2);
			return;
		}
		
		n1 = n1 + 1;
		
	} while (n1 <= 9);
	
	}
	
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args) {
	
	Scanner stdIn = new Scanner(System.in);
	
	int n = stdIn.nextShort();
	int n1 = 1;
	int n2;
	
	do {
	
		n2 = 100*n1 + 10*n1 + n1;
		
		if (n <= n2) {
			System.out.println(n2);
			return;
		}
		
		n1 = n1 + 1;
		
	} while (n1 <= 9);
	
	}
	
} Main public static void main(String[] args) {
	
	Scanner stdIn = new Scanner(System.in);
	
	int n = stdIn.nextShort();
	int n1 = 1;
	int n2;
	
	do {
	
		n2 = 100*n1 + 10*n1 + n1;
		
		if (n <= n2) {
			System.out.println(n2);
			return;
		}
		
		n1 = n1 + 1;
		
	} while (n1 <= 9);
	
	} main {
	
	Scanner stdIn = new Scanner(System.in);
	
	int n = stdIn.nextShort();
	int n1 = 1;
	int n2;
	
	do {
	
		n2 = 100*n1 + 10*n1 + n1;
		
		if (n <= n2) {
			System.out.println(n2);
			return;
		}
		
		n1 = n1 + 1;
		
	} while (n1 <= 9);
	
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int n = stdIn.nextShort(); n stdIn.nextShort() stdIn.nextShort stdIn int n1 = 1; n1 1 int n2; n2 do {
	
		n2 = 100*n1 + 10*n1 + n1;
		
		if (n <= n2) {
			System.out.println(n2);
			return;
		}
		
		n1 = n1 + 1;
		
	} while (n1 <= 9); n1 <= 9 n1 9 {
	
		n2 = 100*n1 + 10*n1 + n1;
		
		if (n <= n2) {
			System.out.println(n2);
			return;
		}
		
		n1 = n1 + 1;
		
	} n2 = 100*n1 + 10*n1 + n1 n2 100*n1 + 10*n1 + n1 100*n1 + 10*n1 + n1 100*n1 100 n1 10*n1 10 n1 n1 if (n <= n2) {
			System.out.println(n2);
			return;
		} n <= n2 n n2 {
			System.out.println(n2);
			return;
		} System.out.println(n2) System.out.println System.out System System.out n2 return; n1 = n1 + 1 n1 n1 + 1 n1 1 String[] args args
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
	
	Scanner stdIn = new Scanner(System.in);
	
	int n = stdIn.nextShort();
	int n1 = 1;
	int n2;
	
	do {
	
		n2 = 100*n1 + 10*n1 + n1;
		
		if (n <= n2) {
			System.out.println(n2);
			return;
		}
		
		n1 = n1 + 1;
		
	} while (n1 <= 9);
	
	}
	
}