import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int ans = N % 111 == 0 ? N / 111 * 111 : (N / 111 + 1) * 111;
        System.out.println(ans);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int ans = N % 111 == 0 ? N / 111 * 111 : (N / 111 + 1) * 111;
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    } main {
        Main main = new Main();
        main.solve();
    } Main main = new Main(); main new Main() main.solve() main.solve main String[] args args public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int ans = N % 111 == 0 ? N / 111 * 111 : (N / 111 + 1) * 111;
        System.out.println(ans);
    } solve {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int ans = N % 111 == 0 ? N / 111 * 111 : (N / 111 + 1) * 111;
        System.out.println(ans);
    } Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in))); scan new Scanner(new BufferedReader(new InputStreamReader(System.in))) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int ans = N % 111 == 0 ? N / 111 * 111 : (N / 111 + 1) * 111; ans N % 111 == 0 ? N / 111 * 111 : (N / 111 + 1) * 111 N % 111 == 0 N % 111 N 111 0 N / 111 * 111 N / 111 N 111 111 (N / 111 + 1) * 111 (N / 111 + 1) N / 111 N 111 1 111 System.out.println(ans) System.out.println System.out System System.out ans public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int ans = N % 111 == 0 ? N / 111 * 111 : (N / 111 + 1) * 111;
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int ans = N % 111 == 0 ? N / 111 * 111 : (N / 111 + 1) * 111;
        System.out.println(ans);
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int ans = N % 111 == 0 ? N / 111 * 111 : (N / 111 + 1) * 111;
        System.out.println(ans);
    }
}
