import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int ans = 111;

    while (true) {
      if (((ans - 111) < n) && (n <= ans)) {
        System.out.println(ans);
        return;
      } else {
        ans += 111;
      }
    }

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

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int ans = 111;

    while (true) {
      if (((ans - 111) < n) && (n <= ans)) {
        System.out.println(ans);
        return;
      } else {
        ans += 111;
      }
    }

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

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int ans = 111;

    while (true) {
      if (((ans - 111) < n) && (n <= ans)) {
        System.out.println(ans);
        return;
      } else {
        ans += 111;
      }
    }

  } main {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int ans = 111;

    while (true) {
      if (((ans - 111) < n) && (n <= ans)) {
        System.out.println(ans);
        return;
      } else {
        ans += 111;
      }
    }

  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int ans = 111; ans 111 while (true) {
      if (((ans - 111) < n) && (n <= ans)) {
        System.out.println(ans);
        return;
      } else {
        ans += 111;
      }
    } true {
      if (((ans - 111) < n) && (n <= ans)) {
        System.out.println(ans);
        return;
      } else {
        ans += 111;
      }
    } if (((ans - 111) < n) && (n <= ans)) {
        System.out.println(ans);
        return;
      } else {
        ans += 111;
      } ((ans - 111) < n) && (n <= ans) ((ans - 111) < n) (ans - 111) ans 111 n (n <= ans) n ans {
        System.out.println(ans);
        return;
      } System.out.println(ans) System.out.println System.out System System.out ans return; {
        ans += 111;
      } ans += 111 ans 111 String[] args args public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int ans = 111;

    while (true) {
      if (((ans - 111) < n) && (n <= ans)) {
        System.out.println(ans);
        return;
      } else {
        ans += 111;
      }
    }

  }
} public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int ans = 111;

    while (true) {
      if (((ans - 111) < n) && (n <= ans)) {
        System.out.println(ans);
        return;
      } else {
        ans += 111;
      }
    }

  }
} Main
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int ans = 111;

    while (true) {
      if (((ans - 111) < n) && (n <= ans)) {
        System.out.println(ans);
        return;
      } else {
        ans += 111;
      }
    }

  }
}