#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
vector<int> num;
long long dp[N], ret;
int m;
long long qpow(long long x, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
void dfs(int dep, long long n, bool flag, long long m) {
  if (n > m) return;
  if (dep >= num.size()) return;
  if (flag)
    ret += m / n;
  else
    ret -= m / n;
  for (int i = dep + 1; i < num.size(); i++) dfs(i, n * num[i], flag ^ 1, m);
}
long long cal(int n, int x) {
  long long res = m / x;
  long long y = n / x;
  num.clear();
  for (int i = 2; i * i <= y; i++) {
    if (y % i) continue;
    num.push_back(i);
    while (y % i == 0) y /= i;
  }
  if (y > 1) num.push_back(y);
  ret = 0;
  for (int i = 0; i < num.size(); i++) dfs(i, num[i], 0, res);
  return res + ret;
}
int main() {
  scanf("%d", &m);
  long long ans, inv;
  dp[1] = ans = 1;
  inv = qpow(m, mod - 2);
  for (int i = 2; i <= m; i++) {
    dp[i] = 1;
    int x = (long long)m * qpow(m - m / i, mod - 2) % mod;
    for (int j = 2; j * j <= i; j++) {
      if (i % j) continue;
      dp[i] = (dp[i] + cal(i, j) * inv % mod * dp[j] % mod) % mod;
      if (j * j != i)
        dp[i] = (dp[i] + cal(i, i / j) * inv % mod * dp[i / j] % mod) % mod;
    }
    dp[i] = dp[i] * x % mod;
  }
  for (int i = 2; i <= m; i++) ans = (ans + dp[i] * inv % mod) % mod;
  printf("%lld\n", ans);
  return 0;
}
