#include <bits/stdc++.h>
using namespace std;
const int maxn = 4040;
const int mod = 1e9 + 7;
int n;
long long dp[maxn][maxn];
int main() {
  scanf("%d", &n);
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= i; j++)
      dp[i][j] = (dp[i - 1][j] * j % mod + dp[i - 1][j - 1]) % mod;
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans = (ans + dp[n][i] * i) % mod;
  cout << ans << endl;
  return 0;
}
