
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int ans = 0;
		for (int i = 1; i <= 9 ; i++) {
			ans = 100 * i + 10 * i + 1 * i;
			if (ans >= n) {
				break;
			}
		}
		System.out.println(ans);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.List; List java.util 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 = 0;
		for (int i = 1; i <= 9 ; i++) {
			ans = 100 * i + 10 * i + 1 * i;
			if (ans >= n) {
				break;
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int ans = 0;
		for (int i = 1; i <= 9 ; i++) {
			ans = 100 * i + 10 * i + 1 * i;
			if (ans >= n) {
				break;
			}
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int ans = 0;
		for (int i = 1; i <= 9 ; i++) {
			ans = 100 * i + 10 * i + 1 * i;
			if (ans >= n) {
				break;
			}
		}
		System.out.println(ans);
	} 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 = 1; i <= 9 ; i++) {
			ans = 100 * i + 10 * i + 1 * i;
			if (ans >= n) {
				break;
			}
		} int i = 1; int i = 1; i 1 i <= 9 i 9 i++ i++ i {
			ans = 100 * i + 10 * i + 1 * i;
			if (ans >= n) {
				break;
			}
		} {
			ans = 100 * i + 10 * i + 1 * i;
			if (ans >= n) {
				break;
			}
		} ans = 100 * i + 10 * i + 1 * i ans 100 * i + 10 * i + 1 * i 100 * i + 10 * i + 1 * i 100 * i 100 i 10 * i 10 i 1 * i 1 i if (ans >= n) {
				break;
			} ans >= n ans n {
				break;
			} break; System.out.println(ans) System.out.println System.out System System.out ans String args[] args

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

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