import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		int td = N.toCharArray()[0] - '0';
		if (td * 111 < Integer.parseInt(N)) {
			System.out.println((td + 1) * 111);
		} else {
			System.out.println(td * 111);
		}

		sc.close();

	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		int td = N.toCharArray()[0] - '0';
		if (td * 111 < Integer.parseInt(N)) {
			System.out.println((td + 1) * 111);
		} else {
			System.out.println(td * 111);
		}

		sc.close();

	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		int td = N.toCharArray()[0] - '0';
		if (td * 111 < Integer.parseInt(N)) {
			System.out.println((td + 1) * 111);
		} else {
			System.out.println(td * 111);
		}

		sc.close();

	} main {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		int td = N.toCharArray()[0] - '0';
		if (td * 111 < Integer.parseInt(N)) {
			System.out.println((td + 1) * 111);
		} else {
			System.out.println(td * 111);
		}

		sc.close();

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String N = sc.next(); N sc.next() sc.next sc int td = N.toCharArray()[0] - '0'; td N.toCharArray()[0] - '0' N.toCharArray()[0] N.toCharArray() N.toCharArray N 0 '0' if (td * 111 < Integer.parseInt(N)) {
			System.out.println((td + 1) * 111);
		} else {
			System.out.println(td * 111);
		} td * 111 < Integer.parseInt(N) td * 111 td 111 Integer.parseInt(N) Integer.parseInt Integer N {
			System.out.println((td + 1) * 111);
		} System.out.println((td + 1) * 111) System.out.println System.out System System.out (td + 1) * 111 (td + 1) td 1 111 {
			System.out.println(td * 111);
		} System.out.println(td * 111) System.out.println System.out System System.out td * 111 td 111 sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		int td = N.toCharArray()[0] - '0';
		if (td * 111 < Integer.parseInt(N)) {
			System.out.println((td + 1) * 111);
		} else {
			System.out.println(td * 111);
		}

		sc.close();

	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		int td = N.toCharArray()[0] - '0';
		if (td * 111 < Integer.parseInt(N)) {
			System.out.println((td + 1) * 111);
		} else {
			System.out.println(td * 111);
		}

		sc.close();

	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		int td = N.toCharArray()[0] - '0';
		if (td * 111 < Integer.parseInt(N)) {
			System.out.println((td + 1) * 111);
		} else {
			System.out.println(td * 111);
		}

		sc.close();

	}
}