#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000007LL;
const int NMax = 4010;
int N;
long long C[2][NMax], dp[NMax][NMax], F[NMax];
int main() {
  scanf("%d", &N);
  dp[1][1] = 1;
  F[0] = F[1] = 1;
  for (int i = 2; i <= N; i++) {
    for (int j = 1; j <= i; j++) {
      dp[i][j] = (dp[i - 1][j] * (long long)j % INF + dp[i - 1][j - 1]) % INF;
      F[i] = (F[i] + dp[i][j]) % INF;
    }
  }
  C[0][0] = 1;
  for (int i = 1; i <= N; i++) {
    C[1][0] = 1;
    for (int j = 1; j <= i; j++) C[1][j] = (C[0][j] + C[0][j - 1]) % INF;
    for (int j = 0; j <= i; j++) C[0][j] = C[1][j];
    C[0][i + 1] = 0;
  }
  long long ret = 0;
  for (int i = 0; i < N; i++) ret = (ret + C[1][i] * F[i] % INF) % INF;
  printf("%I64d\n", ret);
  getchar();
  getchar();
  return 0;
}
