#include <bits/stdc++.h>
const int maxn = 4005;
const int maxv = 4000;
const long long mod = 1e9 + 7;
long long f[maxn][maxn], C[maxn][maxn], g[maxn];
int main() {
  int n;
  scanf("%d", &n);
  C[1][0] = C[1][1] = 1;
  for (int i = 2; i <= n; i++) {
    C[i][0] = 1;
    for (int j = 1; j <= i; j++) {
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
    }
  }
  f[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= i; j++) {
      f[i][j] = (j * f[i - 1][j] % mod + f[i - 1][j - 1]) % mod;
      g[i] = (g[i] + f[i][j]) % mod;
    }
  }
  long long ans = 1;
  for (int i = 1; i < n; i++) {
    ans = (ans + C[n][i] * g[n - i] % mod) % mod;
  }
  std::cout << ans << std::endl;
  return 0;
}
