#include <bits/stdc++.h>
using namespace std;
void deba(int* a, int n) {
  cerr << "| ";
  for (int i = 0; i < (n); i++) cerr << a[i] << " ";
  cerr << "|" << endl;
}
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
const int INF = 1 << 30;
long long pt[4001][4001];
long long A[4001];
long long MOD = 1000000007;
void ptfill() {
  for (int i = 0; i < (4001); i++)
    for (int j = (0); j <= (i); j++) {
      if (j == 0 || j == i)
        pt[i][j] = 1;
      else
        pt[i][j] = (pt[i - 1][j - 1] + pt[i - 1][j]) % MOD;
    }
}
long long dp[4001][4001];
void bell_fill() {
  dp[0][0] = 1;
  for (int i = (1); i <= (4000); i++) {
    dp[i][0] = dp[i - 1][i - 1];
    for (int j = (1); j <= (i); j++)
      dp[i][j] = (dp[i][j - 1] + dp[i - 1][j - 1]) % MOD;
  }
}
int main() {
  ptfill();
  bell_fill();
  for (int i = (1); i <= (4000); i++) {
    A[i] = dp[i - 1][i - 1];
  }
  int n;
  scanf("%d", &n);
  ;
  long long sum = 0;
  for (int i = (1); i <= (n - 1); i++) {
    sum += (A[i] * pt[n][i]) % MOD;
    sum %= MOD;
  }
  cout << (sum + 1) % MOD << endl;
  return 0;
}
