#include <bits/stdc++.h>
using namespace std;
const int modd = 1000000007;
int n, c[4005][4005], f[4005], g[4005];
int main() {
  cin >> n;
  for (int i = 0; i <= n; i++) c[i][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= i; j++)
      c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % modd;
  f[1] = 1;
  g[1] = 2;
  f[0] = 0;
  g[0] = 1;
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= i; j++)
      g[i] = (g[i] + (((long long)c[i - 1][j - 1] * g[i - j]) % modd)) % modd;
    g[i] = (g[i] + g[i - 1]) % modd;
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= i; j++)
      f[i] = (f[i] + (((long long)c[i - 1][j - 1] * f[i - j]) % modd)) % modd;
    f[i] = (f[i] + g[i - 1]) % modd;
  }
  cout << f[n] << endl;
  return 0;
}
