#include <bits/stdc++.h>
using namespace std;
const int maxn = 4000 + 10;
const long long MOD = 1000000007;
long long C[maxn][maxn], d[maxn][maxn];
void add(long long& x, long long y) {
  x += y;
  if (x >= MOD) x -= MOD;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i <= n; i++) C[i][0] = C[i][i] = 1;
  for (int i = 2; i <= n; i++)
    for (int j = 1; j < i; j++) C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % MOD;
  d[0][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= i; j++)
      d[i][j] = (d[i - 1][j] * j + d[i - 1][j - 1]) % MOD;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    long long eq = 0;
    for (int j = 0; j <= i; j++) add(eq, d[i][j]);
    ans = (ans + C[n][i] * eq) % MOD;
  }
  printf("%I64d\n", ans);
  return 0;
}
