import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans=0;
		for(int i=N ; i<=999 ; i++) {
			if(check(i)) {
				ans = i;
				break;
			}
		}
		System.out.println(ans);
		sc.close();
	}
	static boolean check(int n) {
		int one = n%10; n/=10;
		int two = n%10; n/=10;
		int thr = n%10;
		if( (one==two) && (two==thr) ) {
			return true;
		}
		return false;
	}

} 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 ans=0;
		for(int i=N ; i<=999 ; i++) {
			if(check(i)) {
				ans = i;
				break;
			}
		}
		System.out.println(ans);
		sc.close();
	}
	static boolean check(int n) {
		int one = n%10; n/=10;
		int two = n%10; n/=10;
		int thr = n%10;
		if( (one==two) && (two==thr) ) {
			return true;
		}
		return false;
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans=0;
		for(int i=N ; i<=999 ; i++) {
			if(check(i)) {
				ans = i;
				break;
			}
		}
		System.out.println(ans);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans=0;
		for(int i=N ; i<=999 ; i++) {
			if(check(i)) {
				ans = i;
				break;
			}
		}
		System.out.println(ans);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int ans=0; ans 0 for(int i=N ; i<=999 ; i++) {
			if(check(i)) {
				ans = i;
				break;
			}
		} int i=N ; int i=N ; i N i<=999 i 999 i++ i++ i {
			if(check(i)) {
				ans = i;
				break;
			}
		} {
			if(check(i)) {
				ans = i;
				break;
			}
		} if(check(i)) {
				ans = i;
				break;
			} check(i) check i {
				ans = i;
				break;
			} ans = i ans i break; System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args static boolean check(int n) {
		int one = n%10; n/=10;
		int two = n%10; n/=10;
		int thr = n%10;
		if( (one==two) && (two==thr) ) {
			return true;
		}
		return false;
	} check {
		int one = n%10; n/=10;
		int two = n%10; n/=10;
		int thr = n%10;
		if( (one==two) && (two==thr) ) {
			return true;
		}
		return false;
	} int one = n%10; one n%10 n 10 n/=10 n 10 int two = n%10; two n%10 n 10 n/=10 n 10 int thr = n%10; thr n%10 n 10 if( (one==two) && (two==thr) ) {
			return true;
		} (one==two) && (two==thr) (one==two) one two (two==thr) two thr {
			return true;
		} return true; true return false; false int n n public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans=0;
		for(int i=N ; i<=999 ; i++) {
			if(check(i)) {
				ans = i;
				break;
			}
		}
		System.out.println(ans);
		sc.close();
	}
	static boolean check(int n) {
		int one = n%10; n/=10;
		int two = n%10; n/=10;
		int thr = n%10;
		if( (one==two) && (two==thr) ) {
			return true;
		}
		return false;
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans=0;
		for(int i=N ; i<=999 ; i++) {
			if(check(i)) {
				ans = i;
				break;
			}
		}
		System.out.println(ans);
		sc.close();
	}
	static boolean check(int n) {
		int one = n%10; n/=10;
		int two = n%10; n/=10;
		int thr = n%10;
		if( (one==two) && (two==thr) ) {
			return true;
		}
		return false;
	}

} 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 ans=0;
		for(int i=N ; i<=999 ; i++) {
			if(check(i)) {
				ans = i;
				break;
			}
		}
		System.out.println(ans);
		sc.close();
	}
	static boolean check(int n) {
		int one = n%10; n/=10;
		int two = n%10; n/=10;
		int thr = n%10;
		if( (one==two) && (two==thr) ) {
			return true;
		}
		return false;
	}

}
