#include <bits/stdc++.h>
using namespace std;
long long B[4001], c[4001][4001], n, ans = 0;
int main() {
  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i <= n; i++) c[i][0] = 1;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++)
        c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % 1000000007;
    B[1] = 1;
    B[0] = 1;
    for (int i = 2; i <= n; i++)
      for (int k = 0; k < i; k++)
        B[i] = (B[i] + 1LL * c[i - 1][k] * B[k] % 1000000007) % 1000000007;
    for (int i = 1; i <= n; i++)
      ans = (ans + 1LL * c[n][i] * B[n - i] % 1000000007) % 1000000007;
    printf("%d\n", ans);
  }
}
