import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();

    sc.close();

    for (int i = 1; i <= 9; i++) {
      int j = i * 100 + i * 10 + i;
      if (N <= j) {
        System.out.println(j);
        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();

    sc.close();

    for (int i = 1; i <= 9; i++) {
      int j = i * 100 + i * 10 + i;
      if (N <= j) {
        System.out.println(j);
        break;
      }
    }

  }

} Main public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();

    sc.close();

    for (int i = 1; i <= 9; i++) {
      int j = i * 100 + i * 10 + i;
      if (N <= j) {
        System.out.println(j);
        break;
      }
    }

  } main {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();

    sc.close();

    for (int i = 1; i <= 9; i++) {
      int j = i * 100 + i * 10 + i;
      if (N <= j) {
        System.out.println(j);
        break;
      }
    }

  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc sc.close() sc.close sc for (int i = 1; i <= 9; i++) {
      int j = i * 100 + i * 10 + i;
      if (N <= j) {
        System.out.println(j);
        break;
      }
    } int i = 1; int i = 1; i 1 i <= 9 i 9 i++ i++ i {
      int j = i * 100 + i * 10 + i;
      if (N <= j) {
        System.out.println(j);
        break;
      }
    } {
      int j = i * 100 + i * 10 + i;
      if (N <= j) {
        System.out.println(j);
        break;
      }
    } int j = i * 100 + i * 10 + i; j i * 100 + i * 10 + i i * 100 + i * 10 + i i * 100 i 100 i * 10 i 10 i if (N <= j) {
        System.out.println(j);
        break;
      } N <= j N j {
        System.out.println(j);
        break;
      } System.out.println(j) System.out.println System.out System System.out j break; String[] args args public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();

    sc.close();

    for (int i = 1; i <= 9; i++) {
      int j = i * 100 + i * 10 + i;
      if (N <= j) {
        System.out.println(j);
        break;
      }
    }

  }

} public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();

    sc.close();

    for (int i = 1; i <= 9; i++) {
      int j = i * 100 + i * 10 + i;
      if (N <= j) {
        System.out.println(j);
        break;
      }
    }

  }

} Main
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();

    sc.close();

    for (int i = 1; i <= 9; i++) {
      int j = i * 100 + i * 10 + i;
      if (N <= j) {
        System.out.println(j);
        break;
      }
    }

  }

}