#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
istream &operator>>(istream &in, pair<T1, T2> &a) {
  in >> a.first >> a.second;
  return in;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &out, pair<T1, T2> a) {
  out << a.first << " " << a.second;
  return out;
}
template <typename T, typename T1>
T maxs(T &a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T mins(T &a, T1 b) {
  if (b < a) a = b;
  return a;
}
const long long N = 1e5 + 5;
vector<long long> p[N], d[N];
const long long MOD = 1000000007;
struct mod_int {
  long long val;
  mod_int(long long v = 0) {
    if (v < 0) v = v % MOD + MOD;
    if (v >= MOD) v %= MOD;
    val = v;
  }
  static long long mod_inv(long long a, long long m = MOD) {
    long long g = m, r = a, first = 0, second = 1;
    while (r != 0) {
      long long q = g / r;
      g %= r;
      swap(g, r);
      first -= q * second;
      swap(first, second);
    }
    return first < 0 ? first + m : first;
  }
  explicit operator long long() const { return val; }
  mod_int &operator+=(const mod_int &other) {
    val += other.val;
    if (val >= MOD) val -= MOD;
    return *this;
  }
  mod_int &operator-=(const mod_int &other) {
    val -= other.val;
    if (val < 0) val += MOD;
    return *this;
  }
  static unsigned fast_mod(uint64_t first, unsigned m = MOD) {
    return first % m;
    unsigned x_high = first >> 32, x_low = (unsigned)first;
    unsigned quot, rem;
    asm("divl %4\n" : "=a"(quot), "=d"(rem) : "d"(x_high), "a"(x_low), "r"(m));
    return rem;
  }
  mod_int &operator*=(const mod_int &other) {
    val = fast_mod((uint64_t)val * other.val);
    return *this;
  }
  mod_int &operator/=(const mod_int &other) { return *this *= other.inv(); }
  friend mod_int operator+(const mod_int &a, const mod_int &b) {
    return mod_int(a) += b;
  }
  friend mod_int operator-(const mod_int &a, const mod_int &b) {
    return mod_int(a) -= b;
  }
  friend mod_int operator*(const mod_int &a, const mod_int &b) {
    return mod_int(a) *= b;
  }
  friend mod_int operator/(const mod_int &a, const mod_int &b) {
    return mod_int(a) /= b;
  }
  mod_int &operator++() {
    val = val == MOD - 1 ? 0 : val + 1;
    return *this;
  }
  mod_int &operator--() {
    val = val == 0 ? MOD - 1 : val - 1;
    return *this;
  }
  mod_int operator++(int32_t) {
    mod_int before = *this;
    ++*this;
    return before;
  }
  mod_int operator--(int32_t) {
    mod_int before = *this;
    --*this;
    return before;
  }
  mod_int operator-() const { return val == 0 ? 0 : MOD - val; }
  bool operator==(const mod_int &other) const { return val == other.val; }
  bool operator!=(const mod_int &other) const { return val != other.val; }
  mod_int inv() const { return mod_inv(val); }
  mod_int pow(long long p) const {
    assert(p >= 0);
    mod_int a = *this, result = 1;
    while (p > 0) {
      if (p & 1) result *= a;
      a *= a;
      p >>= 1;
    }
    return result;
  }
  friend ostream &operator<<(ostream &stream, const mod_int &m) {
    return stream << m.val;
  }
  friend istream &operator>>(istream &stream, mod_int &m) {
    return stream >> m.val;
  }
};
mod_int dp[N];
long long pie(vector<long long> p, long long m) {
  long long ans = 0;
  long long n = p.size();
  for (long long i = 1; i < (1L << n); i++) {
    long long cnt = 0;
    long long a = 1;
    for (long long j = 0; j < n; j++) {
      long long k = 1 << j;
      if (i & k) a = a * p[j], cnt++;
    }
    if (cnt & 1)
      ans += m / a;
    else
      ans -= m / a;
  }
  return m - ans;
}
long long solve() {
  for (long long i = 2; i < N; i++) {
    if (p[i].size() == 0) {
      for (long long j = i; j < N; j += i) {
        p[j].push_back(i);
      }
    }
  }
  for (long long i = 1; i < N; i++) {
    for (long long j = i; j < N; j += i) {
      d[j].push_back(i);
    }
  }
  auto func = [&](long long first, long long second) -> long long {
    long long ans = 0;
    long long m = p[first].size();
    for (long long i = 1; i < 1 << m; i++) {
      long long cnt = 0;
      long long a = 1;
      for (long long j = 0; j < m; j++) {
        if ((1 << j) & i) {
          cnt++;
          a *= p[first][j];
        }
      }
      ans += (cnt % 2) ? (second / a) : (-second / a);
    }
    return second - ans;
  };
  dp[1] = 0;
  long long m;
  cin >> m;
  mod_int t = m;
  t = t.inv();
  for (long long i = 2; i <= m; i++) {
    mod_int val = 0;
    for (auto j : d[i]) {
      if (j == i) continue;
      val += (1 + dp[j]) * func(i / j, m / j);
    }
    val += (m / i);
    mod_int first = m - m / i;
    dp[i] = val / first;
  }
  mod_int ans = 0;
  for (long long i = 1; i <= m; i++) {
    ans += (1 + dp[i]) * t;
  }
  cout << ans << "\n";
  return 0;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
