#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long dp[4005][4005], dpp[4005], c[4005][4005];
void init() {
  memset(dp, 0LL, sizeof(dp));
  dp[1][1] = 1, dp[2][1] = 1, dp[2][2] = 1;
  for (long long i = 2; i < 4000; i++) {
    for (long long j = 1; j <= i; j++) {
      dp[i + 1][j] = (dp[i + 1][j] + j * dp[i][j] % MOD) % MOD;
      dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j]) % MOD;
    }
  }
  memset(dpp, 0LL, sizeof(dpp));
  dpp[0] = 1;
  for (long long i = 1; i <= 4000; i++) {
    for (long long j = 1; j <= i; j++) dpp[i] = (dpp[i] + dp[i][j]) % MOD;
  }
  memset(c, 0LL, sizeof(c));
  for (long long i = 0; i <= 4000; i++) c[i][0] = 1;
  for (long long i = 1; i <= 4000; i++) {
    for (long long j = 1; j <= i; j++) {
      c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % MOD;
    }
  }
}
int main() {
  init();
  long long n, ans = 0;
  scanf("%I64d", &n);
  for (long long k = 0; k < n; k++) {
    ans = (ans + c[n][k] * dpp[k] % MOD) % MOD;
  }
  printf("%I64d\n", ans);
  return 0;
}
