#include <bits/stdc++.h>
using namespace std;
vector<int> prime;
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
bool pri[N];
int mu[N];
long long qpow(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res = res * a % mod;
    }
    b >>= 1;
    a = a * a % mod;
  }
  return res;
}
void init() {
  memset(pri, true, sizeof(pri));
  mu[1] = 1;
  for (long long i = 2; i < N; i++) {
    if (pri[i]) {
      prime.push_back(i);
      mu[i] = mod - 1;
    }
    for (long long j = 0; j < (int)prime.size() && i * prime[j] < N; j++) {
      pri[i * prime[j]] = false;
      if (i % prime[j])
        mu[i * prime[j]] = mod - mu[i];
      else {
        mu[i * prime[j]] = 0;
        break;
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int m;
  cin >> m;
  init();
  int ans = 1;
  for (int i = (2); i < (m + 1); i++) {
    int x = m / i;
    ans = (ans - ((long long)mu[i] * x % mod * qpow(m - x, mod - 2) % mod) +
           mod) %
          mod;
  }
  cout << ans << "\n";
  return 0;
}
