import java.util.*;

public class Main {

    public static void main(String[] args) {
	    // write your code here
        Scanner sc = new Scanner(System.in);

        // 整数の入力
        int n = sc.nextInt();
        int ans = 0;

        int index= 0;
        while(true) {
            index++;
            int value = index * 111;
            if (value >= n) {
                ans = value;
                break;
            }
        }

        // 出力
        System.out.println(ans);
    }
} import java.util.*; util.* java public class Main {

    public static void main(String[] args) {
	    // write your code here
        Scanner sc = new Scanner(System.in);

        // 整数の入力
        int n = sc.nextInt();
        int ans = 0;

        int index= 0;
        while(true) {
            index++;
            int value = index * 111;
            if (value >= n) {
                ans = value;
                break;
            }
        }

        // 出力
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
	    // write your code here
        Scanner sc = new Scanner(System.in);

        // 整数の入力
        int n = sc.nextInt();
        int ans = 0;

        int index= 0;
        while(true) {
            index++;
            int value = index * 111;
            if (value >= n) {
                ans = value;
                break;
            }
        }

        // 出力
        System.out.println(ans);
    } main {
	    // write your code here
        Scanner sc = new Scanner(System.in);

        // 整数の入力
        int n = sc.nextInt();
        int ans = 0;

        int index= 0;
        while(true) {
            index++;
            int value = index * 111;
            if (value >= n) {
                ans = value;
                break;
            }
        }

        // 出力
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int ans = 0; ans 0 int index= 0; index 0 while(true) {
            index++;
            int value = index * 111;
            if (value >= n) {
                ans = value;
                break;
            }
        } true {
            index++;
            int value = index * 111;
            if (value >= n) {
                ans = value;
                break;
            }
        } index++ index int value = index * 111; value index * 111 index 111 if (value >= n) {
                ans = value;
                break;
            } value >= n value n {
                ans = value;
                break;
            } ans = value ans value break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

    public static void main(String[] args) {
	    // write your code here
        Scanner sc = new Scanner(System.in);

        // 整数の入力
        int n = sc.nextInt();
        int ans = 0;

        int index= 0;
        while(true) {
            index++;
            int value = index * 111;
            if (value >= n) {
                ans = value;
                break;
            }
        }

        // 出力
        System.out.println(ans);
    }
} public class Main {

    public static void main(String[] args) {
	    // write your code here
        Scanner sc = new Scanner(System.in);

        // 整数の入力
        int n = sc.nextInt();
        int ans = 0;

        int index= 0;
        while(true) {
            index++;
            int value = index * 111;
            if (value >= n) {
                ans = value;
                break;
            }
        }

        // 出力
        System.out.println(ans);
    }
} Main
import java.util.*;

public class Main {

    public static void main(String[] args) {
	    // write your code here
        Scanner sc = new Scanner(System.in);

        // 整数の入力
        int n = sc.nextInt();
        int ans = 0;

        int index= 0;
        while(true) {
            index++;
            int value = index * 111;
            if (value >= n) {
                ans = value;
                break;
            }
        }

        // 出力
        System.out.println(ans);
    }
}
