#include <bits/stdc++.h>
using namespace std;
long long C[4005][4005], d[4005][4005], b[4005], mod = 1e9 + 7;
int main() {
  long long n;
  cin >> n;
  for (long long i = 0; i <= n; i++) {
    C[i][0] = C[i][i] = 1;
    for (long long j = 1; j < i; j++) {
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
    }
  }
  d[1][1] = 1;
  b[1] = 1;
  b[0] = 1;
  for (long long i = 2; i <= n; i++) {
    for (long long j = 1; j <= i; j++) {
      d[i][j] = (d[i - 1][j - 1] % mod + d[i - 1][j] % mod * j % mod) % mod;
    }
    for (long long j = 1; j <= i; j++) {
      b[i] = (b[i] % mod + d[i][j] % mod) % mod;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = (ans % mod + C[n][i] % mod * b[n - i] % mod) % mod;
  }
  cout << ans % mod << endl;
}
