import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();
		//100~999
		int ans=n;
		for(int i=n;i<1000;i++) {
			String s = String.valueOf(i);
			if(s.charAt(0)==s.charAt(1) && s.charAt(0)==s.charAt(2)) {
				ans=i;
				break;
			}
		}
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main{

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();
		//100~999
		int ans=n;
		for(int i=n;i<1000;i++) {
			String s = String.valueOf(i);
			if(s.charAt(0)==s.charAt(1) && s.charAt(0)==s.charAt(2)) {
				ans=i;
				break;
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();
		//100~999
		int ans=n;
		for(int i=n;i<1000;i++) {
			String s = String.valueOf(i);
			if(s.charAt(0)==s.charAt(1) && s.charAt(0)==s.charAt(2)) {
				ans=i;
				break;
			}
		}
		System.out.println(ans);
	} main {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();
		//100~999
		int ans=n;
		for(int i=n;i<1000;i++) {
			String s = String.valueOf(i);
			if(s.charAt(0)==s.charAt(1) && s.charAt(0)==s.charAt(2)) {
				ans=i;
				break;
			}
		}
		System.out.println(ans);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan scan.close() scan.close scan int ans=n; ans n for(int i=n;i<1000;i++) {
			String s = String.valueOf(i);
			if(s.charAt(0)==s.charAt(1) && s.charAt(0)==s.charAt(2)) {
				ans=i;
				break;
			}
		} int i=n; int i=n; i n i<1000 i 1000 i++ i++ i {
			String s = String.valueOf(i);
			if(s.charAt(0)==s.charAt(1) && s.charAt(0)==s.charAt(2)) {
				ans=i;
				break;
			}
		} {
			String s = String.valueOf(i);
			if(s.charAt(0)==s.charAt(1) && s.charAt(0)==s.charAt(2)) {
				ans=i;
				break;
			}
		} String s = String.valueOf(i); s String.valueOf(i) String.valueOf String i if(s.charAt(0)==s.charAt(1) && s.charAt(0)==s.charAt(2)) {
				ans=i;
				break;
			} s.charAt(0)==s.charAt(1) && s.charAt(0)==s.charAt(2) s.charAt(0)==s.charAt(1) s.charAt(0) s.charAt s 0 s.charAt(1) s.charAt s 1 s.charAt(0)==s.charAt(2) s.charAt(0) s.charAt s 0 s.charAt(2) s.charAt s 2 {
				ans=i;
				break;
			} ans=i ans i break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();
		//100~999
		int ans=n;
		for(int i=n;i<1000;i++) {
			String s = String.valueOf(i);
			if(s.charAt(0)==s.charAt(1) && s.charAt(0)==s.charAt(2)) {
				ans=i;
				break;
			}
		}
		System.out.println(ans);
	}
} public class Main{

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();
		//100~999
		int ans=n;
		for(int i=n;i<1000;i++) {
			String s = String.valueOf(i);
			if(s.charAt(0)==s.charAt(1) && s.charAt(0)==s.charAt(2)) {
				ans=i;
				break;
			}
		}
		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();
		//100~999
		int ans=n;
		for(int i=n;i<1000;i++) {
			String s = String.valueOf(i);
			if(s.charAt(0)==s.charAt(1) && s.charAt(0)==s.charAt(2)) {
				ans=i;
				break;
			}
		}
		System.out.println(ans);
	}
}