#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 4020;
int n;
long long f[N], c[N][N];
long long g[N];
int main() {
  c[0][0] = 1;
  for (int i = 1; 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;
  }
  int p, q, n;
  while (scanf("%d", &n) != EOF) {
    f[1] = 1;
    g[1] = 1;
    for (int i = 2; i <= n; i++) {
      f[i] = (2 * f[i - 1] + g[i - 1]) % mod;
      g[i] = g[i - 1] + 1;
      for (int j = 1; j <= i - 1; j++) {
        long long tmp = f[i - 1 - j];
        f[i] = (f[i] + tmp * c[i - 1][j]) % mod;
        g[i] = (g[i - 1 - j] * c[i - 1][j] + g[i]) % mod;
      }
    }
    cout << f[n] << endl;
  }
  return 0;
}
