#include <bits/stdc++.h>
using namespace std;
long long c[4010][4010], dp[4010][4010], sum[4010];
void init() {
  memset(c, 0, sizeof(c));
  c[0][0] = 1;
  for (int i = 1; i <= 4000; 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]) % 1000000007;
  }
  memset(dp, 0, sizeof(dp));
  memset(sum, 0, sizeof(sum));
  dp[1][1] = 1, sum[1] = 1;
  for (int i = 2; i <= 4000; i++) {
    sum[i] = 0;
    for (int j = 1; j < i; j++) {
      dp[i][j] = (dp[i][j] + j * dp[i - 1][j]) % 1000000007;
      dp[i][j + 1] = (dp[i][j + 1] + dp[i - 1][j]) % 1000000007;
    }
    for (int j = 1; j <= i; j++) sum[i] = (sum[i] + dp[i][j]) % 1000000007;
  }
}
int main() {
  init();
  int n;
  long long ans;
  cin >> n;
  ans = 1;
  for (int i = 1; i < n; i++) {
    ans = (ans + c[n][i] * sum[i]) % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
