import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] data = {111,222,333,444,555,666,777,888,999};

    for (int i = 0;i < 9;i++) {
      if (data[i] >= n) {
        System.out.println(data[i]);
        break;
      }
    }
  }

} import java.util.*; util.* java public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] data = {111,222,333,444,555,666,777,888,999};

    for (int i = 0;i < 9;i++) {
      if (data[i] >= n) {
        System.out.println(data[i]);
        break;
      }
    }
  }

} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] data = {111,222,333,444,555,666,777,888,999};

    for (int i = 0;i < 9;i++) {
      if (data[i] >= n) {
        System.out.println(data[i]);
        break;
      }
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] data = {111,222,333,444,555,666,777,888,999};

    for (int i = 0;i < 9;i++) {
      if (data[i] >= n) {
        System.out.println(data[i]);
        break;
      }
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] data = {111,222,333,444,555,666,777,888,999}; data {111,222,333,444,555,666,777,888,999} 111 222 333 444 555 666 777 888 999 for (int i = 0;i < 9;i++) {
      if (data[i] >= n) {
        System.out.println(data[i]);
        break;
      }
    } int i = 0; int i = 0; i 0 i < 9 i 9 i++ i++ i {
      if (data[i] >= n) {
        System.out.println(data[i]);
        break;
      }
    } {
      if (data[i] >= n) {
        System.out.println(data[i]);
        break;
      }
    } if (data[i] >= n) {
        System.out.println(data[i]);
        break;
      } data[i] >= n data[i] data i n {
        System.out.println(data[i]);
        break;
      } System.out.println(data[i]) System.out.println System.out System System.out data[i] data i break; String[] args args public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] data = {111,222,333,444,555,666,777,888,999};

    for (int i = 0;i < 9;i++) {
      if (data[i] >= n) {
        System.out.println(data[i]);
        break;
      }
    }
  }

} public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] data = {111,222,333,444,555,666,777,888,999};

    for (int i = 0;i < 9;i++) {
      if (data[i] >= n) {
        System.out.println(data[i]);
        break;
      }
    }
  }

} Main
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] data = {111,222,333,444,555,666,777,888,999};

    for (int i = 0;i < 9;i++) {
      if (data[i] >= n) {
        System.out.println(data[i]);
        break;
      }
    }
  }

}
