import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		int m = N / 111;
		if (N%111 != 0) {
			m += 1;
		}
		int t = m * 111;
		System.out.println(t);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		int m = N / 111;
		if (N%111 != 0) {
			m += 1;
		}
		int t = m * 111;
		System.out.println(t);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		int m = N / 111;
		if (N%111 != 0) {
			m += 1;
		}
		int t = m * 111;
		System.out.println(t);
	} main {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		int m = N / 111;
		if (N%111 != 0) {
			m += 1;
		}
		int t = m * 111;
		System.out.println(t);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int m = N / 111; m N / 111 N 111 if (N%111 != 0) {
			m += 1;
		} N%111 != 0 N%111 N 111 0 {
			m += 1;
		} m += 1 m 1 int t = m * 111; t m * 111 m 111 System.out.println(t) System.out.println System.out System System.out t String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		int m = N / 111;
		if (N%111 != 0) {
			m += 1;
		}
		int t = m * 111;
		System.out.println(t);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		int m = N / 111;
		if (N%111 != 0) {
			m += 1;
		}
		int t = m * 111;
		System.out.println(t);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		int m = N / 111;
		if (N%111 != 0) {
			m += 1;
		}
		int t = m * 111;
		System.out.println(t);
	}
}
