#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int add(int a, int b) { return a + b - mod * (a + b >= mod); }
int mul(int a, int b) { return int(1ll * a * b % mod); }
int power(int a, int x) {
  if (x == 0) {
    return 1;
  }
  return mul(power(mul(a, a), x / 2), (x % 2 ? a : 1));
}
int sub(int a, int b) { return a - b + mod * (a < b); }
int divide(int a, int b) { return mul(a, power(b, mod - 2)); }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int m;
  cin >> m;
  vector<int> sieve(m + 1);
  for (int i = 2; i <= m; ++i) {
    if (sieve[i]) {
      continue;
    }
    for (int k = i; k <= m; k += i) {
      sieve[k] = i;
    }
  }
  int ans = 1;
  vector<int> kek(m + 1);
  kek[1] = mod - 1;
  for (int i = 2; i <= m; ++i) {
    int p = sieve[i];
    if ((i / p) % p == 0) {
      kek[i] = 0;
    } else {
      kek[i] = sub(0, kek[i / p]);
    }
  }
  for (int i = 2; i <= m; ++i) {
    int t = divide(m / i, m);
    ans = add(ans, mul(kek[i], divide(t, sub(1, t))));
  }
  cout << ans;
  return 0;
}
