import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for (int i = 1; i <= 9; i++) {
      int ans = 100 * i + 10 * i + i;
      if (n <= ans) {
        System.out.println(ans);
        return;
      }
    }
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for (int i = 1; i <= 9; i++) {
      int ans = 100 * i + 10 * i + i;
      if (n <= ans) {
        System.out.println(ans);
        return;
      }
    }
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for (int i = 1; i <= 9; i++) {
      int ans = 100 * i + 10 * i + i;
      if (n <= ans) {
        System.out.println(ans);
        return;
      }
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for (int i = 1; i <= 9; i++) {
      int ans = 100 * i + 10 * i + i;
      if (n <= ans) {
        System.out.println(ans);
        return;
      }
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for (int i = 1; i <= 9; i++) {
      int ans = 100 * i + 10 * i + i;
      if (n <= ans) {
        System.out.println(ans);
        return;
      }
    } int i = 1; int i = 1; i 1 i <= 9 i 9 i++ i++ i {
      int ans = 100 * i + 10 * i + i;
      if (n <= ans) {
        System.out.println(ans);
        return;
      }
    } {
      int ans = 100 * i + 10 * i + i;
      if (n <= ans) {
        System.out.println(ans);
        return;
      }
    } int ans = 100 * i + 10 * i + i; ans 100 * i + 10 * i + i 100 * i + 10 * i + i 100 * i 100 i 10 * i 10 i i if (n <= ans) {
        System.out.println(ans);
        return;
      } n <= ans n ans {
        System.out.println(ans);
        return;
      } System.out.println(ans) System.out.println System.out System System.out ans return; String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for (int i = 1; i <= 9; i++) {
      int ans = 100 * i + 10 * i + i;
      if (n <= ans) {
        System.out.println(ans);
        return;
      }
    }
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for (int i = 1; i <= 9; i++) {
      int ans = 100 * i + 10 * i + i;
      if (n <= ans) {
        System.out.println(ans);
        return;
      }
    }
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for (int i = 1; i <= 9; i++) {
      int ans = 100 * i + 10 * i + i;
      if (n <= ans) {
        System.out.println(ans);
        return;
      }
    }
  }
}