#include <bits/stdc++.h>
using namespace std;
const long long oo = 1e18;
const int mod = 1e9 + 7;
long long dp[4001][4001], fact[4001], inv[4001];
long long adl(long long a, long long b) { return (a + b) % mod; }
long long mul(long long a, long long b) { return (a * b) % mod; }
long long fast(long long a, long long b) {
  if (!b) return 1ll;
  long long res = fast(a, b / 2);
  res = mul(res, res);
  if (b & 1) return mul(res, a);
  return res;
}
long long calc(int n, int m) {
  if (n == 0) return 1;
  long long &ret = dp[n][m];
  if (ret != -1) return ret;
  ret = calc(n - 1, m + 1);
  ret = adl(ret, mul(calc(n - 1, m), m));
  return ret;
}
long long nCk(long long n, long long k) {
  return mul(fact[n], mul(inv[k], inv[n - k]));
}
int n;
int main() {
  memset(dp, -1, sizeof dp);
  cin >> n;
  fact[0] = 1;
  inv[0] = fast(fact[0], mod - 2);
  for (int i = 1; i <= n; ++i) {
    fact[i] = mul(fact[i - 1], i);
    inv[i] = fast(fact[i], mod - 2);
  }
  long long res = 0;
  for (int i = 1; i <= n; ++i) {
    long long wys = nCk(n, i);
    res = adl(res, mul(wys, calc(n - i, 0)));
  }
  cout << res << endl;
  return 0;
}
