import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author hakamada
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC111_2 solver = new ABC111_2();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC111_2 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int NN = in.nextInt();
            String[] N = String.valueOf(NN).split("");
            String leftone = N[0];

            if ((leftone.compareTo(N[1]) == 0) & (leftone.compareTo(N[2]) == 0)) {
                out.println(N[0] + N[0] + N[0]);
                return;
            }

            while (true) {
                NN += 1;
                N = String.valueOf(NN).split("");
                if ((N[0].compareTo(N[1]) == 0) && (N[1].compareTo(N[2]) == 0)) {
                    out.println(NN);
                    return;
                }
            }
        
        
        
/*
        for (int i = 1; i < 3; i++) {
            if (Integer.parseInt(leftone) > Integer.parseInt(N[i])) {
                out.println(N[0] + N[0] + N[0]);
                return;
            }
        }
        leftone = String.valueOf(Integer.parseInt(leftone) + 1);
        out.println(leftone+leftone+leftone);
        return;
        */
        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC111_2 solver = new ABC111_2();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC111_2 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int NN = in.nextInt();
            String[] N = String.valueOf(NN).split("");
            String leftone = N[0];

            if ((leftone.compareTo(N[1]) == 0) & (leftone.compareTo(N[2]) == 0)) {
                out.println(N[0] + N[0] + N[0]);
                return;
            }

            while (true) {
                NN += 1;
                N = String.valueOf(NN).split("");
                if ((N[0].compareTo(N[1]) == 0) && (N[1].compareTo(N[2]) == 0)) {
                    out.println(NN);
                    return;
                }
            }
        
        
        
/*
        for (int i = 1; i < 3; i++) {
            if (Integer.parseInt(leftone) > Integer.parseInt(N[i])) {
                out.println(N[0] + N[0] + N[0]);
                return;
            }
        }
        leftone = String.valueOf(Integer.parseInt(leftone) + 1);
        out.println(leftone+leftone+leftone);
        return;
        */
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC111_2 solver = new ABC111_2();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC111_2 solver = new ABC111_2();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) ABC111_2 solver = new ABC111_2(); solver new ABC111_2() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class ABC111_2 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int NN = in.nextInt();
            String[] N = String.valueOf(NN).split("");
            String leftone = N[0];

            if ((leftone.compareTo(N[1]) == 0) & (leftone.compareTo(N[2]) == 0)) {
                out.println(N[0] + N[0] + N[0]);
                return;
            }

            while (true) {
                NN += 1;
                N = String.valueOf(NN).split("");
                if ((N[0].compareTo(N[1]) == 0) && (N[1].compareTo(N[2]) == 0)) {
                    out.println(NN);
                    return;
                }
            }
        
        
        
