import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        int N = Integer.parseInt(br.readLine());
        int x = 0;
        if (N <= 111) {
            x = 111;
        } else if (N <= 222) {
            x = 222;
        } else if (N <= 333) {
            x = 333;
        } else if (N <= 444) {
            x = 444;
        } else if (N <= 555) {
            x = 555;
        } else if (N <= 666) {
            x = 666;
        } else if (N <= 777) {
            x = 777;
        } else if (N <= 888) {
            x = 888;
        } else {
            x = 999;
        }
        out.println(x);
        out.close();
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        int N = Integer.parseInt(br.readLine());
        int x = 0;
        if (N <= 111) {
            x = 111;
        } else if (N <= 222) {
            x = 222;
        } else if (N <= 333) {
            x = 333;
        } else if (N <= 444) {
            x = 444;
        } else if (N <= 555) {
            x = 555;
        } else if (N <= 666) {
            x = 666;
        } else if (N <= 777) {
            x = 777;
        } else if (N <= 888) {
            x = 888;
        } else {
            x = 999;
        }
        out.println(x);
        out.close();
    }
} Main public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        int N = Integer.parseInt(br.readLine());
        int x = 0;
        if (N <= 111) {
            x = 111;
        } else if (N <= 222) {
            x = 222;
        } else if (N <= 333) {
            x = 333;
        } else if (N <= 444) {
            x = 444;
        } else if (N <= 555) {
            x = 555;
        } else if (N <= 666) {
            x = 666;
        } else if (N <= 777) {
            x = 777;
        } else if (N <= 888) {
            x = 888;
        } else {
            x = 999;
        }
        out.println(x);
        out.close();
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        int N = Integer.parseInt(br.readLine());
        int x = 0;
        if (N <= 111) {
            x = 111;
        } else if (N <= 222) {
            x = 222;
        } else if (N <= 333) {
            x = 333;
        } else if (N <= 444) {
            x = 444;
        } else if (N <= 555) {
            x = 555;
        } else if (N <= 666) {
            x = 666;
        } else if (N <= 777) {
            x = 777;
        } else if (N <= 888) {
            x = 888;
        } else {
            x = 999;
        }
        out.println(x);
        out.close();
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int N = Integer.parseInt(br.readLine()); N Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int x = 0; x 0 if (N <= 111) {
            x = 111;
        } else if (N <= 222) {
            x = 222;
        } else if (N <= 333) {
            x = 333;
        } else if (N <= 444) {
            x = 444;
        } else if (N <= 555) {
            x = 555;
        } else if (N <= 666) {
            x = 666;
        } else if (N <= 777) {
            x = 777;
        } else if (N <= 888) {
            x = 888;
        } else {
            x = 999;
        } N <= 111 N 111 {
            x = 111;
        } x = 111 x 111 if (N <= 222) {
            x = 222;
        } else if (N <= 333) {
            x = 333;
        } else if (N <= 444) {
            x = 444;
        } else if (N <= 555) {
            x = 555;
        } else if (N <= 666) {
            x = 666;
        } else if (N <= 777) {
            x = 777;
        } else if (N <= 888) {
            x = 888;
        } else {
            x = 999;
        } N <= 222 N 222 {
            x = 222;
        } x = 222 x 222 if (N <= 333) {
            x = 333;
        } else if (N <= 444) {
            x = 444;
        } else if (N <= 555) {
            x = 555;
        } else if (N <= 666) {
            x = 666;
        } else if (N <= 777) {
            x = 777;
        } else if (N <= 888) {
            x = 888;
        } else {
            x = 999;
        } N <= 333 N 333 {
            x = 333;
        } x = 333 x 333 if (N <= 444) {
            x = 444;
        } else if (N <= 555) {
            x = 555;
        } else if (N <= 666) {
            x = 666;
        } else if (N <= 777) {
            x = 777;
        } else if (N <= 888) {
            x = 888;
        } else {
            x = 999;
        } N <= 444 N 444 {
            x = 444;
        } x = 444 x 444 if (N <= 555) {
            x = 555;
        } else if (N <= 666) {
            x = 666;
        } else if (N <= 777) {
            x = 777;
        } else if (N <= 888) {
            x = 888;
        } else {
            x = 999;
        } N <= 555 N 555 {
            x = 555;
        } x = 555 x 555 if (N <= 666) {
            x = 666;
        } else if (N <= 777) {
            x = 777;
        } else if (N <= 888) {
            x = 888;
        } else {
            x = 999;
        } N <= 666 N 666 {
            x = 666;
        } x = 666 x 666 if (N <= 777) {
            x = 777;
        } else if (N <= 888) {
            x = 888;
        } else {
            x = 999;
        } N <= 777 N 777 {
            x = 777;
        } x = 777 x 777 if (N <= 888) {
            x = 888;
        } else {
            x = 999;
        } N <= 888 N 888 {
            x = 888;
        } x = 888 x 888 {
            x = 999;
        } x = 999 x 999 out.println(x) out.println out x out.close() out.close out String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        int N = Integer.parseInt(br.readLine());
        int x = 0;
        if (N <= 111) {
            x = 111;
        } else if (N <= 222) {
            x = 222;
        } else if (N <= 333) {
            x = 333;
        } else if (N <= 444) {
            x = 444;
        } else if (N <= 555) {
            x = 555;
        } else if (N <= 666) {
            x = 666;
        } else if (N <= 777) {
            x = 777;
        } else if (N <= 888) {
            x = 888;
        } else {
            x = 999;
        }
        out.println(x);
        out.close();
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        int N = Integer.parseInt(br.readLine());
        int x = 0;
        if (N <= 111) {
            x = 111;
        } else if (N <= 222) {
            x = 222;
        } else if (N <= 333) {
            x = 333;
        } else if (N <= 444) {
            x = 444;
        } else if (N <= 555) {
            x = 555;
        } else if (N <= 666) {
            x = 666;
        } else if (N <= 777) {
            x = 777;
        } else if (N <= 888) {
            x = 888;
        } else {
            x = 999;
        }
        out.println(x);
        out.close();
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        int N = Integer.parseInt(br.readLine());
        int x = 0;
        if (N <= 111) {
            x = 111;
        } else if (N <= 222) {
            x = 222;
        } else if (N <= 333) {
            x = 333;
        } else if (N <= 444) {
            x = 444;
        } else if (N <= 555) {
            x = 555;
        } else if (N <= 666) {
            x = 666;
        } else if (N <= 777) {
            x = 777;
        } else if (N <= 888) {
            x = 888;
        } else {
            x = 999;
        }
        out.println(x);
        out.close();
    }
}