#include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7, M = 4000;
long long v[M + 5], inv[M + 5], dp[M + 5][M + 5];
long long fpow(long long x, int k) {
  long long res = 1;
  while (k) {
    if (k & 1) res = (res * x) % P;
    x = (x * x) % P;
    k >>= 1;
  }
  return res;
}
void pre() {
  v[0] = 1;
  for (int i = 1; i <= M; ++i) v[i] = (v[i - 1] * i) % P;
  inv[M] = fpow(v[M], P - 2);
  for (int i = M - 1; i >= 0; --i) inv[i] = (inv[i + 1] * (i + 1)) % P;
}
long long C(int n, int m) { return v[n] * inv[n - m] % P * inv[m] % P; }
int main() {
  pre();
  int n;
  long long ans = 1;
  cin >> n;
  dp[0][0] = 1;
  for (int i = 1; i < n; ++i) {
    for (int j = 1; j < n; ++j) {
      dp[i][j] = (dp[i - 1][j - 1] + dp[i - 1][j] * j % P) % P;
      ans = (ans + dp[i][j] * C(n, i) % P) % P;
    }
  }
  cout << ans;
  return 0;
}
