import java.io.*;
import java.math.*;
import java.util.*;

class Main {
    private static final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = Integer.parseInt(sc.nextLine());
        int x = 111;
        while (x < n) {
            x += 111;
        }
        System.out.println(x);
        sc.close();
    }
} import java.io.*; io.* java import java.math.*; math.* java import java.util.*; util.* java class Main {
    private static final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = Integer.parseInt(sc.nextLine());
        int x = 111;
        while (x < n) {
            x += 111;
        }
        System.out.println(x);
        sc.close();
    }
} Main private static final Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
        int n = Integer.parseInt(sc.nextLine());
        int x = 111;
        while (x < n) {
            x += 111;
        }
        System.out.println(x);
        sc.close();
    } main {
        int n = Integer.parseInt(sc.nextLine());
        int x = 111;
        while (x < n) {
            x += 111;
        }
        System.out.println(x);
        sc.close();
    } int n = Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int x = 111; x 111 while (x < n) {
            x += 111;
        } x < n x n {
            x += 111;
        } x += 111 x 111 System.out.println(x) System.out.println System.out System System.out x sc.close() sc.close sc String[] args args
import java.io.*;
import java.math.*;
import java.util.*;

class Main {
    private static final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = Integer.parseInt(sc.nextLine());
        int x = 111;
        while (x < n) {
            x += 111;
        }
        System.out.println(x);
        sc.close();
    }
}
