import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String temp = String.valueOf(n/100);
		int tem = Integer.parseInt(temp+temp+temp);
		if (n <= tem) {
			System.out.println(tem);
		} else {
			System.out.println(tem+111);
		}
	}
} 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();
		String temp = String.valueOf(n/100);
		int tem = Integer.parseInt(temp+temp+temp);
		if (n <= tem) {
			System.out.println(tem);
		} else {
			System.out.println(tem+111);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String temp = String.valueOf(n/100);
		int tem = Integer.parseInt(temp+temp+temp);
		if (n <= tem) {
			System.out.println(tem);
		} else {
			System.out.println(tem+111);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String temp = String.valueOf(n/100);
		int tem = Integer.parseInt(temp+temp+temp);
		if (n <= tem) {
			System.out.println(tem);
		} else {
			System.out.println(tem+111);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc String temp = String.valueOf(n/100); temp String.valueOf(n/100) String.valueOf String n/100 n 100 int tem = Integer.parseInt(temp+temp+temp); tem Integer.parseInt(temp+temp+temp) Integer.parseInt Integer temp+temp+temp temp+temp+temp temp temp temp if (n <= tem) {
			System.out.println(tem);
		} else {
			System.out.println(tem+111);
		} n <= tem n tem {
			System.out.println(tem);
		} System.out.println(tem) System.out.println System.out System System.out tem {
			System.out.println(tem+111);
		} System.out.println(tem+111) System.out.println System.out System System.out tem+111 tem 111 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();
		String temp = String.valueOf(n/100);
		int tem = Integer.parseInt(temp+temp+temp);
		if (n <= tem) {
			System.out.println(tem);
		} else {
			System.out.println(tem+111);
		}
	}
}
