#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int inf = 50000000;
const int maxn = 4010;
long long bell[maxn], ncr[maxn][maxn];
int main() {
  int i, j, n;
  long long temp = 0;
  bell[0] = 1;
  for (i = 0; i < maxn; i++) {
    ncr[i][0] = 1;
    for (j = 1; j <= i; j++)
      ncr[i][j] = (ncr[i - 1][j - 1] + ncr[i - 1][j]) % mod;
  }
  for (i = 1; i < maxn; i++) {
    temp = 0;
    for (j = 0; j < i; j++)
      temp = (temp + (ncr[i - 1][j] * bell[j]) % mod) % mod;
    bell[i] = temp;
  }
  scanf("%d", &n);
  long long ans = 0;
  for (i = 0; i < n; i++) ans = (ans + (ncr[n][n - i] * bell[i]) % mod) % mod;
  printf("%lld\n", ans);
  return 0;
}
