#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000 * 1000 * 1000 + 7;
const int maxn = 4000 + 10;
long long C[maxn][maxn];
long long B[maxn];
void GetAllC(int n) {
  for (int i = 0; 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;
  }
}
void GetBell(int n) {
  B[0] = B[1] = 1;
  for (int i = 2; i <= n; ++i) {
    B[i] = 0;
    for (int j = 0; j <= i - 1; ++j) {
      B[i] = (B[i] + C[i - 1][j] * B[j] % mod) % mod;
    }
  }
}
int main() {
  GetAllC(4000);
  GetBell(4000);
  int n;
  scanf("%d", &n);
  long long res = 1;
  for (int i = 1; i <= n - 1; ++i) {
    res = (res + C[n][i] * B[i] % mod) % mod;
  }
  printf("%lld\n", res);
  return 0;
}
