#include<bits/stdc++.h> #define MX 2500000 #define P 1000000007 usingnamespace std; typedeflonglong lnt; template <classT> inlinevoidread(T &x){ x = 0; int c = getchar(), f = 1; for (; !isdigit(c); c = getchar()) if (c == 45) f = -1; for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0'); } lnt mu[MX+5]; map <lnt, lnt> ex; bool NotPri[MX+5]; int pri[MX+5], cnt; voidinit(){ mu[1] = 1; for (int i = 2; i <= MX; i++) { if (!NotPri[i]) pri[cnt++] = i, mu[i] = -1; for (int j = 0; j < cnt; j++) { if (i*pri[j] > MX) break; NotPri[i*pri[j]] = true; if (i%pri[j]) mu[i*pri[j]] = -mu[i]; else {mu[i*pri[j]] = 0; break;} } mu[i] = (mu[i]+mu[i-1])%P; } } lnt sum(lnt n){ if (n <= MX) return mu[n]; if (ex[n]) return ex[n]; lnt ret = 1; for (lnt l = 2, r; l <= n; l = r+1) r = n/(n/l), ret = (ret-(r-l+1)*sum(n/l)%P)%P; return ex[n] = ret; } lnt calc(lnt n){ lnt ret = 0; for (lnt l = 1, r; l <= n; l = r+1) r = n/(n/l), ret = (ret+(r-l+1)*(n/l)%P)%P; return ret*ret%P; } intmain(){ lnt n, ans = 0; read(n), init(); for (lnt l = 1, r; l <= n; l = r+1) r = n/(n/l), ans = (ans+(sum(r)-sum(l-1))%P*calc(n/l)%P)%P; returnprintf("%lld\n", (ans+P)%P), 0; }