import java.util.Scanner;

 class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans[] = {111,222,333,444,555,666,777,888,999};
		int val=111;
		for(int i=1;i<ans.length;i++) {
			if(n==ans[i]) {
				val=ans[i];break;
			} else
			if(ans[i-1]<n && ans[i]>=n) {
				val=ans[i];break;
			}
				
		}
		System.out.println(val);
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans[] = {111,222,333,444,555,666,777,888,999};
		int val=111;
		for(int i=1;i<ans.length;i++) {
			if(n==ans[i]) {
				val=ans[i];break;
			} else
			if(ans[i-1]<n && ans[i]>=n) {
				val=ans[i];break;
			}
				
		}
		System.out.println(val);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans[] = {111,222,333,444,555,666,777,888,999};
		int val=111;
		for(int i=1;i<ans.length;i++) {
			if(n==ans[i]) {
				val=ans[i];break;
			} else
			if(ans[i-1]<n && ans[i]>=n) {
				val=ans[i];break;
			}
				
		}
		System.out.println(val);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans[] = {111,222,333,444,555,666,777,888,999};
		int val=111;
		for(int i=1;i<ans.length;i++) {
			if(n==ans[i]) {
				val=ans[i];break;
			} else
			if(ans[i-1]<n && ans[i]>=n) {
				val=ans[i];break;
			}
				
		}
		System.out.println(val);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int ans[] = {111,222,333,444,555,666,777,888,999}; ans {111,222,333,444,555,666,777,888,999} 111 222 333 444 555 666 777 888 999 int val=111; val 111 for(int i=1;i<ans.length;i++) {
			if(n==ans[i]) {
				val=ans[i];break;
			} else
			if(ans[i-1]<n && ans[i]>=n) {
				val=ans[i];break;
			}
				
		} int i=1; int i=1; i 1 i<ans.length i ans.length ans ans.length i++ i++ i {
			if(n==ans[i]) {
				val=ans[i];break;
			} else
			if(ans[i-1]<n && ans[i]>=n) {
				val=ans[i];break;
			}
				
		} {
			if(n==ans[i]) {
				val=ans[i];break;
			} else
			if(ans[i-1]<n && ans[i]>=n) {
				val=ans[i];break;
			}
				
		} if(n==ans[i]) {
				val=ans[i];break;
			} else
			if(ans[i-1]<n && ans[i]>=n) {
				val=ans[i];break;
			} n==ans[i] n ans[i] ans i {
				val=ans[i];break;
			} val=ans[i] val ans[i] ans i break; if(ans[i-1]<n && ans[i]>=n) {
				val=ans[i];break;
			} ans[i-1]<n && ans[i]>=n ans[i-1]<n ans[i-1] ans i-1 i 1 n ans[i]>=n ans[i] ans i n {
				val=ans[i];break;
			} val=ans[i] val ans[i] ans i break; System.out.println(val) System.out.println System.out System System.out val String[] args args
import java.util.Scanner;

 class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans[] = {111,222,333,444,555,666,777,888,999};
		int val=111;
		for(int i=1;i<ans.length;i++) {
			if(n==ans[i]) {
				val=ans[i];break;
			} else
			if(ans[i-1]<n && ans[i]>=n) {
				val=ans[i];break;
			}
				
		}
		System.out.println(val);
	}
}
