#include <bits/stdc++.h>
using namespace std;
const int N = 1002020, mod = 1e9 + 7;
int m, tot, ans = 1, mu[N], iv[N], pr[N];
bool vis[N];
void prework(int mx) {
  iv[1] = mu[1] = 1;
  for (int i = 2; i <= mx; i++) {
    iv[i] = 1ll * iv[mod % i] * (mod - mod / i) % mod;
    if (!vis[i]) pr[++tot] = i, mu[i] = -1;
    for (int j = 1; j <= tot && i * pr[j] <= mx; j++) {
      vis[i * pr[j]] = 1;
      if (!(i % pr[j])) break;
      mu[i * pr[j]] = -mu[i];
    }
  }
}
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int main() {
  m = read();
  prework(m);
  for (int i = 2; i <= m; i++)
    ans = (ans - 1ll * mu[i] * (m / i) * iv[m - m / i] % mod) % mod;
  cout << (ans + mod) % mod << endl;
  return 0;
}
