#include <bits/stdc++.h>
using namespace std;
int64_t mod = 1e9 + 7;
int32_t main() {
  ios::sync_with_stdio(false), cin.tie(nullptr);
  int64_t n, sum = 0;
  cin >> n;
  vector<vector<int64_t> > ster(n + 1, vector<int64_t>(n + 1)),
      choose(n + 1, vector<int64_t>(n + 1));
  vector<int64_t> bell(n + 1, 0);
  for (int64_t i = 0; i < int64_t(n + 1); ++i)
    ster[i][0] = choose[0][i] = ster[0][i] = 0, choose[i][0] = 1;
  ster[0][0] = choose[0][0] = bell[0] = 1;
  for (int64_t i = 1; i < int64_t(n + 1); ++i)
    for (int64_t j = 1; j < int64_t(n + 1); ++j) {
      ster[i][j] = (ster[i - 1][j - 1] + ster[i - 1][j] * j) % mod;
      choose[i][j] = (choose[i - 1][j - 1] + choose[i - 1][j]) % mod;
      bell[i] = (bell[i] + ster[i][j]) % mod;
    }
  for (int64_t i = 1; i < int64_t(n + 1); ++i)
    sum = (sum + choose[n][i] * bell[n - i]) % mod;
  cout << sum;
  return 0;
}
