#include <bits/stdc++.h>
using namespace std;
template <typename T>
using V = vector<T>;
template <typename T>
using VV = V<V<T>>;
template <typename T, typename U>
using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;
template <typename T>
const T &var_min(const T &t) {
  return t;
}
template <typename T>
const T &var_max(const T &t) {
  return t;
}
template <typename Head, typename... Tail>
const Head &var_min(const Head &head, const Tail &...tail) {
  return min(head, var_min(tail...));
}
template <typename Head, typename... Tail>
const Head &var_max(const Head &head, const Tail &...tail) {
  return max(head, var_max(tail...));
}
template <typename T, typename... Tail>
void chmin(T &t, const Tail &...tail) {
  t = var_min(t, tail...);
}
template <typename T, typename... Tail>
void chmax(T &t, const Tail &...tail) {
  t = var_max(t, tail...);
}
void debug_func_preffix(const string &s) {
  if (s.size()) cout << s << " = ";
}
template <typename T>
void debug_func(const T &t, const string &s = "") {
  debug_func_preffix(s);
  cout << t << ((s).size() ? "\n" : "") << flush;
  ;
}
template <typename T, typename U>
void debug_func(const P<T, U> &p, const string &s = "") {
  debug_func_preffix(s);
  cout << "(";
  debug_func(p.first);
  cout << ", ";
  debug_func(p.second);
  cout << ")" << ((s).size() ? "\n" : "") << flush;
  ;
}
template <typename T>
void debug_func(const V<T> &v, const string &s = "") {
  for (ll i = 0; i < v.size(); i++) {
    string t = s + "[" + to_string(i) + "]";
    debug_func(v[i], t);
  }
}
void init_io() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(30);
}
const ll MOD = 1e9 + 7;
ll __pow(ll a, ll b) {
  return b ? (b & 1 ? a : 1) * __pow(a * a % MOD, b / 2) % MOD : 1;
}
int main() {
  ll M;
  cin >> M;
  V<ll> rpow(M + 10, 1);
  for (ll i = 1; i <= M; i++) rpow[i] = __pow(i, MOD - 2);
  V<bool> used(M + 10, false);
  V<ll> coef(M + 10, -1);
  for (ll i = 2; i <= M; i++) {
    if (used[i]) continue;
    for (ll j = 1; i * j <= M; j++) used[i * j] = true;
    for (ll j = 1; i * j <= M; j++) {
      if (j % i == 0)
        coef[i * j] = 0;
      else
        coef[i * j] *= -1;
    }
  }
  ll ans = 1;
  for (ll i = 2; i <= M; i++) {
    ll m = M / i;
    ll val = m * rpow[M - m] % MOD;
    0;
    val = val * coef[i] + MOD;
    val %= MOD;
    0;
    (ans += val) %= MOD;
  }
  cout << ans << '\n';
  return 0;
}
