#include <bits/stdc++.h>
using namespace std;
int n;
long long st[4005][4005], f[4005];
int C[4005][4005];
void Stirling() {
  for (int i = 0; i < 4005; i++) st[i][0] = st[i][1] = 1;
  for (int i = 2; i < 4005; i++)
    for (int j = 2; j <= i; j++)
      st[i][j] = (st[i - 1][j - 1] + j * st[i - 1][j]) % 1000000007;
  for (int i = 0; i < 4005; i++)
    for (int j = 1; j <= i; j++) f[i] = (f[i] + st[i][j]) % 1000000007;
}
void C0() {
  for (int i = 0; i < 4005; i++) C[i][0] = C[i][i] = 1;
  for (int i = 1; i < 4005; i++)
    for (int j = 1; j <= i; j++)
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % 1000000007;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  Stirling();
  f[0] = 1;
  C0();
  long long ans = 0;
  for (int i = 0; i <= n - 1; i++)
    ans = (ans + (C[n][i] * (long long)f[i]) % 1000000007) % 1000000007;
  cout << ans << endl;
  return 0;
}
