#include <bits/stdc++.h>
using namespace std;
const int MAX = 4e3 + 10;
int n;
const int MOD = int(1e9) + 7;
inline int add(const int a, const int b, const int mod = MOD) {
  return (a + b >= mod) ? (a + b - mod) : (a + b);
}
inline int sub(const int a, const int b, const int mod = MOD) {
  return (a - b < 0) ? (a - b + mod) : (a - b);
}
inline void inc(int &a, const int b, const int mod = MOD) {
  a = add(a, b, mod);
}
inline int negate(const int a, const int mod = MOD) { return mod - a; }
inline int mul(const int a, const int b, const int mod = MOD) {
  return (a * 1ll * b) % mod;
}
int binPow(int b, int p, const int mod = MOD) {
  int r = 1;
  while (p) {
    if (p & 1) r = mul(r, b, mod);
    b = mul(b, b, mod);
    p >>= 1;
  }
  return r;
}
int inv(const int a, const int mod = MOD) {
  int res = binPow(a, mod - 2, mod);
  return res;
}
inline int dvd(const int a, const int b, const int mod = MOD) {
  return mul(a, inv(b, mod), mod);
}
int C[MAX][MAX] = {0};
int dp[MAX] = {0};
int dp2[MAX][MAX] = {0};
void clear() {
  memset(dp, -1, sizeof(dp));
  dp[0] = 0;
  dp[1] = 1;
  memset(dp2, -1, sizeof(dp2));
  memset(dp2[0], 0, sizeof(dp2[0]));
  dp2[0][0] = 1;
}
int f2(int n, int ng) {
  if (n == 0 && ng == 0) return 1;
  if (n == 0 || ng == 0) return 0;
  if (dp2[n][ng] == -1) {
    int r = 0;
    r = mul(f2(n - 1, ng), ng);
    r = add(r, f2(n - 1, ng - 1));
    dp2[n][ng] = r;
  }
  return dp2[n][ng];
}
int f(int n) {
  if (dp[n] == -1) {
    int r = 0;
    for (int i = 1; i <= n; i++) r = add(r, f2(n, i));
    dp[n] = r;
  }
  return dp[n];
}
void solve() {
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int tmp;
    tmp = mul(C[n][i], f(i));
    ans = add(ans, tmp);
  }
  printf("%d\n", add(ans, 1));
}
int main() {
  clear();
  C[0][0] = 1;
  for (int i = 1; i < MAX; i++)
    for (int j = 0; j < MAX; j++)
      C[i][j] = j == 0 ? C[i - 1][j] : add(C[i - 1][j - 1], C[i - 1][j]);
  for (int i = 1; i < 100; i++) f(i);
  while (scanf("%d", &n) == 1) {
    clear();
    solve();
    return 0;
  }
  return 0;
}
