#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000002ll * 1000000002ll;
long long cnk[4002][4002];
void setCnk(int n) {
  cnk[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    cnk[i][0] = 1;
    for (int j = 1; j < i; ++j)
      cnk[i][j] = (cnk[i - 1][j - 1] + cnk[i - 1][j]) % 1000000007;
    cnk[i][i] = 1;
  }
}
long long groups[12345];
int main() {
  ios_base::sync_with_stdio(0);
  long long n;
  cin >> n;
  setCnk(n);
  groups[0] = 1;
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j < i; ++j) {
      groups[i] += cnk[i - 1][j] * groups[i - j - 1];
      groups[i] %= 1000000007;
    }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    ans += cnk[n][i] * groups[n - i];
    ans %= 1000000007;
  }
  cout << ans;
  return 0;
}
