#include <bits/stdc++.h>
using namespace std;
const int maxn = 4005;
const int P = 1e9 + 7;
void read(int &x) { scanf("%d", &x); }
long long inv[maxn], fact[maxn], fact_inv[maxn];
long long Com(int n, int m) {
  return fact[n] * fact_inv[n - m] % P * fact_inv[m] % P;
}
long long dp[maxn];
int main() {
  int n;
  read(n);
  inv[1] = fact[0] = fact_inv[0] = 1;
  for (int i = 2; i <= n; i++) inv[i] = (P - P / i * inv[P % i] % P) % P;
  for (int i = 1; i <= n; i++) fact[i] = fact[i - 1] * i % P;
  for (int i = 1; i <= n; i++) fact_inv[i] = fact_inv[i - 1] * inv[i] % P;
  dp[0] = 1;
  for (int i = 0; i <= n - 1; i++)
    for (int j = 0; j <= i; j++) (dp[i + 1] += dp[i - j] * Com(i, j) % P) %= P;
  long long ans = 0;
  for (int i = 0; i <= n - 1; i++) (ans += Com(n, i) * dp[i] % P) %= P;
  printf("%lld", ans);
}
