#include <bits/stdc++.h>
using namespace std;
long long C[4002][4002], f[4002][4002], g[4002];
int n;
void Pre() {
  memset(C, 0, sizeof(C));
  C[0][0] = 1;
  for (int i = 1; i <= n; i++) C[0][i] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= i; j++)
      C[j][i] = (C[j][i - 1] + C[j - 1][i - 1]) % 1000000007;
}
void Solve_() {
  f[0][0] = 1;
  for (int i = 1; i <= n; i++) f[i][i] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j < n; j++)
      f[i][j] = ((f[i - 1][j] * j) % 1000000007 + f[i - 1][j - 1]) % 1000000007;
  memset(g, 0, sizeof(g));
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= n; j++) {
      g[i] += f[i][j];
      g[i] %= 1000000007;
    }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += g[n - i] * C[i][n];
    ans %= 1000000007;
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  Pre();
  Solve_();
  return 0;
}
