#include <bits/stdc++.h>
using namespace std;
int n;
long long c[4007][4007];
long long b[4007][4007];
const long long mod = 1e9 + 7;
void init() {
  c[0][0] = c[1][0] = c[1][1] = 1;
  for (int i = 2; i < 4007; i++)
    for (int j = 0; j <= i; j++)
      if (j == 0 || j == i)
        c[i][j] = 1;
      else {
        c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
        c[i][j] %= mod;
      }
  b[0][0] = b[1][1] = 1;
  for (int i = 2; i < 4007; i++) {
    b[i][1] = b[i - 1][i - 1];
    for (int j = 2; j <= i; j++) {
      b[i][j] = b[i][j - 1] + b[i - 1][j - 1];
      b[i][j] %= mod;
    }
  }
}
int main() {
  init();
  while (~scanf("%d", &n)) {
    long long ans = 0;
    for (int i = 0; i < n; i++) {
      ans += c[n][i] * b[i][i] % mod;
      ans %= mod;
    }
    printf("%I64d\n", ans);
  }
}
