#include <bits/stdc++.h>
using namespace std;
long long c[4005][4005], b[4005][4005];
int n, ans;
void init() {
  c[0][0] = 1;
  for (int i = 1; i <= 4000; ++i)
    for (int j = 0; j <= i; ++j) {
      if (j == 0 || j == i)
        c[i][j] = 1;
      else
        c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % 1000000007;
    }
  b[0][0] = b[1][1] = 1;
  for (int i = 2; i <= 4000; ++i) {
    b[i][1] = b[i - 1][i - 1];
    for (int j = 2; j <= i; ++j)
      b[i][j] = (b[i][j - 1] + b[i - 1][j - 1]) % 1000000007;
  }
}
int main() {
  init();
  scanf("%d", &n);
  for (int i = 0; i < n; ++i)
    ans = (ans + c[n][i] * b[i][i] % 1000000007) % 1000000007;
  printf("%d\n", ans);
}
