#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)1e9 + 7;
vector<vector<long long> > Mul(vector<vector<long long> > A,
                               vector<vector<long long> > B) {
  vector<vector<long long> > C(A.size(), vector<long long>(B[0].size()));
  int la = A.size(), lb = B.size(), lc = B[0].size();
  for (int i = 0; i < la; ++i)
    for (int k = 0; k < lb; ++k)
      for (int j = 0; j < lc; ++j)
        C[i][j] = (C[i][j] + A[i][k] * B[k][j] % MOD) % MOD;
  return C;
}
vector<vector<long long> > Pow(vector<vector<long long> > A, long long n) {
  vector<vector<long long> > B(A.size(), vector<long long>(A.size()));
  int len = A.size();
  for (int i = 0; i < len; ++i) B[i][i] = 1;
  while (n > 0) {
    if (n & 1) B = Mul(B, A);
    A = Mul(A, A);
    n >>= 1;
  }
  return B;
}
const int MAX_N = 4007;
using namespace std;
long long n, m, p;
long long quick_mod(long long a, long long b) {
  long long ans = 1;
  a %= p;
  while (b) {
    if (b & 1) {
      ans = ans * a % p;
      b--;
    }
    b >>= 1;
    a = a * a % p;
  }
  return ans;
}
long long C(long long n, long long m) {
  if (m > n) return 0;
  long long ans = 1;
  for (int i = 1; i <= m; i++) {
    long long a = (n + i - m) % p;
    long long b = i % p;
    ans = ans * (a * quick_mod(b, p - 2) % p) % p;
  }
  return ans;
}
long long Lucas(long long n, long long m) {
  if (m == 0) return 1;
  return C(n % p, m % p) * Lucas(n / p, m / p) % p;
}
void extend_gcd(long long a, long long b, long long &d, long long &x,
                long long &y) {
  if (!b)
    d = a, x = 1, y = 0;
  else {
    extend_gcd(b, a % b, d, y, x);
    y -= x * (a / b);
  }
}
long long Mod(long long a, long long b, long long mod) {
  if (!b) return 1;
  long long ans = Mod(a, b >> 1, mod);
  ans = ans * ans % mod;
  if (b & 1) ans = ans * a % mod;
  return ans;
}
long long inv(long long a, long long mod) {
  long long d, x, y;
  extend_gcd(a, mod, d, x, y);
  return d == 1 ? (x + mod) % mod : -1;
}
long long combine1(long long n, long long m, long long mod) {
  long long sum = 1;
  for (long long i = 1, j = n; i <= m; i++, j--)
    sum = sum * j * inv(i, mod) % mod;
  return sum;
}
long long a[MAX_N][MAX_N];
int main() {
  a[0][0] = 1;
  for (int i = 1; i < MAX_N; ++i) {
    a[i][0] = a[i - 1][i - 1];
    for (int j = 1; j <= i; ++j) {
      a[i][j] = (a[i][j - 1] + a[i - 1][j - 1]) % MOD;
    }
  }
  scanf("%I64d", &n);
  --n;
  long long ans = 0;
  for (int i = 0; i <= n; ++i) ans = (ans + a[n][i]) % MOD;
  printf("%I64d\n", ans);
  vector<vector<long long> > A(2, vector<long long>(2));
  A[0][0] = 1;
  A[0][1] = 1;
  A[1][0] = 1, A[1][1] = 0;
  A = Pow(A, 1000);
  return 0;
}
