#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int MAXN = 4003;
long long qmod(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return res;
}
long long dp[MAXN][MAXN];
long long bell[MAXN];
int main() {
  for (int i = 0; i < MAXN; i++) dp[i][0] = dp[0][i] = 0;
  dp[0][0] = 1;
  for (int i = 1; i < MAXN; i++) {
    for (long long j = 1; j <= i; j++)
      dp[i][j] = (j * dp[i - 1][j] % MOD + dp[i - 1][j - 1]) % MOD;
    bell[i] = 0;
    for (int j = 1; j <= i; j++) bell[i] = (dp[i][j] + bell[i]) % MOD;
  }
  int n;
  scanf("%d", &n);
  long long sum = 1;
  long long c = 1;
  for (long long i = 1; i < n; i++) {
    c = ((c * (n - i + 1)) % MOD * qmod(i, MOD - 2)) % MOD;
    sum = (sum + bell[i] * c % MOD) % MOD;
  }
  printf("%I64d\n", sum);
  return 0;
}
