#include <bits/stdc++.h>
using namespace std;
long long C[4011][4011];
long long f[4011], g[4011];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = (0), _b = (n); i <= _b; ++i) C[i][0] = 1;
  for (int i = (1), _b = (n); i <= _b; ++i)
    for (int j = (1), _b = (n); j <= _b; ++j)
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % 1000000007ll;
  f[0] = 0;
  g[0] = 1;
  for (int i = (1), _b = (n); i <= _b; ++i) {
    f[i] = g[i - 1];
    for (int t = (0), _b = (i - 1); t <= _b; ++t)
      f[i] = (f[i] + C[i - 1][t] * f[i - t - 1]) % 1000000007ll;
    g[i] = g[i - 1];
    for (int t = (0), _b = (i - 1); t <= _b; ++t)
      g[i] = (g[i] + C[i - 1][t] * g[i - t - 1]) % 1000000007ll;
  }
  printf("%I64d", f[n]);
  return 0;
}