/*
        for (int i = 1; i < 3; i++) {
            if (Integer.parseInt(leftone) > Integer.parseInt(N[i])) {
                out.println(N[0] + N[0] + N[0]);
                return;
            }
        }
        leftone = String.valueOf(Integer.parseInt(leftone) + 1);
        out.println(leftone+leftone+leftone);
        return;
        */
        }

    } ABC111_2 public void solve(int testNumber, Scanner in, PrintWriter out) {
            int NN = in.nextInt();
            String[] N = String.valueOf(NN).split("");
            String leftone = N[0];

            if ((leftone.compareTo(N[1]) == 0) & (leftone.compareTo(N[2]) == 0)) {
                out.println(N[0] + N[0] + N[0]);
                return;
            }

            while (true) {
                NN += 1;
                N = String.valueOf(NN).split("");
                if ((N[0].compareTo(N[1]) == 0) && (N[1].compareTo(N[2]) == 0)) {
                    out.println(NN);
                    return;
                }
            }
        
        
        
/*
        for (int i = 1; i < 3; i++) {
            if (Integer.parseInt(leftone) > Integer.parseInt(N[i])) {
                out.println(N[0] + N[0] + N[0]);
                return;
            }
        }
        leftone = String.valueOf(Integer.parseInt(leftone) + 1);
        out.println(leftone+leftone+leftone);
        return;
        */
        } solve {
            int NN = in.nextInt();
            String[] N = String.valueOf(NN).split("");
            String leftone = N[0];

            if ((leftone.compareTo(N[1]) == 0) & (leftone.compareTo(N[2]) == 0)) {
                out.println(N[0] + N[0] + N[0]);
                return;
            }

            while (true) {
                NN += 1;
                N = String.valueOf(NN).split("");
                if ((N[0].compareTo(N[1]) == 0) && (N[1].compareTo(N[2]) == 0)) {
                    out.println(NN);
                    return;
                }
            }
        
        
        
/*
        for (int i = 1; i < 3; i++) {
            if (Integer.parseInt(leftone) > Integer.parseInt(N[i])) {
                out.println(N[0] + N[0] + N[0]);
                return;
            }
        }
        leftone = String.valueOf(Integer.parseInt(leftone) + 1);
        out.println(leftone+leftone+leftone);
        return;
        */
        } int NN = in.nextInt(); NN in.nextInt() in.nextInt in String[] N = String.valueOf(NN).split(""); N String.valueOf(NN).split("") String.valueOf(NN).split String.valueOf(NN) String.valueOf String NN "" String leftone = N[0]; leftone N[0] N 0 if ((leftone.compareTo(N[1]) == 0) & (leftone.compareTo(N[2]) == 0)) {
                out.println(N[0] + N[0] + N[0]);
                return;
            } (leftone.compareTo(N[1]) == 0) & (leftone.compareTo(N[2]) == 0) (leftone.compareTo(N[1]) == 0) leftone.compareTo(N[1]) leftone.compareTo leftone N[1] N 1 0 (leftone.compareTo(N[2]) == 0) leftone.compareTo(N[2]) leftone.compareTo leftone N[2] N 2 0 {
                out.println(N[0] + N[0] + N[0]);
                return;
            } out.println(N[0] + N[0] + N[0]) out.println out N[0] + N[0] + N[0] N[0] + N[0] + N[0] N[0] N 0 N[0] N 0 N[0] N 0 return; while (true) {
                NN += 1;
                N = String.valueOf(NN).split("");
                if ((N[0].compareTo(N[1]) == 0) && (N[1].compareTo(N[2]) == 0)) {
                    out.println(NN);
                    return;
                }
            } true {
                NN += 1;
                N = String.valueOf(NN).split("");
                if ((N[0].compareTo(N[1]) == 0) && (N[1].compareTo(N[2]) == 0)) {
                    out.println(NN);
                    return;
                }
            } NN += 1 NN 1 N = String.valueOf(NN).split("") N String.valueOf(NN).split("") String.valueOf(NN).split String.valueOf(NN) String.valueOf String NN "" if ((N[0].compareTo(N[1]) == 0) && (N[1].compareTo(N[2]) == 0)) {
                    out.println(NN);
                    return;
                } (N[0].compareTo(N[1]) == 0) && (N[1].compareTo(N[2]) == 0) (N[0].compareTo(N[1]) == 0) N[0].compareTo(N[1]) N[0].compareTo N[0] N 0 N[1] N 1 0 (N[1].compareTo(N[2]) == 0) N[1].compareTo(N[2]) N[1].compareTo N[1] N 1 N[2] N 2 0 {
                    out.println(NN);
                    return;
                } out.println(NN) out.println out NN return; int testNumber testNumber Scanner in in PrintWriter out out public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC111_2 solver = new ABC111_2();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC111_2 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int NN = in.nextInt();
            String[] N = String.valueOf(NN).split("");
            String leftone = N[0];

            if ((leftone.compareTo(N[1]) == 0) & (leftone.compareTo(N[2]) == 0)) {
                out.println(N[0] + N[0] + N[0]);
                return;
            }

            while (true) {
                NN += 1;
                N = String.valueOf(NN).split("");
                if ((N[0].compareTo(N[1]) == 0) && (N[1].compareTo(N[2]) == 0)) {
                    out.println(NN);
                    return;
                }
            }
        
        
        
/*
        for (int i = 1; i < 3; i++) {
            if (Integer.parseInt(leftone) > Integer.parseInt(N[i])) {
                out.println(N[0] + N[0] + N[0]);
                return;
            }
        }
        leftone = String.valueOf(Integer.parseInt(leftone) + 1);
        out.println(leftone+leftone+leftone);
        return;
        */
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC111_2 solver = new ABC111_2();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC111_2 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int NN = in.nextInt();
            String[] N = String.valueOf(NN).split("");
            String leftone = N[0];

            if ((leftone.compareTo(N[1]) == 0) & (leftone.compareTo(N[2]) == 0)) {
                out.println(N[0] + N[0] + N[0]);
                return;
            }

            while (true) {
                NN += 1;
                N = String.valueOf(NN).split("");
                if ((N[0].compareTo(N[1]) == 0) && (N[1].compareTo(N[2]) == 0)) {
                    out.println(NN);
                    return;
                }
            }
        
        
        
/*
        for (int i = 1; i < 3; i++) {
            if (Integer.parseInt(leftone) > Integer.parseInt(N[i])) {
                out.println(N[0] + N[0] + N[0]);
                return;
            }
        }
        leftone = String.valueOf(Integer.parseInt(leftone) + 1);
        out.println(leftone+leftone+leftone);
        return;
        */
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author hakamada
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC111_2 solver = new ABC111_2();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC111_2 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int NN = in.nextInt();
            String[] N = String.valueOf(NN).split("");
            String leftone = N[0];

            if ((leftone.compareTo(N[1]) == 0) & (leftone.compareTo(N[2]) == 0)) {
                out.println(N[0] + N[0] + N[0]);
                return;
            }

            while (true) {
                NN += 1;
                N = String.valueOf(NN).split("");
                if ((N[0].compareTo(N[1]) == 0) && (N[1].compareTo(N[2]) == 0)) {
                    out.println(NN);
                    return;
                }
            }
        
        
        
/*
        for (int i = 1; i < 3; i++) {
            if (Integer.parseInt(leftone) > Integer.parseInt(N[i])) {
                out.println(N[0] + N[0] + N[0]);
                return;
            }
        }
        leftone = String.valueOf(Integer.parseInt(leftone) + 1);
        out.println(leftone+leftone+leftone);
        return;
        */
        }

    }
}

