import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		
		for (int i=a;;i++){
			String s = String.valueOf(i);
			char c1 = s.charAt(0);
			char c2 = s.charAt(1);
			char c3 = s.charAt(2);
			
			if ((c1 == c2) && (c1 == c3)){
				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);
		int a = sc.nextInt();
		
		for (int i=a;;i++){
			String s = String.valueOf(i);
			char c1 = s.charAt(0);
			char c2 = s.charAt(1);
			char c3 = s.charAt(2);
			
			if ((c1 == c2) && (c1 == c3)){
				System.out.println(i);
				break;
			}
		}
		
		
		
	}

} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		
		for (int i=a;;i++){
			String s = String.valueOf(i);
			char c1 = s.charAt(0);
			char c2 = s.charAt(1);
			char c3 = s.charAt(2);
			
			if ((c1 == c2) && (c1 == c3)){
				System.out.println(i);
				break;
			}
		}
		
		
		
	} main {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		
		for (int i=a;;i++){
			String s = String.valueOf(i);
			char c1 = s.charAt(0);
			char c2 = s.charAt(1);
			char c3 = s.charAt(2);
			
			if ((c1 == c2) && (c1 == c3)){
				System.out.println(i);
				break;
			}
		}
		
		
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc for (int i=a;;i++){
			String s = String.valueOf(i);
			char c1 = s.charAt(0);
			char c2 = s.charAt(1);
			char c3 = s.charAt(2);
			
			if ((c1 == c2) && (c1 == c3)){
				System.out.println(i);
				break;
			}
		} int i=a; int i=a; i a i++ i++ i {
			String s = String.valueOf(i);
			char c1 = s.charAt(0);
			char c2 = s.charAt(1);
			char c3 = s.charAt(2);
			
			if ((c1 == c2) && (c1 == c3)){
				System.out.println(i);
				break;
			}
		} {
			String s = String.valueOf(i);
			char c1 = s.charAt(0);
			char c2 = s.charAt(1);
			char c3 = s.charAt(2);
			
			if ((c1 == c2) && (c1 == c3)){
				System.out.println(i);
				break;
			}
		} String s = String.valueOf(i); s String.valueOf(i) String.valueOf String i char c1 = s.charAt(0); c1 s.charAt(0) s.charAt s 0 char c2 = s.charAt(1); c2 s.charAt(1) s.charAt s 1 char c3 = s.charAt(2); c3 s.charAt(2) s.charAt s 2 if ((c1 == c2) && (c1 == c3)){
				System.out.println(i);
				break;
			} (c1 == c2) && (c1 == c3) (c1 == c2) c1 c2 (c1 == c3) c1 c3 {
				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);
		int a = sc.nextInt();
		
		for (int i=a;;i++){
			String s = String.valueOf(i);
			char c1 = s.charAt(0);
			char c2 = s.charAt(1);
			char c3 = s.charAt(2);
			
			if ((c1 == c2) && (c1 == c3)){
				System.out.println(i);
				break;
			}
		}
		
		
		
	}

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		
		for (int i=a;;i++){
			String s = String.valueOf(i);
			char c1 = s.charAt(0);
			char c2 = s.charAt(1);
			char c3 = s.charAt(2);
			
			if ((c1 == c2) && (c1 == c3)){
				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);
		int a = sc.nextInt();
		
		for (int i=a;;i++){
			String s = String.valueOf(i);
			char c1 = s.charAt(0);
			char c2 = s.charAt(1);
			char c3 = s.charAt(2);
			
			if ((c1 == c2) && (c1 == c3)){
				System.out.println(i);
				break;
			}
		}
		
		
		
	}

}
