#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int pwr[33];
int rev(int x) {
  pwr[0] = x;
  for (int i = 1; i <= 30; ++i) {
    pwr[i] = (pwr[i - 1] * 1ll * pwr[i - 1]) % mod;
  }
  int v = mod - 2;
  int res = 1;
  for (int i = 30; i >= 0; --i) {
    int bit = (v >> i) & 1;
    if (bit) {
      res = (res * 1ll * pwr[i]) % mod;
    }
  }
  return res;
}
const int N = 123456;
int f[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int m;
  cin >> m;
  int ans = 0;
  for (int i = m; i >= 2; --i) {
    int c = m / i;
    f[i] = (c * 1ll * (2 * m - c)) % mod;
    f[i] = (f[i] * 1ll * rev(m * 1ll * (m - c) % mod)) % mod;
    for (int j = i * 2; j <= m; j += i) {
      f[i] = (f[i] + mod - f[j]) % mod;
    }
    ans = (ans + f[i]) % mod;
  }
  ans = (ans + rev(m)) % mod;
  cout << ans << endl;
  return 0;
}
