#include #include #define MOD 1000000007 using namespace std; int main() { long long N; cin >> N; long long count = 0; for (long long B = 2; B * B <= N; B++){ long long A = N; while (A > 0){ count += A % B; count %= MOD; A = (A - (A % B)) / B; } } for (long long B_ = 1; B_ * B_ < N; B_++){ long long Left, Right; Right = N / B_; Left = N / (B_ + 1) + 1; if (Left <= B_) Left = B_ + 1; if (Left > Right) continue; long long count_; if ((Right - Left) % 2 == 0){ count_ = ((N % Left) + (N % Right)) / 2; count_ %= MOD; count_ *= Right - Left + 1; } else { count_ = (Right - Left + 1) / 2; count_ %= MOD; count_ *= (N % Left) + (N % Right); } count += count_; count %= MOD; count_ = Right - Left + 1; count %= MOD; count_ *= B_; count %= MOD; count += count_; } cout << count << endl; }