Let's define a function f(p) on a permutation p as follows. Let g_i be the [greatest common divisor (GCD)](https://en.wikipedia.org/wiki/Greatest_common_divisor) of elements p_1, p_2, ..., p_i (in other words, it is the GCD of the prefix of length i). Then f(p) is the number of distinct elements among g_1, g_2, ..., g_n.

Let f_{max}(n) be the maximum value of f(p) among all permutations p of integers 1, 2, ..., n.

Given an integers n, count the number of permutations p of integers 1, 2, ..., n, such that f(p) is equal to f_{max}(n). Since the answer may be large, print the remainder of its division by 1000 000 007 = 10^9 + 7.

Input

The only line contains the integer n (2 ≤ n ≤ 10^6) — the length of the permutations.

Output

The only line should contain your answer modulo 10^9+7.

Examples

Input


2


Output


1

Input


3


Output


4

Input


6


Output


120

Note

Consider the second example: these are the permutations of length 3:

  * [1,2,3], f(p)=1. 
  * [1,3,2], f(p)=1. 
  * [2,1,3], f(p)=2. 
  * [2,3,1], f(p)=2. 
  * [3,1,2], f(p)=2. 
  * [3,2,1], f(p)=2. 



The maximum value f_{max}(3) = 2, and there are 4 permutations p such that f(p)=2.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 10;
const ll inf_ll = 1e18 + 10;
template <ll M>
struct modint {
  static ll reduce(ll n) {
    constexpr static ll b = -1ull / M;
    ll r = n - (ll)(__uint128_t(b) * n >> 64) * M;
    return r >= M ? r - M : r;
  }
  static ll inv(ll n) {
    ll r = 1;
    for (ll k = M - 2; k > 0; k >>= 1, n = reduce(n * n))
      if (k & 1) r = reduce(r * n);
    return r;
  }
  ll v;
  modint(ll n = 0) : v(reduce(n)) { v += (M & 0 - (v < 0)); }
  friend string to_string(const modint n) { return to_string(n.v); }
  friend istream& operator>>(istream& i, modint& n) { return i >> n.v; }
  friend ostream& operator<<(ostream& o, const modint n) { return o << n.v; }
  template <typename T>
  explicit operator T() {
    return T(v);
  }
  friend bool operator==(const modint n, const modint m) { return n.v == m.v; }
  friend bool operator!=(const modint n, const modint m) { return n.v != m.v; }
  friend bool operator<(const modint n, const modint m) { return n.v < m.v; }
  friend bool operator<=(const modint n, const modint m) { return n.v <= m.v; }
  friend bool operator>(const modint n, const modint m) { return n.v > m.v; }
  friend bool operator>=(const modint n, const modint m) { return n.v >= m.v; }
  modint& operator+=(const modint n) {
    v += n.v;
    v -= (M & 0 - (v >= M));
    return *this;
  }
  modint& operator-=(const modint n) {
    v -= n.v;
    v += (M & 0 - (v < 0));
    return *this;
  }
  modint& operator*=(const modint n) {
    v = reduce(v * n.v);
    return *this;
  }
  modint& operator/=(const modint n) {
    v = reduce(v * inv(n.v));
    return *this;
  }
  friend modint operator+(const modint n, const modint m) {
    return modint(n) += m;
  }
  friend modint operator-(const modint n, const modint m) {
    return modint(n) -= m;
  }
  friend modint operator*(const modint n, const modint m) {
    return modint(n) *= m;
  }
  friend modint operator/(const modint n, const modint m) {
    return modint(n) /= m;
  }
  modint& operator++() { return *this += 1; }
  modint& operator--() { return *this -= 1; }
  modint operator++(int) {
    modint t = *this;
    return *this += 1, t;
  }
  modint operator--(int) {
    modint t = *this;
    return *this -= 1, t;
  }
  modint pow(const ll k) const {
    if (k < 1) return k == 0 ? modint(1) : modint(inv(this->v)).pow(-k);
    return k & 1 ? *this * (this->pow(k - 1)) : (*this * *this).pow(k >> 1);
  }
};
using mod = modint<int(1e9 + 7)>;
const int N = 1e6 + 5, K = 30;
mod dp[2][K][2], f[K], g[K][2];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll n, k = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    f[__builtin_ctz(i)]++;
    g[__builtin_ctz(i)][i % 3 == 0 ? 1 : 0]++;
  }
  while (f[k]) k++;
  for (int i = k - 1; i >= 0; i--) {
    f[i] += f[i + 1];
    g[i][0] += g[i + 1][0];
    g[i][1] += g[i + 1][1];
  }
  dp[0][0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[1][j][0] = (f[j] - (n - i)) * dp[0][j][0] +
                    (j == 0 ? 0 : f[j - 1] - f[j]) * dp[0][j - 1][0];
      dp[1][j][1] = (g[j][1] - (n - i)) * dp[0][j][1] +
                    (j == 0 ? 0 : g[j - 1][1] - g[j][1]) * dp[0][j - 1][1] +
                    (g[j][0]) * dp[0][j][0];
    }
    for (int j = 0; j <= k; j++)
      dp[0][j][0] = dp[1][j][0], dp[0][j][1] = dp[1][j][1];
  }
  cout << dp[1][k - 1][1] << "\n";
}
