#include <bits/stdc++.h>
using namespace std;
double const pi = 3.14159265358979;
int const MAXN = 2000000;
long long const MOD = 1000000007;
long long const INF = 1000000000000000000;
long long f[100001], b[100001];
long long c[4001][4001], a[4001][4001];
long long get_pow(long long x, long long k) {
  if (k == 0) return 1;
  if (k % 2 == 0) {
    long long y = get_pow(x, k / 2);
    return (y * y) % MOD;
  } else {
    return (x * get_pow(x, k - 1)) % MOD;
  }
}
long long inv(long long x) { return get_pow(x, MOD - 2); }
long long get_c(long long n, long long k) {
  if (k > n) {
    return 0;
  }
  return f[n] * inv((f[k] * f[n - k]) % MOD) % MOD;
}
int main() {
  int n, m;
  f[0] = 1;
  for (int i = (int)1; i <= (int)(100000); i++) {
    f[i] = (f[i - 1] * i) % MOD;
  }
  c[0][0] = 1;
  for (int i = (int)1; i <= (int)(4000); i++) {
    c[i][0] = 1;
    for (int j = (int)1; j <= (int)(i); j++) {
      c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % MOD;
    }
  }
  a[0][0] = 1;
  b[0] = 1;
  for (int i = (int)1; i <= (int)(4000); i++) {
    for (int j = (int)1; j <= (int)(i); j++) {
      a[i][j] = (a[i - 1][j] * j + a[i - 1][j - 1]) % MOD;
      b[i] += a[i][j];
      b[i] %= MOD;
    }
  }
  long long res = 0;
  cin >> n;
  for (int i = 0; i < (int)(n); i++) {
    res += (b[i] * c[n][i]) % MOD;
    res %= MOD;
  }
  cout << res;
  return 0;
}
