import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[10];
		int N = sc.nextInt();
		for (int i=1;i<10;i++) {
			a[i-1] = i*100+i*10+i;
		}
		for (int i=0;i<10;i++) {
			if (N<=a[i]) {
				System.out.println(a[i]);
				return ;
			}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[10];
		int N = sc.nextInt();
		for (int i=1;i<10;i++) {
			a[i-1] = i*100+i*10+i;
		}
		for (int i=0;i<10;i++) {
			if (N<=a[i]) {
				System.out.println(a[i]);
				return ;
			}
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[10];
		int N = sc.nextInt();
		for (int i=1;i<10;i++) {
			a[i-1] = i*100+i*10+i;
		}
		for (int i=0;i<10;i++) {
			if (N<=a[i]) {
				System.out.println(a[i]);
				return ;
			}
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[10];
		int N = sc.nextInt();
		for (int i=1;i<10;i++) {
			a[i-1] = i*100+i*10+i;
		}
		for (int i=0;i<10;i++) {
			if (N<=a[i]) {
				System.out.println(a[i]);
				return ;
			}
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a[] = new int[10]; a new int[10] 10 int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc for (int i=1;i<10;i++) {
			a[i-1] = i*100+i*10+i;
		} int i=1; int i=1; i 1 i<10 i 10 i++ i++ i {
			a[i-1] = i*100+i*10+i;
		} {
			a[i-1] = i*100+i*10+i;
		} a[i-1] = i*100+i*10+i a[i-1] a i-1 i 1 i*100+i*10+i i*100+i*10+i i*100 i 100 i*10 i 10 i for (int i=0;i<10;i++) {
			if (N<=a[i]) {
				System.out.println(a[i]);
				return ;
			}
		} int i=0; int i=0; i 0 i<10 i 10 i++ i++ i {
			if (N<=a[i]) {
				System.out.println(a[i]);
				return ;
			}
		} {
			if (N<=a[i]) {
				System.out.println(a[i]);
				return ;
			}
		} if (N<=a[i]) {
				System.out.println(a[i]);
				return ;
			} N<=a[i] N a[i] a i {
				System.out.println(a[i]);
				return ;
			} System.out.println(a[i]) System.out.println System.out System System.out a[i] a i return ; String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[10];
		int N = sc.nextInt();
		for (int i=1;i<10;i++) {
			a[i-1] = i*100+i*10+i;
		}
		for (int i=0;i<10;i++) {
			if (N<=a[i]) {
				System.out.println(a[i]);
				return ;
			}
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[10];
		int N = sc.nextInt();
		for (int i=1;i<10;i++) {
			a[i-1] = i*100+i*10+i;
		}
		for (int i=0;i<10;i++) {
			if (N<=a[i]) {
				System.out.println(a[i]);
				return ;
			}
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[10];
		int N = sc.nextInt();
		for (int i=1;i<10;i++) {
			a[i-1] = i*100+i*10+i;
		}
		for (int i=0;i<10;i++) {
			if (N<=a[i]) {
				System.out.println(a[i]);
				return ;
			}
		}
	}
}