import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] candidates = new int[9];
        candidates[0] = 111;
        candidates[1] = 222;
        candidates[2] = 333;
        candidates[3] = 444;
        candidates[4] = 555;
        candidates[5] = 666;
        candidates[6] = 777;
        candidates[7] = 888;
        candidates[8] = 999;
        for(int i = 0; i < candidates.length; i++) {
            if(candidates[i] >= n) {
                System.out.println(candidates[i]);
                return;
            }
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] candidates = new int[9];
        candidates[0] = 111;
        candidates[1] = 222;
        candidates[2] = 333;
        candidates[3] = 444;
        candidates[4] = 555;
        candidates[5] = 666;
        candidates[6] = 777;
        candidates[7] = 888;
        candidates[8] = 999;
        for(int i = 0; i < candidates.length; i++) {
            if(candidates[i] >= n) {
                System.out.println(candidates[i]);
                return;
            }
        }
    }
} Main public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] candidates = new int[9];
        candidates[0] = 111;
        candidates[1] = 222;
        candidates[2] = 333;
        candidates[3] = 444;
        candidates[4] = 555;
        candidates[5] = 666;
        candidates[6] = 777;
        candidates[7] = 888;
        candidates[8] = 999;
        for(int i = 0; i < candidates.length; i++) {
            if(candidates[i] >= n) {
                System.out.println(candidates[i]);
                return;
            }
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] candidates = new int[9];
        candidates[0] = 111;
        candidates[1] = 222;
        candidates[2] = 333;
        candidates[3] = 444;
        candidates[4] = 555;
        candidates[5] = 666;
        candidates[6] = 777;
        candidates[7] = 888;
        candidates[8] = 999;
        for(int i = 0; i < candidates.length; i++) {
            if(candidates[i] >= n) {
                System.out.println(candidates[i]);
                return;
            }
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] candidates = new int[9]; candidates new int[9] 9 candidates[0] = 111 candidates[0] candidates 0 111 candidates[1] = 222 candidates[1] candidates 1 222 candidates[2] = 333 candidates[2] candidates 2 333 candidates[3] = 444 candidates[3] candidates 3 444 candidates[4] = 555 candidates[4] candidates 4 555 candidates[5] = 666 candidates[5] candidates 5 666 candidates[6] = 777 candidates[6] candidates 6 777 candidates[7] = 888 candidates[7] candidates 7 888 candidates[8] = 999 candidates[8] candidates 8 999 for(int i = 0; i < candidates.length; i++) {
            if(candidates[i] >= n) {
                System.out.println(candidates[i]);
                return;
            }
        } int i = 0; int i = 0; i 0 i < candidates.length i candidates.length candidates candidates.length i++ i++ i {
            if(candidates[i] >= n) {
                System.out.println(candidates[i]);
                return;
            }
        } {
            if(candidates[i] >= n) {
                System.out.println(candidates[i]);
                return;
            }
        } if(candidates[i] >= n) {
                System.out.println(candidates[i]);
                return;
            } candidates[i] >= n candidates[i] candidates i n {
                System.out.println(candidates[i]);
                return;
            } System.out.println(candidates[i]) System.out.println System.out System System.out candidates[i] candidates i return; String args[] args public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] candidates = new int[9];
        candidates[0] = 111;
        candidates[1] = 222;
        candidates[2] = 333;
        candidates[3] = 444;
        candidates[4] = 555;
        candidates[5] = 666;
        candidates[6] = 777;
        candidates[7] = 888;
        candidates[8] = 999;
        for(int i = 0; i < candidates.length; i++) {
            if(candidates[i] >= n) {
                System.out.println(candidates[i]);
                return;
            }
        }
    }
} public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] candidates = new int[9];
        candidates[0] = 111;
        candidates[1] = 222;
        candidates[2] = 333;
        candidates[3] = 444;
        candidates[4] = 555;
        candidates[5] = 666;
        candidates[6] = 777;
        candidates[7] = 888;
        candidates[8] = 999;
        for(int i = 0; i < candidates.length; i++) {
            if(candidates[i] >= n) {
                System.out.println(candidates[i]);
                return;
            }
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] candidates = new int[9];
        candidates[0] = 111;
        candidates[1] = 222;
        candidates[2] = 333;
        candidates[3] = 444;
        candidates[4] = 555;
        candidates[5] = 666;
        candidates[6] = 777;
        candidates[7] = 888;
        candidates[8] = 999;
        for(int i = 0; i < candidates.length; i++) {
            if(candidates[i] >= n) {
                System.out.println(candidates[i]);
                return;
            }
        }
    }
}