#include <bits/stdc++.h>
const double EPS = 1e-24;
const long long int MOD = 1000000007ll;
const double PI = 3.14159265359;
int INF = 2147483645;
template <class T>
T Max2(T a, T b) {
  return a < b ? b : a;
}
template <class T>
T Min2(T a, T b) {
  return a < b ? a : b;
}
template <class T>
T Max3(T a, T b, T c) {
  return Max2(Max2(a, b), c);
}
template <class T>
T Min3(T a, T b, T c) {
  return Min2(Min2(a, b), c);
}
template <class T>
T Max4(T a, T b, T c, T d) {
  return Max2(Max2(a, b), Max2(c, d));
}
template <class T>
T Min4(T a, T b, T c, T d) {
  return Min2(Min2(a, b), Max2(c, d));
}
using namespace std;
int S2[4001][4001], N;
int main() {
  for (int i = 1; i <= 4000; i++)
    for (int j = 1; j <= 4000; j++) {
      if (i == 1 && j == 1)
        S2[i][j] = 1;
      else if (i == 1)
        S2[i][j] = 0;
      else
        S2[i][j] = (1LL * j * S2[i - 1][j] + S2[i - 1][j - 1]) % MOD;
    }
  scanf("%d", &N);
  int ans = 0;
  for (int i = 1; i <= N; i++) ans = (ans + 1LL * i * S2[N][i]) % MOD;
  printf("%d\n", ans);
  return 0;
}
