#include <bits/stdc++.h>
using namespace std;
const long long mod = (1e9 + 7);
long long dp[4010][4010], c[4010][4010];
void init(int n) {
  c[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    c[i][0] = c[i][i] = 1;
    for (int j = 1; j < i; j++) {
      c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod;
    }
  }
  dp[1][1] = 1;
  dp[0][0] = 1;
  for (int i = 2; i <= n; i++) {
    dp[i][1] = dp[i - 1][i - 1];
    for (int j = 2; j <= i; j++) {
      dp[i][j] = dp[i][j - 1] + dp[i - 1][j - 1];
      dp[i][j] %= mod;
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  init(n);
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += ((c[n][i] * dp[i][i]) % mod);
    ans %= mod;
  }
  printf("%lld\n", ans);
  return 0;
}
