#include <bits/stdc++.h>
const int maxn = int(1e5) + 7, mod = int(1e9) + 7;
bool not_prime[maxn];
std::map<int, int> cnt[maxn];
std::vector<int> factor[maxn];
long long qpow(long long p, long long q) {
  long long ret = 1;
  while (q) {
    if (q & 1) ret = ret * p % mod;
    p = p * p % mod;
    q >>= 1;
  }
  return ret;
}
void init() {
  for (int i = 2; i < maxn; i++) {
    for (int j = 2; i * j < maxn; j++) factor[i * j].push_back(i);
    if (!not_prime[i]) {
      for (int j = 1; i * j < maxn; j++) {
        int num = i * j;
        not_prime[num] = true;
        cnt[num][i] = j;
      }
    }
  }
}
int f[maxn], m;
int calc(int x, int y) {
  int ret = m / y, a = x / y, b = m / y;
  std::vector<int> buf;
  for (auto &it : cnt[a]) {
    buf.push_back(it.first);
  }
  int len = int(buf.size());
  for (int i = 1; i < 1 << len; i++) {
    int tmp = 1;
    for (int j = 0; j < len; j++) {
      if ((i >> j) & 1) {
        tmp = -tmp * buf[j];
      }
    }
    ret += b / tmp;
  }
  return ret;
}
int main() {
  init();
  std::cin >> m;
  int inv_m = int(qpow(m, mod - 2)), ans = 1;
  for (int i = 2; i <= m; i++) {
    f[i] = 1;
    for (auto &k : factor[i]) {
      f[i] = int((f[i] + 1ll * calc(i, k) * f[k] % mod * inv_m % mod) % mod);
    }
    f[i] =
        int(1ll * f[i] *
            qpow((1 - 1ll * (m / i) * inv_m % mod + mod) % mod, mod - 2) % mod);
    ans = int((ans + 1ll * f[i] * inv_m % mod) % mod);
  }
  std::cout << ans << std::endl;
  return 0;
}
