#include <bits/stdc++.h>
using namespace std;
long long ncr[4005][4005];
long long bell[4005];
const long long MOD = 1000000007;
int main() {
  for (int i = 0; i <= 4000; i++) ncr[i][0] = 1;
  for (int j = 1; j <= 4000; j++) {
    for (int i = j; i <= 4000; i++) {
      ncr[i][j] = ncr[i - 1][j] + ncr[i - 1][j - 1];
      ncr[i][j] %= MOD;
    }
  }
  bell[0] = 1;
  for (int i = 1; i <= 4000; i++) {
    bell[i] = 0;
    for (int j = 0; j < i; j++) {
      bell[i] += bell[j] * ncr[i - 1][j];
      bell[i] %= MOD;
    }
  }
  int n;
  cin >> n;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += bell[n - i] * ncr[n][i];
    ans %= MOD;
  }
  cout << ans << endl;
}
