#include <bits/stdc++.h>
using namespace std;
const double pi = 2 * acos(0.0);
const int maxn = 1e5 + 30;
const int inf = 2e9;
const int maxm = 1e7 + 10;
const int mod = 1e9 + 7;
const int MZ = 333;
bool not_prime[maxn];
vector<int> fac[maxn];
vector<int> primefac[maxn];
long long dp[maxn];
long long qpow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
    b /= 2;
  }
  return ans;
}
void init() {
  for (int i = 2; i < maxn; i++) {
    for (int j = i; j < maxn; j += i) fac[j].push_back(i);
    if (!not_prime[i]) {
      for (int j = i; j < maxn; j += i) {
        primefac[j].push_back(i);
        not_prime[j] = true;
      }
    }
  }
}
long long cal(int a, int b) {
  vector<int> vec;
  for (int i = 0; i < primefac[a].size(); i++) vec.push_back(primefac[a][i]);
  long long ans = b;
  int len = vec.size();
  for (int i = 1; i < (1 << len); i++) {
    int tmp = 1;
    for (int j = 0; j < vec.size(); j++) {
      if ((i >> j) & 1) {
        tmp *= -vec[j];
      }
    }
    ans += b / tmp;
  }
  return ans;
}
int main() {
  init();
  int m;
  cin >> m;
  long long invm = qpow(m, mod - 2);
  dp[1] = 0;
  long long ans = 1;
  for (int i = 2; i <= m; i++) {
    long long tmp = 0;
    for (int j = 0; j < fac[i].size() - 1; j++) {
      tmp =
          (tmp + cal(i / fac[i][j], m / fac[i][j]) * dp[fac[i][j]] % mod) % mod;
    }
    tmp += m;
    tmp %= mod;
    long long res = qpow(m - m / i, mod - 2);
    dp[i] = tmp * res % mod;
    ans = (ans + dp[i] * invm % mod) % mod;
  }
  printf("%lld\n", ans);
  return 0;
}
