
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    try (PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in)) {
      Task task = new Task();
      task.solve(sc, out);
      out.flush();

    } catch (Exception e) {
      // DO NOT USE
      e.printStackTrace();
    }
  }

  private static class Task {
    private void solve(Scanner sc, PrintWriter out) {
      // TODO
      int n = nint(sc);

      int ans = 111;
      if (n > 111 && n <= 222) ans = 222;
      else if (n > 222 && n <= 333) ans = 333;
      else if (n > 333 && n <= 444) ans = 444;
      else if (n > 444 && n <= 555) ans = 555;
      else if (n > 555 && n <= 666) ans = 666;
      else if (n > 666 && n <= 777) ans = 777;
      else if (n > 777 && n <= 888) ans = 888;
      else if (n > 888 && n <= 999) ans = 999;

      out.println(ans);
    }

    // method
    private static int nint(Scanner sc) {
      return Integer.parseInt(sc.next());
    }

    private static long nlong(Scanner sc) {
      return Long.parseLong(sc.next());
    }

    private static double ndouble(Scanner sc) {
      return Double.parseDouble(sc.next());
    }

    private static float nfloat(Scanner sc) {
      return Float.parseFloat(sc.next());
    }

    private static String nstr(Scanner sc) {
      return sc.next();
    }

    private static long[] longLine(Scanner sc, int size) {
      long[] lLine = new long[size];
      for (int i = 0; i < size; i++) {
        lLine[i] = nlong(sc);
      }
      return lLine;
    }

    private static int[] intLine(Scanner sc, int size) {
      int[] iLine = new int[size];
      for (int i = 0; i < size; i++) {
        iLine[i] = nint(sc);
      }
      return iLine;
    }

    private static String[] strLine(Scanner sc, int size) {
      String[] strLine = new String[size];
      for (int i = 0; i < size; i++) {
        strLine[i] = nstr(sc);
      }
      return strLine;
    }

    private static long maxFromList(List<Long> longList) {
      return longList.stream().max(Comparator.naturalOrder()).get();
    }

    private static long minFromList(List<Long> longList) {
      return longList.stream().min(Comparator.naturalOrder()).get();
    }

    private static int sumDigits(int n) {
      int sum = 0;
      while (n != 0) {
        sum += n % 10;
        n /= 10;
      }
      return sum;
    }

    private static long sumDigits(long n) {
      long sum = 0;
      while (n != 0) {
        sum += n % 10;
        n /= 10;
      }
      return sum;
    }

    private static List<Integer> getIntegerList(Scanner sc, int size) {
      List<Integer> list = new ArrayList<>();
      for (int i = 0; i < size; i++) {
        list.add(nint(sc));
      }
      return list;
    }

    private static List<Long> getLongList(Scanner sc, int size) {
      List<Long> list = new ArrayList<>();
      for (int i = 0; i < size; i++) {
        list.add(nlong(sc));
      }
      return list;
    }

    private static long gcd(long m, long n) {
      if (m < n) return gcd(n, m);
      if (n == 0) return m;
      return gcd(n, m % n);
    }

    private static long lcm(long m, long n) {
      return m * n / gcd(m, n);
    }
  }
} import java.io.PrintWriter; PrintWriter java.io import java.util.ArrayList; ArrayList java.util import java.util.Comparator; Comparator java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    try (PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in)) {
      Task task = new Task();
      task.solve(sc, out);
      out.flush();

    } catch (Exception e) {
      // DO NOT USE
      e.printStackTrace();
    }
  }

  private static class Task {
    private void solve(Scanner sc, PrintWriter out) {
      // TODO
      int n = nint(sc);

      int ans = 111;
      if (n > 111 && n <= 222) ans = 222;
      else if (n > 222 && n <= 333) ans = 333;
      else if (n > 333 && n <= 444) ans = 444;
      else if (n > 444 && n <= 555) ans = 555;
      else if (n > 555 && n <= 666) ans = 666;
      else if (n > 666 && n <= 777) ans = 777;
      else if (n > 777 && n <= 888) ans = 888;
      else if (n > 888 && n <= 999) ans = 999;

      out.println(ans);
    }

    // method
    private static int nint(Scanner sc) {
      return Integer.parseInt(sc.next());
    }

    private static long nlong(Scanner sc) {
      return Long.parseLong(sc.next());
    }

    private static double ndouble(Scanner sc) {
      return Double.parseDouble(sc.next());
    }

    private static float nfloat(Scanner sc) {
      return Float.parseFloat(sc.next());
    }

    private static String nstr(Scanner sc) {
      return sc.next();
    }

    private static long[] longLine(Scanner sc, int size) {
      long[] lLine = new long[size];
      for (int i = 0; i < size; i++) {
        lLine[i] = nlong(sc);
      }
      return lLine;
    }

    private static int[] intLine(Scanner sc, int size) {
      int[] iLine = new int[size];
      for (int i = 0; i < size; i++) {
        iLine[i] = nint(sc);
      }
      return iLine;
    }

    private static String[] strLine(Scanner sc, int size) {
      String[] strLine = new String[size];
      for (int i = 0; i < size; i++) {
        strLine[i] = nstr(sc);
      }
      return strLine;
    }

    private static long maxFromList(List<Long> longList) {
      return longList.stream().max(Comparator.naturalOrder()).get();
    }

    private static long minFromList(List<Long> longList) {
      return longList.stream().min(Comparator.naturalOrder()).get();
    }

    private static int sumDigits(int n) {
      int sum = 0;
      while (n != 0) {
        sum += n % 10;
        n /= 10;
      }
      return sum;
    }

    private static long sumDigits(long n) {
      long sum = 0;
      while (n != 0) {
        sum += n % 10;
        n /= 10;
      }
      return sum;
    }

    private static List<Integer> getIntegerList(Scanner sc, int size) {
      List<Integer> list = new ArrayList<>();
      for (int i = 0; i < size; i++) {
        list.add(nint(sc));
      }
      return list;
    }

    private static List<Long> getLongList(Scanner sc, int size) {
      List<Long> list = new ArrayList<>();
      for (int i = 0; i < size; i++) {
        list.add(nlong(sc));
      }
      return list;
    }

    private static long gcd(long m, long n) {
      if (m < n) return gcd(n, m);
      if (n == 0) return m;
      return gcd(n, m % n);
    }

    private static long lcm(long m, long n) {
      return m * n / gcd(m, n);
    }
  }
} Main public static void main(String[] args) {
    try (PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in)) {
      Task task = new Task();
      task.solve(sc, out);
      out.flush();

    } catch (Exception e) {
      // DO NOT USE
      e.printStackTrace();
    }
  } main {
    try (PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in)) {
      Task task = new Task();
      task.solve(sc, out);
      out.flush();

    } catch (Exception e) {
      // DO NOT USE
      e.printStackTrace();
    }
  } try (PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in)) {
      Task task = new Task();
      task.solve(sc, out);
      out.flush();

    } catch (Exception e) {
      // DO NOT USE
      e.printStackTrace();
    } catch (Exception e) {
      // DO NOT USE
      e.printStackTrace();
    } Exception e {
      // DO NOT USE
      e.printStackTrace();
    } e.printStackTrace() e.printStackTrace e {
      Task task = new Task();
      task.solve(sc, out);
      out.flush();

    } PrintWriter out = new PrintWriter(System.out) PrintWriter out = new PrintWriter(System.out) new PrintWriter(System.out) Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) Task task = new Task(); task new Task() task.solve(sc, out) task.solve task sc out out.flush() out.flush out String[] args args private static class Task {
    private void solve(Scanner sc, PrintWriter out) {
      // TODO
      int n = nint(sc);

      int ans = 111;
      if (n > 111 && n <= 222) ans = 222;
      else if (n > 222 && n <= 333) ans = 333;
      else if (n > 333 && n <= 444) ans = 444;
      else if (n > 444 && n <= 555) ans = 555;
      else if (n > 555 && n <= 666) ans = 666;
      else if (n > 666 && n <= 777) ans = 777;
      else if (n > 777 && n <= 888) ans = 888;
      else if (n > 888 && n <= 999) ans = 999;

      out.println(ans);
    }

    // method
    private static int nint(Scanner sc) {
      return Integer.parseInt(sc.next());
    }

    private static long nlong(Scanner sc) {
      return Long.parseLong(sc.next());
    }

    private static double ndouble(Scanner sc) {
      return Double.parseDouble(sc.next());
    }

    private static float nfloat(Scanner sc) {
      return Float.parseFloat(sc.next());
    }

    private static String nstr(Scanner sc) {
      return sc.next();
    }

    private static long[] longLine(Scanner sc, int size) {
      long[] lLine = new long[size];
      for (int i = 0; i < size; i++) {
        lLine[i] = nlong(sc);
      }
      return lLine;
    }

    private static int[] intLine(Scanner sc, int size) {
      int[] iLine = new int[size];
      for (int i = 0; i < size; i++) {
        iLine[i] = nint(sc);
      }
      return iLine;
    }

    private static String[] strLine(Scanner sc, int size) {
      String[] strLine = new String[size];
      for (int i = 0; i < size; i++) {
        strLine[i] = nstr(sc);
      }
      return strLine;
    }

    private static long maxFromList(List<Long> longList) {
      return longList.stream().max(Comparator.naturalOrder()).get();
    }

    private static long minFromList(List<Long> longList) {
      return longList.stream().min(Comparator.naturalOrder()).get();
    }

    private static int sumDigits(int n) {
      int sum = 0;
      while (n != 0) {
        sum += n % 10;
        n /= 10;
      }
      return sum;
    }

    private static long sumDigits(long n) {
      long sum = 0;
      while (n != 0) {
        sum += n % 10;
        n /= 10;
      }
      return sum;
    }

    private static List<Integer> getIntegerList(Scanner sc, int size) {
      List<Integer> list = new ArrayList<>();
      for (int i = 0; i < size; i++) {
        list.add(nint(sc));
      }
      return list;
    }

    private static List<Long> getLongList(Scanner sc, int size) {
      List<Long> list = new ArrayList<>();
      for (int i = 0; i < size; i++) {
        list.add(nlong(sc));
      }
      return list;
    }

    private static long gcd(long m, long n) {
      if (m < n) return gcd(n, m);
      if (n == 0) return m;
      return gcd(n, m % n);
    }

    private static long lcm(long m, long n) {
      return m * n / gcd(m, n);
    }
  } Task private void solve(Scanner sc, PrintWriter out) {
      // TODO
      int n = nint(sc);

      int ans = 111;
      if (n > 111 && n <= 222) ans = 222;
      else if (n > 222 && n <= 333) ans = 333;
      else if (n > 333 && n <= 444) ans = 444;
      else if (n > 444 && n <= 555) ans = 555;
      else if (n > 555 && n <= 666) ans = 666;
      else if (n > 666 && n <= 777) ans = 777;
      else if (n > 777 && n <= 888) ans = 888;
      else if (n > 888 && n <= 999) ans = 999;

      out.println(ans);
    } solve {
      // TODO
      int n = nint(sc);

      int ans = 111;
      if (n > 111 && n <= 222) ans = 222;
      else if (n > 222 && n <= 333) ans = 333;
      else if (n > 333 && n <= 444) ans = 444;
      else if (n > 444 && n <= 555) ans = 555;
      else if (n > 555 && n <= 666) ans = 666;
      else if (n > 666 && n <= 777) ans = 777;
      else if (n > 777 && n <= 888) ans = 888;
      else if (n > 888 && n <= 999) ans = 999;

      out.println(ans);
    } int n = nint(sc); n nint(sc) nint sc int ans = 111; ans 111 if (n > 111 && n <= 222) ans = 222;
      else if (n > 222 && n <= 333) ans = 333;
      else if (n > 333 && n <= 444) ans = 444;
      else if (n > 444 && n <= 555) ans = 555;
      else if (n > 555 && n <= 666) ans = 666;
      else if (n > 666 && n <= 777) ans = 777;
      else if (n > 777 && n <= 888) ans = 888;
      else if (n > 888 && n <= 999) ans = 999; n > 111 && n <= 222 n > 111 n 111 n <= 222 n 222 ans = 222 ans 222 if (n > 222 && n <= 333) ans = 333;
      else if (n > 333 && n <= 444) ans = 444;
      else if (n > 444 && n <= 555) ans = 555;
      else if (n > 555 && n <= 666) ans = 666;
      else if (n > 666 && n <= 777) ans = 777;
      else if (n > 777 && n <= 888) ans = 888;
      else if (n > 888 && n <= 999) ans = 999; n > 222 && n <= 333 n > 222 n 222 n <= 333 n 333 ans = 333 ans 333 if (n > 333 && n <= 444) ans = 444;
      else if (n > 444 && n <= 555) ans = 555;
      else if (n > 555 && n <= 666) ans = 666;
      else if (n > 666 && n <= 777) ans = 777;
      else if (n > 777 && n <= 888) ans = 888;
      else if (n > 888 && n <= 999) ans = 999; n > 333 && n <= 444 n > 333 n 333 n <= 444 n 444 ans = 444 ans 444 if (n > 444 && n <= 555) ans = 555;
      else if (n > 555 && n <= 666) ans = 666;
      else if (n > 666 && n <= 777) ans = 777;
      else if (n > 777 && n <= 888) ans = 888;
      else if (n > 888 && n <= 999) ans = 999; n > 444 && n <= 555 n > 444 n 444 n <= 555 n 555 ans = 555 ans 555 if (n > 555 && n <= 666) ans = 666;
      else if (n > 666 && n <= 777) ans = 777;
      else if (n > 777 && n <= 888) ans = 888;
      else if (n > 888 && n <= 999) ans = 999; n > 555 && n <= 666 n > 555 n 555 n <= 666 n 666 ans = 666 ans 666 if (n > 666 && n <= 777) ans = 777;
      else if (n > 777 && n <= 888) ans = 888;
      else if (n > 888 && n <= 999) ans = 999; n > 666 && n <= 777 n > 666 n 666 n <= 777 n 777 ans = 777 ans 777 if (n > 777 && n <= 888) ans = 888;
      else if (n > 888 && n <= 999) ans = 999; n > 777 && n <= 888 n > 777 n 777 n <= 888 n 888 ans = 888 ans 888 if (n > 888 && n <= 999) ans = 999; n > 888 && n <= 999 n > 888 n 888 n <= 999 n 999 ans = 999 ans 999 out.println(ans) out.println out ans Scanner sc sc PrintWriter out out // method
    private static int nint(Scanner sc) {
      return Integer.parseInt(sc.next());
    } nint {
      return Integer.parseInt(sc.next());
    } return Integer.parseInt(sc.next()); Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Scanner sc sc private static long nlong(Scanner sc) {
      return Long.parseLong(sc.next());
    } nlong {
      return Long.parseLong(sc.next());
    } return Long.parseLong(sc.next()); Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc Scanner sc sc private static double ndouble(Scanner sc) {
      return Double.parseDouble(sc.next());
    } ndouble {
      return Double.parseDouble(sc.next());
    } return Double.parseDouble(sc.next()); Double.parseDouble(sc.next()) Double.parseDouble Double sc.next() sc.next sc Scanner sc sc private static float nfloat(Scanner sc) {
      return Float.parseFloat(sc.next());
    } nfloat {
      return Float.parseFloat(sc.next());
    } return Float.parseFloat(sc.next()); Float.parseFloat(sc.next()) Float.parseFloat Float sc.next() sc.next sc Scanner sc sc private static String nstr(Scanner sc) {
      return sc.next();
    } nstr {
      return sc.next();
    } return sc.next(); sc.next() sc.next sc Scanner sc sc private static long[] longLine(Scanner sc, int size) {
      long[] lLine = new long[size];
      for (int i = 0; i < size; i++) {
        lLine[i] = nlong(sc);
      }
      return lLine;
    } longLine {
      long[] lLine = new long[size];
      for (int i = 0; i < size; i++) {
        lLine[i] = nlong(sc);
      }
      return lLine;
    } long[] lLine = new long[size]; lLine new long[size] size for (int i = 0; i < size; i++) {
        lLine[i] = nlong(sc);
      } int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
        lLine[i] = nlong(sc);
      } {
        lLine[i] = nlong(sc);
      } lLine[i] = nlong(sc) lLine[i] lLine i nlong(sc) nlong sc return lLine; lLine Scanner sc sc int size size private static int[] intLine(Scanner sc, int size) {
      int[] iLine = new int[size];
      for (int i = 0; i < size; i++) {
        iLine[i] = nint(sc);
      }
      return iLine;
    } intLine {
      int[] iLine = new int[size];
      for (int i = 0; i < size; i++) {
        iLine[i] = nint(sc);
      }
      return iLine;
    } int[] iLine = new int[size]; iLine new int[size] size for (int i = 0; i < size; i++) {
        iLine[i] = nint(sc);
      } int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
        iLine[i] = nint(sc);
      } {
        iLine[i] = nint(sc);
      } iLine[i] = nint(sc) iLine[i] iLine i nint(sc) nint sc return iLine; iLine Scanner sc sc int size size private static String[] strLine(Scanner sc, int size) {
      String[] strLine = new String[size];
      for (int i = 0; i < size; i++) {
        strLine[i] = nstr(sc);
      }
      return strLine;
    } strLine {
      String[] strLine = new String[size];
      for (int i = 0; i < size; i++) {
        strLine[i] = nstr(sc);
      }
      return strLine;
    } String[] strLine = new String[size]; strLine new String[size] size for (int i = 0; i < size; i++) {
        strLine[i] = nstr(sc);
      } int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
        strLine[i] = nstr(sc);
      } {
        strLine[i] = nstr(sc);
      } strLine[i] = nstr(sc) strLine[i] strLine i nstr(sc) nstr sc return strLine; strLine Scanner sc sc int size size private static long maxFromList(List<Long> longList) {
      return longList.stream().max(Comparator.naturalOrder()).get();
    } maxFromList {
      return longList.stream().max(Comparator.naturalOrder()).get();
    } return longList.stream().max(Comparator.naturalOrder()).get(); longList.stream().max(Comparator.naturalOrder()).get() longList.stream().max(Comparator.naturalOrder()).get longList.stream().max(Comparator.naturalOrder()) longList.stream().max longList.stream() longList.stream longList Comparator.naturalOrder() Comparator.naturalOrder Comparator List<Long> longList longList private static long minFromList(List<Long> longList) {
      return longList.stream().min(Comparator.naturalOrder()).get();
    } minFromList {
      return longList.stream().min(Comparator.naturalOrder()).get();
    } return longList.stream().min(Comparator.naturalOrder()).get(); longList.stream().min(Comparator.naturalOrder()).get() longList.stream().min(Comparator.naturalOrder()).get longList.stream().min(Comparator.naturalOrder()) longList.stream().min longList.stream() longList.stream longList Comparator.naturalOrder() Comparator.naturalOrder Comparator List<Long> longList longList private static int sumDigits(int n) {
      int sum = 0;
      while (n != 0) {
        sum += n % 10;
        n /= 10;
      }
      return sum;
    } sumDigits {
      int sum = 0;
      while (n != 0) {
        sum += n % 10;
        n /= 10;
      }
      return sum;
    } int sum = 0; sum 0 while (n != 0) {
        sum += n % 10;
        n /= 10;
      } n != 0 n 0 {
        sum += n % 10;
        n /= 10;
      } sum += n % 10 sum n % 10 n 10 n /= 10 n 10 return sum; sum int n n private static long sumDigits(long n) {
      long sum = 0;
      while (n != 0) {
        sum += n % 10;
        n /= 10;
      }
      return sum;
    } sumDigits {
      long sum = 0;
      while (n != 0) {
        sum += n % 10;
        n /= 10;
      }
      return sum;
    } long sum = 0; sum 0 while (n != 0) {
        sum += n % 10;
        n /= 10;
      } n != 0 n 0 {
        sum += n % 10;
        n /= 10;
      } sum += n % 10 sum n % 10 n 10 n /= 10 n 10 return sum; sum long n n private static List<Integer> getIntegerList(Scanner sc, int size) {
      List<Integer> list = new ArrayList<>();
      for (int i = 0; i < size; i++) {
        list.add(nint(sc));
      }
      return list;
    } getIntegerList {
      List<Integer> list = new ArrayList<>();
      for (int i = 0; i < size; i++) {
        list.add(nint(sc));
      }
      return list;
    } List<Integer> list = new ArrayList<>(); list new ArrayList<>() for (int i = 0; i < size; i++) {
        list.add(nint(sc));
      } int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
        list.add(nint(sc));
      } {
        list.add(nint(sc));
      } list.add(nint(sc)) list.add list nint(sc) nint sc return list; list Scanner sc sc int size size private static List<Long> getLongList(Scanner sc, int size) {
      List<Long> list = new ArrayList<>();
      for (int i = 0; i < size; i++) {
        list.add(nlong(sc));
      }
      return list;
    } getLongList {
      List<Long> list = new ArrayList<>();
      for (int i = 0; i < size; i++) {
        list.add(nlong(sc));
      }
      return list;
    } List<Long> list = new ArrayList<>(); list new ArrayList<>() for (int i = 0; i < size; i++) {
        list.add(nlong(sc));
      } int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
        list.add(nlong(sc));
      } {
        list.add(nlong(sc));
      } list.add(nlong(sc)) list.add list nlong(sc) nlong sc return list; list Scanner sc sc int size size private static long gcd(long m, long n) {
      if (m < n) return gcd(n, m);
      if (n == 0) return m;
      return gcd(n, m % n);
    } gcd {
      if (m < n) return gcd(n, m);
      if (n == 0) return m;
      return gcd(n, m % n);
    } if (m < n) return gcd(n, m); m < n m n return gcd(n, m); gcd(n, m) gcd n m if (n == 0) return m; n == 0 n 0 return m; m return gcd(n, m % n); gcd(n, m % n) gcd n m % n m n long m m long n n private static long lcm(long m, long n) {
      return m * n / gcd(m, n);
    } lcm {
      return m * n / gcd(m, n);
    } return m * n / gcd(m, n); m * n / gcd(m, n) m * n m n gcd(m, n) gcd m n long m m long n n public class Main {
  public static void main(String[] args) {
    try (PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in)) {
      Task task = new Task();
      task.solve(sc, out);
      out.flush();

    } catch (Exception e) {
      // DO NOT USE
      e.printStackTrace();
    }
  }

  private static class Task {
    private void solve(Scanner sc, PrintWriter out) {
      // TODO
      int n = nint(sc);

      int ans = 111;
      if (n > 111 && n <= 222) ans = 222;
      else if (n > 222 && n <= 333) ans = 333;
      else if (n > 333 && n <= 444) ans = 444;
      else if (n > 444 && n <= 555) ans = 555;
      else if (n > 555 && n <= 666) ans = 666;
      else if (n > 666 && n <= 777) ans = 777;
      else if (n > 777 && n <= 888) ans = 888;
      else if (n > 888 && n <= 999) ans = 999;

      out.println(ans);
    }

    // method
    private static int nint(Scanner sc) {
      return Integer.parseInt(sc.next());
    }

    private static long nlong(Scanner sc) {
      return Long.parseLong(sc.next());
    }

    private static double ndouble(Scanner sc) {
      return Double.parseDouble(sc.next());
    }

    private static float nfloat(Scanner sc) {
      return Float.parseFloat(sc.next());
    }

    private static String nstr(Scanner sc) {
      return sc.next();
    }

    private static long[] longLine(Scanner sc, int size) {
      long[] lLine = new long[size];
      for (int i = 0; i < size; i++) {
        lLine[i] = nlong(sc);
      }
      return lLine;
    }

    private static int[] intLine(Scanner sc, int size) {
      int[] iLine = new int[size];
      for (int i = 0; i < size; i++) {
        iLine[i] = nint(sc);
      }
      return iLine;
    }

    private static String[] strLine(Scanner sc, int size) {
      String[] strLine = new String[size];
      for (int i = 0; i < size; i++) {
        strLine[i] = nstr(sc);
      }
      return strLine;
    }

    private static long maxFromList(List<Long> longList) {
      return longList.stream().max(Comparator.naturalOrder()).get();
    }

    private static long minFromList(List<Long> longList) {
      return longList.stream().min(Comparator.naturalOrder()).get();
    }

    private static int sumDigits(int n) {
      int sum = 0;
      while (n != 0) {
        sum += n % 10;
        n /= 10;
      }
      return sum;
    }

    private static long sumDigits(long n) {
      long sum = 0;
      while (n != 0) {
        sum += n % 10;
        n /= 10;
      }
      return sum;
    }

    private static List<Integer> getIntegerList(Scanner sc, int size) {
      List<Integer> list = new ArrayList<>();
      for (int i = 0; i < size; i++) {
        list.add(nint(sc));
      }
      return list;
    }

    private static List<Long> getLongList(Scanner sc, int size) {
      List<Long> list = new ArrayList<>();
      for (int i = 0; i < size; i++) {
        list.add(nlong(sc));
      }
      return list;
    }

    private static long gcd(long m, long n) {
      if (m < n) return gcd(n, m);
      if (n == 0) return m;
      return gcd(n, m % n);
    }

    private static long lcm(long m, long n) {
      return m * n / gcd(m, n);
    }
  }
} public class Main {
  public static void main(String[] args) {
    try (PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in)) {
      Task task = new Task();
      task.solve(sc, out);
      out.flush();

    } catch (Exception e) {
      // DO NOT USE
      e.printStackTrace();
    }
  }

  private static class Task {
    private void solve(Scanner sc, PrintWriter out) {
      // TODO
      int n = nint(sc);

      int ans = 111;
      if (n > 111 && n <= 222) ans = 222;
      else if (n > 222 && n <= 333) ans = 333;
      else if (n > 333 && n <= 444) ans = 444;
      else if (n > 444 && n <= 555) ans = 555;
      else if (n > 555 && n <= 666) ans = 666;
      else if (n > 666 && n <= 777) ans = 777;
      else if (n > 777 && n <= 888) ans = 888;
      else if (n > 888 && n <= 999) ans = 999;

      out.println(ans);
    }

    // method
    private static int nint(Scanner sc) {
      return Integer.parseInt(sc.next());
    }

    private static long nlong(Scanner sc) {
      return Long.parseLong(sc.next());
    }

    private static double ndouble(Scanner sc) {
      return Double.parseDouble(sc.next());
    }

    private static float nfloat(Scanner sc) {
      return Float.parseFloat(sc.next());
    }

    private static String nstr(Scanner sc) {
      return sc.next();
    }

    private static long[] longLine(Scanner sc, int size) {
      long[] lLine = new long[size];
      for (int i = 0; i < size; i++) {
        lLine[i] = nlong(sc);
      }
      return lLine;
    }

    private static int[] intLine(Scanner sc, int size) {
      int[] iLine = new int[size];
      for (int i = 0; i < size; i++) {
        iLine[i] = nint(sc);
      }
      return iLine;
    }

    private static String[] strLine(Scanner sc, int size) {
      String[] strLine = new String[size];
      for (int i = 0; i < size; i++) {
        strLine[i] = nstr(sc);
      }
      return strLine;
    }

    private static long maxFromList(List<Long> longList) {
      return longList.stream().max(Comparator.naturalOrder()).get();
    }

    private static long minFromList(List<Long> longList) {
      return longList.stream().min(Comparator.naturalOrder()).get();
    }

    private static int sumDigits(int n) {
      int sum = 0;
      while (n != 0) {
        sum += n % 10;
        n /= 10;
      }
      return sum;
    }

    private static long sumDigits(long n) {
      long sum = 0;
      while (n != 0) {
        sum += n % 10;
        n /= 10;
      }
      return sum;
    }

    private static List<Integer> getIntegerList(Scanner sc, int size) {
      List<Integer> list = new ArrayList<>();
      for (int i = 0; i < size; i++) {
        list.add(nint(sc));
      }
      return list;
    }

    private static List<Long> getLongList(Scanner sc, int size) {
      List<Long> list = new ArrayList<>();
      for (int i = 0; i < size; i++) {
        list.add(nlong(sc));
      }
      return list;
    }

    private static long gcd(long m, long n) {
      if (m < n) return gcd(n, m);
      if (n == 0) return m;
      return gcd(n, m % n);
    }

    private static long lcm(long m, long n) {
      return m * n / gcd(m, n);
    }
  }
} Main

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    try (PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in)) {
      Task task = new Task();
      task.solve(sc, out);
      out.flush();

    } catch (Exception e) {
      // DO NOT USE
      e.printStackTrace();
    }
  }

  private static class Task {
    private void solve(Scanner sc, PrintWriter out) {
      // TODO
      int n = nint(sc);

      int ans = 111;
      if (n > 111 && n <= 222) ans = 222;
      else if (n > 222 && n <= 333) ans = 333;
      else if (n > 333 && n <= 444) ans = 444;
      else if (n > 444 && n <= 555) ans = 555;
      else if (n > 555 && n <= 666) ans = 666;
      else if (n > 666 && n <= 777) ans = 777;
      else if (n > 777 && n <= 888) ans = 888;
      else if (n > 888 && n <= 999) ans = 999;

      out.println(ans);
    }

    // method
    private static int nint(Scanner sc) {
      return Integer.parseInt(sc.next());
    }

    private static long nlong(Scanner sc) {
      return Long.parseLong(sc.next());
    }

    private static double ndouble(Scanner sc) {
      return Double.parseDouble(sc.next());
    }

    private static float nfloat(Scanner sc) {
      return Float.parseFloat(sc.next());
    }

    private static String nstr(Scanner sc) {
      return sc.next();
    }

    private static long[] longLine(Scanner sc, int size) {
      long[] lLine = new long[size];
      for (int i = 0; i < size; i++) {
        lLine[i] = nlong(sc);
      }
      return lLine;
    }

    private static int[] intLine(Scanner sc, int size) {
      int[] iLine = new int[size];
      for (int i = 0; i < size; i++) {
        iLine[i] = nint(sc);
      }
      return iLine;
    }

    private static String[] strLine(Scanner sc, int size) {
      String[] strLine = new String[size];
      for (int i = 0; i < size; i++) {
        strLine[i] = nstr(sc);
      }
      return strLine;
    }

    private static long maxFromList(List<Long> longList) {
      return longList.stream().max(Comparator.naturalOrder()).get();
    }

    private static long minFromList(List<Long> longList) {
      return longList.stream().min(Comparator.naturalOrder()).get();
    }

    private static int sumDigits(int n) {
      int sum = 0;
      while (n != 0) {
        sum += n % 10;
        n /= 10;
      }
      return sum;
    }

    private static long sumDigits(long n) {
      long sum = 0;
      while (n != 0) {
        sum += n % 10;
        n /= 10;
      }
      return sum;
    }

    private static List<Integer> getIntegerList(Scanner sc, int size) {
      List<Integer> list = new ArrayList<>();
      for (int i = 0; i < size; i++) {
        list.add(nint(sc));
      }
      return list;
    }

    private static List<Long> getLongList(Scanner sc, int size) {
      List<Long> list = new ArrayList<>();
      for (int i = 0; i < size; i++) {
        list.add(nlong(sc));
      }
      return list;
    }

    private static long gcd(long m, long n) {
      if (m < n) return gcd(n, m);
      if (n == 0) return m;
      return gcd(n, m % n);
    }

    private static long lcm(long m, long n) {
      return m * n / gcd(m, n);
    }
  }
}
