#include <bits/stdc++.h>
using namespace std;
const int MAXN = 4001, MOD = 1e9 + 7;
int N;
long long fact[MAXN], bell[MAXN], BC[MAXN][MAXN], ans = 1;
int main() {
  scanf("%d", &N);
  fact[0] = 1;
  bell[0] = 1;
  for (int i = 1; i < (int)N + 1; i++) fact[i] = (fact[i - 1] * i) % MOD;
  for (int i = 0; i < (int)N + 1; i++) BC[i][0] = BC[i][i] = 1;
  for (int i = 1; i < (int)N + 1; i++)
    for (int j = 1; j < (int)i; j++)
      BC[i][j] = (BC[i - 1][j] + BC[i - 1][j - 1]) % MOD;
  for (int i = 1; i < (int)N; i++) {
    bell[i] = 0;
    for (int k = 0; k < (int)i; k++)
      bell[i] = (bell[i] + (BC[i - 1][k] * bell[k]) % MOD) % MOD;
    ans = (ans + (BC[N][i] * bell[i]) % MOD) % MOD;
  }
  cout << ans << endl;
}
