#include <bits/stdc++.h>
using namespace std;
int f[4000 + 5][4000 + 5];
int c[4000 + 5][4000 + 5];
int n;
int mod = 1e9 + 7;
int ans = 0;
int main() {
  scanf("%d", &n);
  f[0][0] = 1;
  for (int i = 0; i < n; i++)
    for (int j = 0; j <= i; j++) {
      f[i + 1][j + 1] = (f[i + 1][j + 1] + f[i][j]) % mod;
      f[i + 1][j] = (f[i + 1][j] + 1ll * f[i][j] * j) % mod;
    }
  c[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    c[0][i] = 1;
    c[i][i] = 1;
    for (int j = 1; j < n; j++) c[j][i] = (c[j][i - 1] + c[j - 1][i - 1]) % mod;
  }
  for (int i = 0; i <= n; i++)
    for (int j = 1; j <= n; j++) f[i][j] = (f[i][j] + f[i][j - 1]) % mod;
  for (int i = 1; i <= n; i++) ans = (ans + 1ll * c[i][n] * f[n - i][n]) % mod;
  printf("%d ", ans);
}
