import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int i = scanner.nextInt();
        if(i <= 111){
            System.out.println("111");
        }else if(i <= 222){
            System.out.println("222");
        }else if(i <= 333){
            System.out.println("333");
        }else if(i <= 444){
            System.out.println("444");
        }else if(i <= 555){
            System.out.println("555");
        }else if(i <= 666 ){//悪魔の数字！フ　リ　ー　メ　イ　ソ　ン　！
            System.out.println("666");
        }else if(i <= 777){
            System.out.println("777");
        }else if(i <= 888){
            System.out.println("888");
        }else if(i <= 999){
            System.out.println("999");
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int i = scanner.nextInt();
        if(i <= 111){
            System.out.println("111");
        }else if(i <= 222){
            System.out.println("222");
        }else if(i <= 333){
            System.out.println("333");
        }else if(i <= 444){
            System.out.println("444");
        }else if(i <= 555){
            System.out.println("555");
        }else if(i <= 666 ){//悪魔の数字！フ　リ　ー　メ　イ　ソ　ン　！
            System.out.println("666");
        }else if(i <= 777){
            System.out.println("777");
        }else if(i <= 888){
            System.out.println("888");
        }else if(i <= 999){
            System.out.println("999");
        }
    }
} Main public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int i = scanner.nextInt();
        if(i <= 111){
            System.out.println("111");
        }else if(i <= 222){
            System.out.println("222");
        }else if(i <= 333){
            System.out.println("333");
        }else if(i <= 444){
            System.out.println("444");
        }else if(i <= 555){
            System.out.println("555");
        }else if(i <= 666 ){//悪魔の数字！フ　リ　ー　メ　イ　ソ　ン　！
            System.out.println("666");
        }else if(i <= 777){
            System.out.println("777");
        }else if(i <= 888){
            System.out.println("888");
        }else if(i <= 999){
            System.out.println("999");
        }
    } main {
        Scanner scanner = new Scanner(System.in);
        int i = scanner.nextInt();
        if(i <= 111){
            System.out.println("111");
        }else if(i <= 222){
            System.out.println("222");
        }else if(i <= 333){
            System.out.println("333");
        }else if(i <= 444){
            System.out.println("444");
        }else if(i <= 555){
            System.out.println("555");
        }else if(i <= 666 ){//悪魔の数字！フ　リ　ー　メ　イ　ソ　ン　！
            System.out.println("666");
        }else if(i <= 777){
            System.out.println("777");
        }else if(i <= 888){
            System.out.println("888");
        }else if(i <= 999){
            System.out.println("999");
        }
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int i = scanner.nextInt(); i scanner.nextInt() scanner.nextInt scanner if(i <= 111){
            System.out.println("111");
        }else if(i <= 222){
            System.out.println("222");
        }else if(i <= 333){
            System.out.println("333");
        }else if(i <= 444){
            System.out.println("444");
        }else if(i <= 555){
            System.out.println("555");
        }else if(i <= 666 ){//悪魔の数字！フ　リ　ー　メ　イ　ソ　ン　！
            System.out.println("666");
        }else if(i <= 777){
            System.out.println("777");
        }else if(i <= 888){
            System.out.println("888");
        }else if(i <= 999){
            System.out.println("999");
        } i <= 111 i 111 {
            System.out.println("111");
        } System.out.println("111") System.out.println System.out System System.out "111" if(i <= 222){
            System.out.println("222");
        }else if(i <= 333){
            System.out.println("333");
        }else if(i <= 444){
            System.out.println("444");
        }else if(i <= 555){
            System.out.println("555");
        }else if(i <= 666 ){//悪魔の数字！フ　リ　ー　メ　イ　ソ　ン　！
            System.out.println("666");
        }else if(i <= 777){
            System.out.println("777");
        }else if(i <= 888){
            System.out.println("888");
        }else if(i <= 999){
            System.out.println("999");
        } i <= 222 i 222 {
            System.out.println("222");
        } System.out.println("222") System.out.println System.out System System.out "222" if(i <= 333){
            System.out.println("333");
        }else if(i <= 444){
            System.out.println("444");
        }else if(i <= 555){
            System.out.println("555");
        }else if(i <= 666 ){//悪魔の数字！フ　リ　ー　メ　イ　ソ　ン　！
            System.out.println("666");
        }else if(i <= 777){
            System.out.println("777");
        }else if(i <= 888){
            System.out.println("888");
        }else if(i <= 999){
            System.out.println("999");
        } i <= 333 i 333 {
            System.out.println("333");
        } System.out.println("333") System.out.println System.out System System.out "333" if(i <= 444){
            System.out.println("444");
        }else if(i <= 555){
            System.out.println("555");
        }else if(i <= 666 ){//悪魔の数字！フ　リ　ー　メ　イ　ソ　ン　！
            System.out.println("666");
        }else if(i <= 777){
            System.out.println("777");
        }else if(i <= 888){
            System.out.println("888");
        }else if(i <= 999){
            System.out.println("999");
        } i <= 444 i 444 {
            System.out.println("444");
        } System.out.println("444") System.out.println System.out System System.out "444" if(i <= 555){
            System.out.println("555");
        }else if(i <= 666 ){//悪魔の数字！フ　リ　ー　メ　イ　ソ　ン　！
            System.out.println("666");
        }else if(i <= 777){
            System.out.println("777");
        }else if(i <= 888){
            System.out.println("888");
        }else if(i <= 999){
            System.out.println("999");
        } i <= 555 i 555 {
            System.out.println("555");
        } System.out.println("555") System.out.println System.out System System.out "555" if(i <= 666 ){//悪魔の数字！フ　リ　ー　メ　イ　ソ　ン　！
            System.out.println("666");
        }else if(i <= 777){
            System.out.println("777");
        }else if(i <= 888){
            System.out.println("888");
        }else if(i <= 999){
            System.out.println("999");
        } i <= 666 i 666 {//悪魔の数字！フ　リ　ー　メ　イ　ソ　ン　！
            System.out.println("666");
        } System.out.println("666") System.out.println System.out System System.out "666" if(i <= 777){
            System.out.println("777");
        }else if(i <= 888){
            System.out.println("888");
        }else if(i <= 999){
            System.out.println("999");
        } i <= 777 i 777 {
            System.out.println("777");
        } System.out.println("777") System.out.println System.out System System.out "777" if(i <= 888){
            System.out.println("888");
        }else if(i <= 999){
            System.out.println("999");
        } i <= 888 i 888 {
            System.out.println("888");
        } System.out.println("888") System.out.println System.out System System.out "888" if(i <= 999){
            System.out.println("999");
        } i <= 999 i 999 {
            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 scanner = new Scanner(System.in);
        int i = scanner.nextInt();
        if(i <= 111){
            System.out.println("111");
        }else if(i <= 222){
            System.out.println("222");
        }else if(i <= 333){
            System.out.println("333");
        }else if(i <= 444){
            System.out.println("444");
        }else if(i <= 555){
            System.out.println("555");
        }else if(i <= 666 ){//悪魔の数字！フ　リ　ー　メ　イ　ソ　ン　！
            System.out.println("666");
        }else if(i <= 777){
            System.out.println("777");
        }else if(i <= 888){
            System.out.println("888");
        }else if(i <= 999){
            System.out.println("999");
        }
    }
} public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int i = scanner.nextInt();
        if(i <= 111){
            System.out.println("111");
        }else if(i <= 222){
            System.out.println("222");
        }else if(i <= 333){
            System.out.println("333");
        }else if(i <= 444){
            System.out.println("444");
        }else if(i <= 555){
            System.out.println("555");
        }else if(i <= 666 ){//悪魔の数字！フ　リ　ー　メ　イ　ソ　ン　！
            System.out.println("666");
        }else if(i <= 777){
            System.out.println("777");
        }else if(i <= 888){
            System.out.println("888");
        }else if(i <= 999){
            System.out.println("999");
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int i = scanner.nextInt();
        if(i <= 111){
            System.out.println("111");
        }else if(i <= 222){
            System.out.println("222");
        }else if(i <= 333){
            System.out.println("333");
        }else if(i <= 444){
            System.out.println("444");
        }else if(i <= 555){
            System.out.println("555");
        }else if(i <= 666 ){//悪魔の数字！フ　リ　ー　メ　イ　ソ　ン　！
            System.out.println("666");
        }else if(i <= 777){
            System.out.println("777");
        }else if(i <= 888){
            System.out.println("888");
        }else if(i <= 999){
            System.out.println("999");
        }
    }
}