#include <bits/stdc++.h>
using namespace std;
const int N = 1000000 + 1;
const long long MOD = 1000000000 + 7;
vector<pair<int, int> > factorization[N];
int tot[N];
int n;
long long factorial[N];
map<int, long long> dp[N];
void init() {
  for (int i = 2; i < N; ++i) {
    if (factorization[i].empty()) {
      for (int j = i; j < N; j += i) {
        int num = j;
        int cnt = 0;
        while (num % i == 0) {
          tot[j]++;
          cnt++;
          num /= i;
        }
        factorization[j].push_back({i, cnt});
      }
    }
  }
  factorial[0] = 1;
  for (int i = 1; i < N; ++i) factorial[i] = i * factorial[i - 1] % MOD;
}
long long solve(int num, int taken, int rem) {
  if (tot[num] == 0) return factorial[rem];
  auto it = dp[num].find(taken);
  if (it != dp[num].end()) return it->second;
  long long &ret = dp[num][taken];
  if (n / num - taken > 0)
    ret = (ret + solve(num, taken + 1, rem - 1) * (n / num - taken)) % MOD;
  for (pair<int, int> p : factorization[num]) {
    int nxtNum = num / p.first;
    ret = (ret + solve(nxtNum, taken + 1, rem - 1) * (n / nxtNum - (n / num))) %
          MOD;
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  init();
  cin >> n;
  int maxi = *max_element(tot, tot + n + 1);
  long long ans = 0;
  for (int i = 1; i <= n; ++i)
    if (tot[i] == maxi) ans = (ans + solve(i, 1, n - 1)) % MOD;
  cout << ans << endl;
}
