#include <bits/stdc++.h>
using namespace std;
const int N = 4010;
long long O_O[N][N];
const long long mod = 1e9 + 7;
int main() {
  int o_o;
  memset(O_O, 0, sizeof(O_O));
  O_O[0][0] = 1;
  for (int i = 1; i <= 4000; ++i) {
    if (i < 4000)
      o_o = i;
    else
      o_o = 4000;
    for (int j = 1; j <= o_o; ++j) {
      O_O[i][j] =
          ((long long)j * O_O[i - 1][j] % mod + O_O[i - 1][j - 1]) % mod;
    }
  }
  int n;
  cin >> n;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = (ans + (O_O[n][i] * i) % mod) % mod;
  }
  cout << ans << endl;
}
