#include <bits/stdc++.h>
const int mo = 1e9 + 7;
int c[4010][4010], f[4010][4010], i, j, n, ans;
int main() {
  scanf("%d\n", &n);
  for (i = 0; i <= n; ++i)
    for (c[i][0] = c[i][i] = j = 1; j < i; ++j) {
      c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
      if (c[i][j] >= mo) c[i][j] -= mo;
    }
  f[0][0] = 1;
  for (i = 1; i <= n; ++i)
    for (j = 1; j <= i; ++j)
      f[i][j] = (1ll * f[i - 1][j] * j + f[i - 1][j - 1]) % mo;
  for (i = 0; i < n; ++i)
    for (j = 0; j <= i; ++j) ans = (ans + 1ll * c[n][i] * f[i][j]) % mo;
  printf("%d\n", ans);
}
