import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int n = scan.nextInt();

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

	int n = scan.nextInt();

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

	int n = scan.nextInt();

	if(n <= 111){
	    System.out.println(111);
	}else if(n <= 222){
	    System.out.println(222);
	}else if(n <= 333){
	    System.out.println(333);
	}else if(n <= 444){
	    System.out.println(444);
	}else if(n <= 555){
	    System.out.println(555);
	}else if(n <= 666){
	    System.out.println(666);
	}else if(n <= 777){
	    System.out.println(777);
	}else if(n <= 888){
	    System.out.println(888);
	}else{
	    System.out.println(999);
	}
    } main {
	Scanner scan = new Scanner(System.in);

	int n = scan.nextInt();

	if(n <= 111){
	    System.out.println(111);
	}else if(n <= 222){
	    System.out.println(222);
	}else if(n <= 333){
	    System.out.println(333);
	}else if(n <= 444){
	    System.out.println(444);
	}else if(n <= 555){
	    System.out.println(555);
	}else if(n <= 666){
	    System.out.println(666);
	}else if(n <= 777){
	    System.out.println(777);
	}else if(n <= 888){
	    System.out.println(888);
	}else{
	    System.out.println(999);
	}
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan if(n <= 111){
	    System.out.println(111);
	}else if(n <= 222){
	    System.out.println(222);
	}else if(n <= 333){
	    System.out.println(333);
	}else if(n <= 444){
	    System.out.println(444);
	}else if(n <= 555){
	    System.out.println(555);
	}else if(n <= 666){
	    System.out.println(666);
	}else if(n <= 777){
	    System.out.println(777);
	}else if(n <= 888){
	    System.out.println(888);
	}else{
	    System.out.println(999);
	} n <= 111 n 111 {
	    System.out.println(111);
	} System.out.println(111) System.out.println System.out System System.out 111 if(n <= 222){
	    System.out.println(222);
	}else if(n <= 333){
	    System.out.println(333);
	}else if(n <= 444){
	    System.out.println(444);
	}else if(n <= 555){
	    System.out.println(555);
	}else if(n <= 666){
	    System.out.println(666);
	}else if(n <= 777){
	    System.out.println(777);
	}else if(n <= 888){
	    System.out.println(888);
	}else{
	    System.out.println(999);
	} n <= 222 n 222 {
	    System.out.println(222);
	} System.out.println(222) System.out.println System.out System System.out 222 if(n <= 333){
	    System.out.println(333);
	}else if(n <= 444){
	    System.out.println(444);
	}else if(n <= 555){
	    System.out.println(555);
	}else if(n <= 666){
	    System.out.println(666);
	}else if(n <= 777){
	    System.out.println(777);
	}else if(n <= 888){
	    System.out.println(888);
	}else{
	    System.out.println(999);
	} n <= 333 n 333 {
	    System.out.println(333);
	} System.out.println(333) System.out.println System.out System System.out 333 if(n <= 444){
	    System.out.println(444);
	}else if(n <= 555){
	    System.out.println(555);
	}else if(n <= 666){
	    System.out.println(666);
	}else if(n <= 777){
	    System.out.println(777);
	}else if(n <= 888){
	    System.out.println(888);
	}else{
	    System.out.println(999);
	} n <= 444 n 444 {
	    System.out.println(444);
	} System.out.println(444) System.out.println System.out System System.out 444 if(n <= 555){
	    System.out.println(555);
	}else if(n <= 666){
	    System.out.println(666);
	}else if(n <= 777){
	    System.out.println(777);
	}else if(n <= 888){
	    System.out.println(888);
	}else{
	    System.out.println(999);
	} n <= 555 n 555 {
	    System.out.println(555);
	} System.out.println(555) System.out.println System.out System System.out 555 if(n <= 666){
	    System.out.println(666);
	}else if(n <= 777){
	    System.out.println(777);
	}else if(n <= 888){
	    System.out.println(888);
	}else{
	    System.out.println(999);
	} n <= 666 n 666 {
	    System.out.println(666);
	} System.out.println(666) System.out.println System.out System System.out 666 if(n <= 777){
	    System.out.println(777);
	}else if(n <= 888){
	    System.out.println(888);
	}else{
	    System.out.println(999);
	} n <= 777 n 777 {
	    System.out.println(777);
	} System.out.println(777) System.out.println System.out System System.out 777 if(n <= 888){
	    System.out.println(888);
	}else{
	    System.out.println(999);
	} n <= 888 n 888 {
	    System.out.println(888);
	} System.out.println(888) System.out.println System.out System System.out 888 {
	    System.out.println(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 scan = new Scanner(System.in);

	int n = scan.nextInt();

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

	int n = scan.nextInt();

	if(n <= 111){
	    System.out.println(111);
	}else if(n <= 222){
	    System.out.println(222);
	}else if(n <= 333){
	    System.out.println(333);
	}else if(n <= 444){
	    System.out.println(444);
	}else if(n <= 555){
	    System.out.println(555);
	}else if(n <= 666){
	    System.out.println(666);
	}else if(n <= 777){
	    System.out.println(777);
	}else if(n <= 888){
	    System.out.println(888);
	}else{
	    System.out.println(999);
	}
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int n = scan.nextInt();

	if(n <= 111){
	    System.out.println(111);
	}else if(n <= 222){
	    System.out.println(222);
	}else if(n <= 333){
	    System.out.println(333);
	}else if(n <= 444){
	    System.out.println(444);
	}else if(n <= 555){
	    System.out.println(555);
	}else if(n <= 666){
	    System.out.println(666);
	}else if(n <= 777){
	    System.out.println(777);
	}else if(n <= 888){
	    System.out.println(888);
	}else{
	    System.out.println(999);
	}
    }
}
