#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int maxn = 4000 + 5;
long long C[maxn][maxn];
long long f[maxn][maxn];
long long eq[maxn];
int main() {
  C[0][0] = 1;
  for (int i = 1; i < maxn; i++)
    for (int j = 0; j <= i; j++)
      if (!j)
        C[i][j] = 1;
      else
        C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
  f[0][0] = 1;
  for (int i = 0; i < maxn - 1; i++)
    for (long long j = 0; j <= i; j++) {
      (f[i + 1][j + 1] += f[i][j]) %= mod;
      (f[i + 1][j] += (j * f[i][j]) % mod) %= mod;
    }
  for (int i = 0; i < maxn; i++)
    for (int j = 0; j <= i; j++) (eq[i] += f[i][j]) %= mod;
  int n;
  scanf("%d", &n);
  long long ans = 0;
  for (int i = 1; i < n; i++) (ans += C[n][i] * eq[n - i]) %= mod;
  printf("%lld\n", ans + 1);
}
