#include <bits/stdc++.h>
const int MOD = 1000000007;
const int MN = 4002;
struct num {
  int val;
  num(int a) { val = a; }
  num() {}
  num operator+(num b) { return ((long long)val + (long long)b.val) % MOD; }
  num operator*(num b) { return ((long long)val * (long long)b.val) % MOD; }
};
int n, aux, k;
num comb[MN][MN], bell[MN], ans;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n + 1; i++) comb[i][0] = 1;
  for (int i = 1; i < n + 1; i++)
    for (int j = 1; j < n + 1; j++)
      comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j];
  bell[0] = bell[1] = 1;
  for (int i = 2; i < n + 1; i++)
    for (int j = 0; j < i; j++) bell[i] = bell[i] + comb[i - 1][j] * bell[j];
  ans = 0;
  for (int k = 1; k < n + 1; k++) ans = ans + comb[n][k] * bell[n - k];
  printf("%d\n", ans);
}
