#include <bits/stdc++.h>
using namespace std;
template <class T>
using vv = vector<vector<T>>;
template <class T>
ostream &operator<<(ostream &os, const vector<T> &t) {
  os << "{";
  for (int(i) = 0; (i) < (t.size()); ++(i)) {
    os << t[i] << ",";
  }
  os << "}" << endl;
  return os;
}
template <class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> &t) {
  return os << "(" << t.first << "," << t.second << ")";
}
const long long MOD = 1e9 + 7;
long long dp[4010][4010], comb[4010][4010];
int count6(int n, int m) {
  long long res = 0;
  for (int i = 1; i <= m; i++) res = (res + dp[n][i]) % MOD;
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(0);
  memset(dp, 0, (int)sizeof(dp));
  dp[0][0] = 1;
  for (int i = 1; i <= 4003; i++) {
    for (int j = 1; j <= 4003; j++) {
      dp[i][j] += dp[i - 1][j] * j % MOD;
      dp[i][j] += dp[i - 1][j - 1];
      dp[i][j] %= MOD;
    }
  }
  for (int(i) = 0; (i) < (4003); ++(i))
    for (int(j) = 0; (j) < (4003); ++(j)) (dp[i][j + 1] += dp[i][j]) %= MOD;
  comb[0][0] = 1;
  for (int(i) = 0; (i) < (4003); ++(i))
    for (int(j) = 0; (j) < (4003); ++(j)) {
      (comb[i + 1][j] += comb[i][j]) %= MOD;
      (comb[i + 1][j + 1] += comb[i][j]) %= MOD;
    }
  int n;
  cin >> n;
  long long re = 0;
  for (int(i) = 0; (i) < (n); ++(i)) (re += dp[i][i] * comb[n][i] % MOD) %= MOD;
  cout << re << endl;
  return 0;
}
