import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		
		for(int i = n; i < 1000; i++) {
			if(i==111 || i == 222 || i== 333 || i == 444 || i == 555 || i == 666 || i == 777 || i == 888 || i == 999) {
				System.out.println(i);
				return;
			}
			
			
		}
		
		
	}

} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		
		for(int i = n; i < 1000; i++) {
			if(i==111 || i == 222 || i== 333 || i == 444 || i == 555 || i == 666 || i == 777 || i == 888 || i == 999) {
				System.out.println(i);
				return;
			}
			
			
		}
		
		
	}

} Main public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		
		for(int i = n; i < 1000; i++) {
			if(i==111 || i == 222 || i== 333 || i == 444 || i == 555 || i == 666 || i == 777 || i == 888 || i == 999) {
				System.out.println(i);
				return;
			}
			
			
		}
		
		
	} main {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		
		for(int i = n; i < 1000; i++) {
			if(i==111 || i == 222 || i== 333 || i == 444 || i == 555 || i == 666 || i == 777 || i == 888 || i == 999) {
				System.out.println(i);
				return;
			}
			
			
		}
		
		
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn for(int i = n; i < 1000; i++) {
			if(i==111 || i == 222 || i== 333 || i == 444 || i == 555 || i == 666 || i == 777 || i == 888 || i == 999) {
				System.out.println(i);
				return;
			}
			
			
		} int i = n; int i = n; i n i < 1000 i 1000 i++ i++ i {
			if(i==111 || i == 222 || i== 333 || i == 444 || i == 555 || i == 666 || i == 777 || i == 888 || i == 999) {
				System.out.println(i);
				return;
			}
			
			
		} {
			if(i==111 || i == 222 || i== 333 || i == 444 || i == 555 || i == 666 || i == 777 || i == 888 || i == 999) {
				System.out.println(i);
				return;
			}
			
			
		} if(i==111 || i == 222 || i== 333 || i == 444 || i == 555 || i == 666 || i == 777 || i == 888 || i == 999) {
				System.out.println(i);
				return;
			} i==111 || i == 222 || i== 333 || i == 444 || i == 555 || i == 666 || i == 777 || i == 888 || i == 999 i == 888 i == 777 i == 666 i == 555 i == 444 i== 333 i==111 || i == 222 || i== 333 || i == 444 || i == 555 || i == 666 || i == 777 || i == 888 || i == 999 i==111 i 111 i == 222 i 222 i== 333 i 333 i == 444 i 444 i == 555 i 555 i == 666 i 666 i == 777 i 777 i == 888 i 888 i == 999 i 999 {
				System.out.println(i);
				return;
			} System.out.println(i) System.out.println System.out System System.out i return; String[] args args public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		
		for(int i = n; i < 1000; i++) {
			if(i==111 || i == 222 || i== 333 || i == 444 || i == 555 || i == 666 || i == 777 || i == 888 || i == 999) {
				System.out.println(i);
				return;
			}
			
			
		}
		
		
	}

} public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		
		for(int i = n; i < 1000; i++) {
			if(i==111 || i == 222 || i== 333 || i == 444 || i == 555 || i == 666 || i == 777 || i == 888 || i == 999) {
				System.out.println(i);
				return;
			}
			
			
		}
		
		
	}

} Main
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		
		for(int i = n; i < 1000; i++) {
			if(i==111 || i == 222 || i== 333 || i == 444 || i == 555 || i == 666 || i == 777 || i == 888 || i == 999) {
				System.out.println(i);
				return;
			}
			
			
		}
		
		
	}

}
