#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int maxn = 4005;
long long dp[4010], p[4010], np[4010];
long long pow_(long long val, int n) {
  long long x, y;
  x = val;
  y = 1;
  while (n) {
    if (n & 1) y = y * x % mod;
    x = x * x % mod;
    n = n >> 1;
  }
  return y;
}
int main() {
  int i, j, n;
  cin >> n;
  long long ans;
  p[0] = 1;
  np[0] = 1;
  for (i = 1; i <= maxn; i++)
    p[i] = p[i - 1] * i % mod, np[i] = pow_(p[i], mod - 2);
  dp[0] = 1;
  for (i = 1; i <= n; i++) {
    dp[i] = 0;
    for (j = 0; j < i; j++)
      dp[i] =
          (p[i - 1] * np[j] % mod * np[i - 1 - j] % mod * dp[i - 1 - j] % mod +
           dp[i]) %
          mod;
  }
  ans = 0;
  for (i = 0; i < n; i++)
    ans = (dp[i] * p[n] % mod * np[n - i] % mod * np[i] % mod + ans) % mod;
  cout << ans << endl;
}
