#include <bits/stdc++.h>
using namespace std;
const long long D = 1ll * 1000 * 1000 * 1000 + 7;
const long long maxn = 4000;
long long c[maxn + 10][maxn + 10];
long long f[maxn + 10];
long long g[maxn + 10];
int main() {
  for (int i = 0; i <= maxn + 5; i++) {
    c[0][i] = 1;
  }
  for (int i = 1; i <= maxn + 5; i++) {
    for (int j = i; j <= maxn + 10; j++) {
      c[i][j] = c[i - 1][j - 1] + c[i][j - 1];
      c[i][j] %= D;
    }
  }
  f[1] = 1;
  g[1] = 2;
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    g[i] = 1 + 2 * g[i - 1];
    g[i] %= D;
    for (int j = 1; j < i - 1; j++) {
      g[i] += c[j][i - 1] * g[i - 1 - j];
      g[i] %= D;
    }
  }
  for (int i = 2; i <= n; i++) {
    f[i] = g[i - 1];
    f[i] %= D;
    for (int j = 0; j <= i - 2; j++) {
      f[i] += 1ll * c[j][i - 1] * f[i - 1 - j];
      f[i] %= D;
    }
  }
  cout << f[n];
  return 0;
}
