#include <bits/stdc++.h>
using namespace std;
const int Maxn = 4020, M = 1e9 + 7;
int c[Maxn][Maxn];
void getc() {
  for (int i = 0; i < Maxn; i++) c[i][0] = 1;
  for (int i = 1; i < Maxn; i++) {
    for (int j = 1; j <= i; j++) c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % M;
  }
}
int dp[Maxn][Maxn];
int rep[Maxn];
int main() {
  int n;
  getc();
  while (scanf("%d", &n) != EOF) {
    dp[1][1] = 1;
    for (int i = 1; i < n; i++)
      for (int j = 1; j <= i; j++) {
        if (dp[i][j]) {
          dp[i + 1][j + 1] += dp[i][j];
          if (dp[i + 1][j + 1] >= M) dp[i + 1][j + 1] -= M;
          dp[i + 1][j] += dp[i][j] * (long long)j % M;
          if (dp[i + 1][j] >= M) dp[i + 1][j] -= M;
        }
      }
    for (int j = 1; j <= n; j++)
      for (int i = 1; i <= j; i++) rep[j] = (rep[j] + dp[j][i]) % M;
    int ans = 1;
    for (int i = 1; i < n; i++) {
      ans = (ans + (long long)c[n][i] * rep[i] % M) % M;
    }
    printf("%d\n", ans);
  }
}
