#include <bits/stdc++.h>
using namespace std;
void solve();
int32_t main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
long long dp[4005][4005];
long long c[4005][4005];
long long a[4005] = {0};
const long long M = 1e9 + 7;
void compute() {
  memset(c, 0, sizeof c);
  c[0][0] = 1;
  for (long long i = 1; i <= 4000; ++i) {
    c[i][0] = 1;
    for (long long j = 1; j <= i; ++j) {
      c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % M;
    }
  }
}
void solve() {
  compute();
  memset(dp, 0, sizeof dp);
  long long n;
  cin >> n;
  dp[0][0] = 1;
  for (long long i = 1; i <= 4000; ++i) {
    for (long long j = 1; j <= 4000; ++j) {
      dp[i][j] = (dp[i - 1][j - 1] + (j * dp[i - 1][j]) % M) % M;
    }
  }
  for (long long i = 0; i <= 4000; ++i) {
    for (long long j = 0; j <= i; ++j) a[i] += dp[i][j], a[i] %= M;
  }
  long long ans = 0;
  for (long long i = 0; i <= n - 1; ++i) {
    ans += (c[n][i] * a[i]) % M, ans %= M;
  }
  cout << ans;
}
