#include <bits/stdc++.h>
const int maxn = 200005;
const int M = 2500005;
const long long mod = 1e9 + 7;
int n, num;
std::vector<int> v[maxn];
int f[maxn], mu[maxn], p[maxn >> 1], head[maxn], vis[maxn];
long long a[maxn], g[maxn], dp[maxn];
struct E {
  int v, nxt;
  long long w;
} e[M];
inline void add(int x, int y, long long w) {
  e[++num].v = y;
  e[num].nxt = head[x];
  head[x] = num;
  e[num].w = w;
}
inline long long ksm(long long a, long long b) {
  long long S = 1;
  while (b) {
    if (b & 1) S = S * a % mod;
    b >>= 1;
    a = a * a % mod;
  }
  return S;
}
inline long long dfs(int x) {
  if (vis[x]) return dp[x];
  vis[x] = 1;
  for (register int i = head[x]; i; i = e[i].nxt)
    dp[x] = (dp[x] + e[i].w * (dfs(e[i].v) + 1ll) % mod) % mod;
  if (a[x]) {
    dp[x] = (dp[x] + a[x]) % mod;
    dp[x] = dp[x] * ksm((1 - a[x] + mod) % mod, mod - 2);
    dp[x] %= mod;
  }
  return dp[x];
}
int main() {
  scanf("%d", &n);
  for (register int i = 1; i <= n; i++)
    for (register int j = i; j <= n; j += i) v[j].push_back(i);
  f[1] = mu[1] = 1;
  for (register int i = 2; i <= n; i++) {
    if (!f[i]) p[++p[0]] = i, mu[i] = -1;
    for (register int j = 1; j <= p[0] && p[j] * i <= n; j++) {
      f[p[j] * i] = 1;
      if (i % p[j] == 0) break;
      mu[p[j] * i] = -1 * mu[i];
    }
  }
  long long inv = ksm(n, mod - 2);
  for (register int i = 1; i <= n; i++) {
    for (register int j = 0; j < v[i].size(); j++) {
      int now = 0, x = v[i][j];
      if (v[i][j] == i) continue;
      for (register int k = j; k < v[i].size(); k++) {
        int t = v[i][k];
        if (t % x == 0) now += mu[t / x] * (n / t);
      }
      add(i, x, now * inv % mod);
    }
    a[i] = n / i;
    a[i] = (a[i] * inv) % mod;
  }
  for (register int i = 1; i <= n; i++) add(0, i, inv);
  vis[1] = 0;
  std::cout << dfs(0);
  return 0;
}
