#include <bits/stdc++.h>
using namespace std;
int main() {
  const int64_t mod = 1000000007;
  auto mul = [&](int64_t a, int64_t b) { return a * b % mod; };
  int n, k = 0;
  cin >> n;
  for (int m = n >> 1; m; m >>= 1) ++k;
  map<int, int64_t> dp0;
  dp0[(1 << k) * 3] = 1;
  for (int i = 0; i != n; ++i) {
    map<int, int64_t> dp1;
    for (const auto& dp : dp0) {
      int cnt = n / dp.first;
      if (i < cnt) dp1[dp.first] += mul(dp.second, cnt - i);
      if (dp.first % 2 == 0)
        dp1[dp.first / 2] += mul(dp.second, n / (dp.first / 2) - cnt);
      if (dp.first % 3 == 0)
        dp1[dp.first / 3] += mul(dp.second, n / (dp.first / 3) - cnt);
    }
    for (auto& dp : dp1) dp.second %= mod;
    dp0 = move(dp1);
  }
  cout << dp0[1] << endl;
}
