#include <bits/stdc++.h>
using namespace std;
const int N = 4009, Mod = 1e9 + 7;
int n, f[N][N], g[N], C[N][N], ans;
inline int add(int x, int y) { return x + y >= Mod ? x + y - Mod : x + y; }
inline int mul(int x, int y) { return 1LL * x * y % Mod; }
void pre(int n) {
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= i; ++j)
      if (j == 1 || j == i)
        C[i][j] = 1;
      else
        C[i][j] = add(C[i - 1][j], C[i - 1][j - 1]);
}
int main() {
  ios::sync_with_stdio(false);
  pre(4000);
  cin >> n;
  f[0][0] = 1;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) {
      f[i][j] = add(f[i - 1][j - 1], mul(j, f[i - 1][j]));
      g[i] = add(g[i], f[i][j]);
    }
  for (int i = 1; i <= n; ++i) ans = add(ans, mul(C[n][i], g[i]));
  printf("%d\n", ans);
}
