#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 4001;
const int maxm = maxn * maxn;
int C[maxn][maxn];
int f[maxn];
int n, ans;
int main() {
  for (int i = 0; i < maxn; i++) {
    C[i][0] = C[i][i] = 1;
    for (int j = 1; j < i; j++) C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
  }
  f[0] = 1;
  for (int i = 1; i < maxn; i++)
    for (int j = 1; j <= i; j++)
      f[i] = (f[i] + 1LL * C[i - 1][j - 1] * f[i - j]) % mod;
  while (cin >> n) {
    ans = 0;
    for (int i = 0; i < n; i++) ans = (ans + 1LL * C[n][i] * f[i]) % mod;
    cout << ans << endl;
  }
}
