#include <bits/stdc++.h>
using namespace std;
const int N = 4005, md = 1000000007;
int S[2][N], C[2][N], G[N];
int main() {
  int n;
  scanf("%d", &n);
  S[0][0] = 1, C[0][0] = 1;
  G[0] = 1;
  for (int i = 1; i <= n; ++i) {
    C[i & 1][0] = 1;
    S[i & 1][0] = 0;
    G[i] = 0;
    for (int j = 1; j <= i; ++j) {
      C[i & 1][j] = (C[(i - 1) & 1][j - 1] + C[(i - 1) & 1][j]) % md;
      S[i & 1][j] =
          (S[(i - 1) & 1][j - 1] + (long long)j * S[(i - 1) & 1][j]) % md;
      G[i] = (G[i] + S[i & 1][j]) % md;
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i)
    ans = (ans + (long long)C[n & 1][i] * G[n - i]) % md;
  printf("%d\n", ans);
  return 0;
}
