ll pw(ll a, ll b){ ll r = 1; for( ; b ; b >>= 1, a = a * a % mod) if(b & 1) r = r * a % mod; return r; }
inth(ll n){ return (n * n % mod - 3 * n % mod + 2) % mod; }
intH(ll n){ return ((( n * (n + 1) % mod * (2 * n + 1) % mod * inv6 % mod ) - ( 3 * n % mod * (1 + n) % mod * inv2 % mod )) % mod + ( 2 * n % mod )) % mod; }
map<ll, ll> val; ll F(ll n){ if(n <= N) return f[n]; elseif(val.find(n) != val.end()) return val[n]; else { ll res = H(n); for(ll i = 2, j ; i <= n ; i = j + 1) { j = n / (n / i); res = (res - F(n / i) * (j - i + 1) % mod) % mod; } return val[n] = res; } }