#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000000LL + 7;
void solve() {
  int N;
  cin >> N;
  vector<vector<long long> > C(4001);
  for (int(i) = 0; (i) < (C.size()); (i)++) C[i].resize(4001);
  vector<vector<long long> > F = C;
  C[0][0] = 1;
  for (int n = (1); n < (int)(N + 1); n++)
    for (int(k) = 0; (k) < (n + 1); (k)++) {
      C[n][k] = C[n - 1][k] + (k ? C[n - 1][k - 1] : 0);
      C[n][k] %= MOD;
    }
  F[0][0] = 1;
  for (int n = (1); n < (int)(N + 1); n++)
    for (int k = (1); k < (int)(n + 1); k++) {
      F[n][k] = (F[n - 1][k - 1] + k * F[n - 1][k]) % MOD;
    }
  vector<long long> F_sum(N + 1);
  for (int(n) = 0; (n) < (N + 1); (n)++)
    for (int(k) = 0; (k) < (n + 1); (k)++) {
      F_sum[n] = (F_sum[n] + F[n][k]) % MOD;
    }
  long long ans = 0;
  for (int i = (1); i < (int)(N + 1); i++) {
    ans += (C[N][i] * F_sum[N - i]) % MOD;
  }
  {
    cout << ans % MOD << endl;
    return;
  };
}
int main() {
  ios_base::sync_with_stdio(0);
  solve();
  return 0;
}
