#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
long long int bell[4100];
long long int com[4100][4100];
long long int ans;
int n;
int main(void) {
  int i, j;
  cin >> n;
  bell[0] = 1;
  bell[1] = 1;
  bell[2] = 2;
  com[0][0] = 1;
  for (i = 1; i <= n; i++) {
    com[i][0] = 1;
    com[i][i] = 1;
  }
  for (i = 2; i <= n; i++) {
    for (j = 1; j <= i - 1; j++) {
      com[i][j] = (com[i - 1][j - 1] + com[i - 1][j]) % mod;
    }
  }
  for (i = 2; i <= n; i++) {
    for (j = 0; j <= i; j++) {
      bell[i + 1] = (bell[i + 1] + (com[i][j] * bell[j]) % mod) % mod;
    }
  }
  for (i = 1; i <= n; i++) {
    ans = (ans + (com[n][i] * bell[n - i]) % mod) % mod;
  }
  cout << ans;
}
