#P5325. 【模板】Min_25 筛

【模板】Min_25 筛

Background

This is a template problem, with no background.

Problem Description

Define a multiplicative function f(x)f(x), and f(pk)=pk(pk−1)f(p ^ k) = p ^ k(p ^ k - 1) (pp is a prime). Compute

∑i=1nf(i)\sum_{i = 1} ^ n f(i)

modulo 109+710 ^ 9 + 7.

Input Format

One line containing an integer nn.

Output Format

Output one integer, the answer.

10

263

1000000000

710164413

Hint

f(1)=1f(1)=1,f(2)=2f(2)=2,f(3)=6f(3)=6,f(4)=12f(4)=12,f(5)=20f(5)=20;
f(6)=12f(6)=12,f(7)=42f(7)=42,f(8)=56f(8)=56,f(9)=72f(9)=72,f(10)=40f(10)=40。

For 30%30\% of the testdata, it is guaranteed that 1≤n≤1061\le n\le 10^6.

For 100%100\% of the testdata, it is guaranteed that 1≤n≤10101\le n\le 10^{10}。

Translated by ChatGPT 5