#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * (b / (gcd(a, b))); }
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
inline long long toLL(string s) {
  long long v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
long long pascals[4001][4001];
long long MOD = 1000 * 1000 * 1000 + 7;
long long DP[4001][4001];
long long pre[4001];
long long solve(int n, int k) {
  if (n == k || k == 1) return 1;
  long long &ret = DP[n][k];
  if (ret != -1) return ret;
  return ret = ((k % MOD) * (solve(n - 1, k) % MOD)) +
               (solve(n - 1, k - 1) % MOD);
}
int main() {
  std::ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  memset(DP, -1, sizeof(DP));
  memset(pre, 0, sizeof(pre));
  pascals[0][0] = 1;
  for (int i = 1; i < 4001; i++) {
    pascals[i][0] = 1;
    for (int j = 1; j < 4001; j++) {
      pascals[i][j] = (pascals[i - 1][j] % MOD) + (pascals[i - 1][j - 1] % MOD);
      pascals[i][j] %= MOD;
    }
  }
  for (int i = 1; i < 4001; i++) {
    for (int j = 1; j <= i; j++) {
      pre[i] += solve(i, j);
      pre[i] %= MOD;
    }
  }
  long long ans = 1;
  for (int i = 1; i < n; i++) {
    ans += ((pascals[n][i] % MOD) * pre[i]) % MOD;
    ans %= MOD;
  }
  cout << ans;
}
