#include <bits/stdc++.h>
using namespace std;
long long pascal[4005][4005], arr[4005][4005];
long long eq[4005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) {
      if (j == 0) {
        pascal[i][j] = 1;
      } else {
        pascal[i][j] = 0;
      }
    }
  }
  for (int i = 1; i < n + 1; i++) {
    for (int j = 1; j <= i; j++) {
      pascal[i][j] = (pascal[i - 1][j - 1] + pascal[i - 1][j]) % 1000000007;
    }
  }
  eq[0] = 1;
  arr[0][0] = 1;
  for (int i = 1; i < n - 1; i++) {
    for (int j = 0; j <= i; j++) {
      if (j == 0) {
        arr[i][j] = arr[i - 1][i - 1];
      } else {
        arr[i][j] = (arr[i - 1][j - 1] + arr[i][j - 1]) % 1000000007;
      }
    }
  }
  for (int i = 1; i < n; i++) {
    eq[i] = arr[i - 1][i - 1];
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    long long temp = (eq[i] * pascal[n][i]) % 1000000007;
    ans = (ans + temp) % 1000000007;
  }
  printf("%I64d", ans);
}
