#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int dp[4010][4010];
void init() {
  dp[1][1] = 1;
  for (int i = 2; i <= 4001; i++) {
    dp[i][1] = dp[i - 1][i - 1];
    for (int j = 2; j <= i; j++)
      dp[i][j] = (dp[i - 1][j - 1] + dp[i][j - 1]) % mod;
  }
}
int main() {
  init();
  int i, j, k, m, n;
  while (scanf("%d", &n) == 1)
    printf("%d\n", (dp[n + 1][n + 1] - dp[n][n] + mod) % mod);
  return 0;
}
