import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n <= 111)System.out.println("111");
		else if(n > 111 && n <= 222)System.out.println("222");
		else if(n > 222 && n <= 333)System.out.println("333");
		else if(n > 333 && n <= 444)System.out.println("444");
		else if(n > 444 && n <= 555)System.out.println("555");
		else if(n > 555 && n <= 666)System.out.println("666");
		else if(n > 666 && n <= 777)System.out.println("777");
		else if(n > 777 && n <= 888)System.out.println("888");
		else if(n > 888 && n <= 999)System.out.println("999");
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n <= 111)System.out.println("111");
		else if(n > 111 && n <= 222)System.out.println("222");
		else if(n > 222 && n <= 333)System.out.println("333");
		else if(n > 333 && n <= 444)System.out.println("444");
		else if(n > 444 && n <= 555)System.out.println("555");
		else if(n > 555 && n <= 666)System.out.println("666");
		else if(n > 666 && n <= 777)System.out.println("777");
		else if(n > 777 && n <= 888)System.out.println("888");
		else if(n > 888 && n <= 999)System.out.println("999");
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n <= 111)System.out.println("111");
		else if(n > 111 && n <= 222)System.out.println("222");
		else if(n > 222 && n <= 333)System.out.println("333");
		else if(n > 333 && n <= 444)System.out.println("444");
		else if(n > 444 && n <= 555)System.out.println("555");
		else if(n > 555 && n <= 666)System.out.println("666");
		else if(n > 666 && n <= 777)System.out.println("777");
		else if(n > 777 && n <= 888)System.out.println("888");
		else if(n > 888 && n <= 999)System.out.println("999");
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n <= 111)System.out.println("111");
		else if(n > 111 && n <= 222)System.out.println("222");
		else if(n > 222 && n <= 333)System.out.println("333");
		else if(n > 333 && n <= 444)System.out.println("444");
		else if(n > 444 && n <= 555)System.out.println("555");
		else if(n > 555 && n <= 666)System.out.println("666");
		else if(n > 666 && n <= 777)System.out.println("777");
		else if(n > 777 && n <= 888)System.out.println("888");
		else if(n > 888 && n <= 999)System.out.println("999");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc if(n <= 111)System.out.println("111");
		else if(n > 111 && n <= 222)System.out.println("222");
		else if(n > 222 && n <= 333)System.out.println("333");
		else if(n > 333 && n <= 444)System.out.println("444");
		else if(n > 444 && n <= 555)System.out.println("555");
		else if(n > 555 && n <= 666)System.out.println("666");
		else if(n > 666 && n <= 777)System.out.println("777");
		else if(n > 777 && n <= 888)System.out.println("888");
		else if(n > 888 && n <= 999)System.out.println("999"); n <= 111 n 111 System.out.println("111") System.out.println System.out System System.out "111" if(n > 111 && n <= 222)System.out.println("222");
		else if(n > 222 && n <= 333)System.out.println("333");
		else if(n > 333 && n <= 444)System.out.println("444");
		else if(n > 444 && n <= 555)System.out.println("555");
		else if(n > 555 && n <= 666)System.out.println("666");
		else if(n > 666 && n <= 777)System.out.println("777");
		else if(n > 777 && n <= 888)System.out.println("888");
		else if(n > 888 && n <= 999)System.out.println("999"); n > 111 && n <= 222 n > 111 n 111 n <= 222 n 222 System.out.println("222") System.out.println System.out System System.out "222" if(n > 222 && n <= 333)System.out.println("333");
		else if(n > 333 && n <= 444)System.out.println("444");
		else if(n > 444 && n <= 555)System.out.println("555");
		else if(n > 555 && n <= 666)System.out.println("666");
		else if(n > 666 && n <= 777)System.out.println("777");
		else if(n > 777 && n <= 888)System.out.println("888");
		else if(n > 888 && n <= 999)System.out.println("999"); n > 222 && n <= 333 n > 222 n 222 n <= 333 n 333 System.out.println("333") System.out.println System.out System System.out "333" if(n > 333 && n <= 444)System.out.println("444");
		else if(n > 444 && n <= 555)System.out.println("555");
		else if(n > 555 && n <= 666)System.out.println("666");
		else if(n > 666 && n <= 777)System.out.println("777");
		else if(n > 777 && n <= 888)System.out.println("888");
		else if(n > 888 && n <= 999)System.out.println("999"); n > 333 && n <= 444 n > 333 n 333 n <= 444 n 444 System.out.println("444") System.out.println System.out System System.out "444" if(n > 444 && n <= 555)System.out.println("555");
		else if(n > 555 && n <= 666)System.out.println("666");
		else if(n > 666 && n <= 777)System.out.println("777");
		else if(n > 777 && n <= 888)System.out.println("888");
		else if(n > 888 && n <= 999)System.out.println("999"); n > 444 && n <= 555 n > 444 n 444 n <= 555 n 555 System.out.println("555") System.out.println System.out System System.out "555" if(n > 555 && n <= 666)System.out.println("666");
		else if(n > 666 && n <= 777)System.out.println("777");
		else if(n > 777 && n <= 888)System.out.println("888");
		else if(n > 888 && n <= 999)System.out.println("999"); n > 555 && n <= 666 n > 555 n 555 n <= 666 n 666 System.out.println("666") System.out.println System.out System System.out "666" if(n > 666 && n <= 777)System.out.println("777");
		else if(n > 777 && n <= 888)System.out.println("888");
		else if(n > 888 && n <= 999)System.out.println("999"); n > 666 && n <= 777 n > 666 n 666 n <= 777 n 777 System.out.println("777") System.out.println System.out System System.out "777" if(n > 777 && n <= 888)System.out.println("888");
		else if(n > 888 && n <= 999)System.out.println("999"); n > 777 && n <= 888 n > 777 n 777 n <= 888 n 888 System.out.println("888") System.out.println System.out System System.out "888" if(n > 888 && n <= 999)System.out.println("999"); n > 888 && n <= 999 n > 888 n 888 n <= 999 n 999 System.out.println("999") System.out.println System.out System System.out "999" String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n <= 111)System.out.println("111");
		else if(n > 111 && n <= 222)System.out.println("222");
		else if(n > 222 && n <= 333)System.out.println("333");
		else if(n > 333 && n <= 444)System.out.println("444");
		else if(n > 444 && n <= 555)System.out.println("555");
		else if(n > 555 && n <= 666)System.out.println("666");
		else if(n > 666 && n <= 777)System.out.println("777");
		else if(n > 777 && n <= 888)System.out.println("888");
		else if(n > 888 && n <= 999)System.out.println("999");
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n <= 111)System.out.println("111");
		else if(n > 111 && n <= 222)System.out.println("222");
		else if(n > 222 && n <= 333)System.out.println("333");
		else if(n > 333 && n <= 444)System.out.println("444");
		else if(n > 444 && n <= 555)System.out.println("555");
		else if(n > 555 && n <= 666)System.out.println("666");
		else if(n > 666 && n <= 777)System.out.println("777");
		else if(n > 777 && n <= 888)System.out.println("888");
		else if(n > 888 && n <= 999)System.out.println("999");
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n <= 111)System.out.println("111");
		else if(n > 111 && n <= 222)System.out.println("222");
		else if(n > 222 && n <= 333)System.out.println("333");
		else if(n > 333 && n <= 444)System.out.println("444");
		else if(n > 444 && n <= 555)System.out.println("555");
		else if(n > 555 && n <= 666)System.out.println("666");
		else if(n > 666 && n <= 777)System.out.println("777");
		else if(n > 777 && n <= 888)System.out.println("888");
		else if(n > 888 && n <= 999)System.out.println("999");
	}
}