#include <bits/stdc++.h>
using namespace std;
int n, dp[4005][4005], dps[4005], comb[4005][4005];
int main() {
  scanf("%d", &n);
  dp[0][0] = 1;
  dps[0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= i; j++) {
      dp[i][j] = (dp[i - 1][j - 1] + 1LL * j * dp[i - 1][j]) % 1000000007;
      dps[i] += dp[i][j];
      while (dps[i] >= 1000000007) dps[i] -= 1000000007;
    }
  comb[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    comb[i][0] = 1;
    for (int j = 1; j <= i; j++) {
      comb[i][j] = comb[i - 1][j] + comb[i - 1][j - 1];
      while (comb[i][j] >= 1000000007) comb[i][j] -= 1000000007;
    }
  }
  int sol = 0;
  for (int i = 0; i < n; i++)
    sol = (sol + 1LL * comb[n][n - i] * dps[i]) % 1000000007;
  printf("%d\n", sol);
  return 0;
}
