#include <bits/stdc++.h>
using namespace std;
int DP[4005];
int ncr[4005][4005];
int solve(int n) {
  if (n == 0) return 1;
  int &temp = DP[n];
  if (temp != -1) return temp;
  temp = 0;
  for (int i = 1; i <= n; i++) {
    temp += (solve(n - i) * 1LL * ncr[n - 1][i - 1]) % 1000000007;
    if (temp >= 1000000007) temp -= 1000000007;
  }
  return temp;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i <= n; i++) {
    DP[i] = -1;
    ncr[i][0] = 1;
    for (int j = 1; j <= i; j++) {
      ncr[i][j] = ncr[i - 1][j] + ncr[i - 1][j - 1];
      if (ncr[i][j] >= 1000000007) ncr[i][j] -= 1000000007;
    }
  }
  int res = 1;
  for (int i = 1; i < n; i++) {
    res += (solve(i) * 1LL * ncr[n][i]) % 1000000007;
    if (res >= 1000000007) res -= 1000000007;
  }
  printf("%d", res);
  return 0;
}
