import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n=scanner.nextInt();
		
		
		for(int i=n;i<=999;i++) {
			String s=String.valueOf(i);
			if(s.charAt(0)==s.charAt(1)&&s.charAt(1)==s.charAt(2)) {
				System.out.println(i);
				return;
			}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n=scanner.nextInt();
		
		
		for(int i=n;i<=999;i++) {
			String s=String.valueOf(i);
			if(s.charAt(0)==s.charAt(1)&&s.charAt(1)==s.charAt(2)) {
				System.out.println(i);
				return;
			}
		}
	}
} Main @SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n=scanner.nextInt();
		
		
		for(int i=n;i<=999;i++) {
			String s=String.valueOf(i);
			if(s.charAt(0)==s.charAt(1)&&s.charAt(1)==s.charAt(2)) {
				System.out.println(i);
				return;
			}
		}
	} main {
		Scanner scanner = new Scanner(System.in);
		int n=scanner.nextInt();
		
		
		for(int i=n;i<=999;i++) {
			String s=String.valueOf(i);
			if(s.charAt(0)==s.charAt(1)&&s.charAt(1)==s.charAt(2)) {
				System.out.println(i);
				return;
			}
		}
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n=scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner for(int i=n;i<=999;i++) {
			String s=String.valueOf(i);
			if(s.charAt(0)==s.charAt(1)&&s.charAt(1)==s.charAt(2)) {
				System.out.println(i);
				return;
			}
		} int i=n; int i=n; i n i<=999 i 999 i++ i++ i {
			String s=String.valueOf(i);
			if(s.charAt(0)==s.charAt(1)&&s.charAt(1)==s.charAt(2)) {
				System.out.println(i);
				return;
			}
		} {
			String s=String.valueOf(i);
			if(s.charAt(0)==s.charAt(1)&&s.charAt(1)==s.charAt(2)) {
				System.out.println(i);
				return;
			}
		} String s=String.valueOf(i); s String.valueOf(i) String.valueOf String i if(s.charAt(0)==s.charAt(1)&&s.charAt(1)==s.charAt(2)) {
				System.out.println(i);
				return;
			} s.charAt(0)==s.charAt(1)&&s.charAt(1)==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(1)==s.charAt(2) s.charAt(1) s.charAt s 1 s.charAt(2) s.charAt s 2 {
				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 {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n=scanner.nextInt();
		
		
		for(int i=n;i<=999;i++) {
			String s=String.valueOf(i);
			if(s.charAt(0)==s.charAt(1)&&s.charAt(1)==s.charAt(2)) {
				System.out.println(i);
				return;
			}
		}
	}
} public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n=scanner.nextInt();
		
		
		for(int i=n;i<=999;i++) {
			String s=String.valueOf(i);
			if(s.charAt(0)==s.charAt(1)&&s.charAt(1)==s.charAt(2)) {
				System.out.println(i);
				return;
			}
		}
	}
} Main
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n=scanner.nextInt();
		
		
		for(int i=n;i<=999;i++) {
			String s=String.valueOf(i);
			if(s.charAt(0)==s.charAt(1)&&s.charAt(1)==s.charAt(2)) {
				System.out.println(i);
				return;
			}
		}
	}
}