#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000")
long long dp[4040][4040], c[4040][4040];
void init() {
  dp[0][0] = dp[1][1] = 1;
  for (int i = 1; i < 4040; 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]) % 1000000007;
  }
  for (int i = 1; i < 4040; i++) {
    c[i][0] = c[i][i] = 1;
    for (int j = 1; j < i; j++) {
      c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % 1000000007;
    }
  }
}
int main() {
  int n;
  init();
  while (~scanf("%d", &n)) {
    long long ans = 0;
    for (int i = 0; i < n; i++) {
      ans += c[n][i] * dp[i][i];
      ans %= 1000000007;
    }
    cout << ans << endl;
  }
  return 0;
}
