#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const long long N = 4010;
const long long MOD = 1e9 + 7;
long long b[N + 1], f[N + 1], r[N + 1];
long long ppow(long long x, long long y) {
  long long ans = 1;
  while (y) {
    if (y & 1) ans = ans * x % MOD;
    x = x * x % MOD;
    y >>= 1;
  }
  return ans;
}
long long c(long long n, long long k) {
  return f[n] * r[k] % MOD * r[n - k] % MOD;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  f[0] = 1;
  for (long long i = 1; i <= N; i++) f[i] = f[i - 1] * i % MOD;
  r[N] = ppow(f[N], MOD - 2);
  for (long long i = N - 1; i >= 0; i--) r[i] = r[i + 1] * (i + 1) % MOD;
  b[0] = 1;
  for (long long n = 0; n + 1 <= N; n++)
    for (long long k = 0; k <= n; k++)
      b[n + 1] = (b[n + 1] + c(n, k) * b[k]) % MOD;
  long long n;
  cin >> n;
  long long ans = 0;
  for (long long i = 1; i <= n; i++)
    ans = (ans + c(n, i) * b[n - i] % MOD) % MOD;
  cout << ans;
}
