#include <bits/stdc++.h>
const int MAXN = 4005;
const int MOD = 1000000007;
int n;
int C[MAXN][MAXN];
int D[MAXN][MAXN];
int E[MAXN];
int main(void) {
  scanf("%d", &n);
  for (int i = 0; i <= n; ++i) {
    C[i][0] = 1;
    for (int j = 1; j <= i; ++j)
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % MOD;
  }
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= n; ++j) {
      if (i == 0 || j == 0) {
        D[i][j] = i == 0 && j == 0;
        continue;
      }
      D[i][j] = ((long long)D[i - 1][j] * j + D[i - 1][j - 1]) % MOD;
      ;
    }
  }
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= n; ++j) E[i] = (E[i] + D[i][j]) % MOD;
  int ans = 0;
  for (int i = 1; i <= n; ++i)
    ans = (ans + (long long)C[n][i] * E[n - i]) % MOD;
  printf("%d\n", ans);
  return 0;
}
