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 = N; i <= 999; i++) {

      if (i % 111 == 0) {
        System.out.println(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();

    sc.close();

    for (int i = N; i <= 999; i++) {

      if (i % 111 == 0) {
        System.out.println(i);
        break;
      }

    }

  }

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

    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();

    sc.close();

    for (int i = N; i <= 999; i++) {

      if (i % 111 == 0) {
        System.out.println(i);
        break;
      }

    }

  } main {

    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();

    sc.close();

    for (int i = N; i <= 999; i++) {

      if (i % 111 == 0) {
        System.out.println(i);
        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 = N; i <= 999; i++) {

      if (i % 111 == 0) {
        System.out.println(i);
        break;
      }

    } int i = N; int i = N; i N i <= 999 i 999 i++ i++ i {

      if (i % 111 == 0) {
        System.out.println(i);
        break;
      }

    } {

      if (i % 111 == 0) {
        System.out.println(i);
        break;
      }

    } if (i % 111 == 0) {
        System.out.println(i);
        break;
      } i % 111 == 0 i % 111 i 111 0 {
        System.out.println(i);
        break;
      } System.out.println(i) System.out.println System.out System System.out i 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 = N; i <= 999; i++) {

      if (i % 111 == 0) {
        System.out.println(i);
        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 = N; i <= 999; i++) {

      if (i % 111 == 0) {
        System.out.println(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();

    sc.close();

    for (int i = N; i <= 999; i++) {

      if (i % 111 == 0) {
        System.out.println(i);
        break;
      }

    }

  }

}