P27548 [洛谷] A Path into Prosperity
省选
题目描述

Background

With the arrival of the Dragon Year, Fan Ju also enjoys the Joint Nine Provinces Examination. To excel in the final question, Fan Ju revisits number theory with great enthusiasm.

Number theory leads to prosperous lands!

Problem Description

Fan Ju finds calculating $x^a$ modulo $p$ too simple, so he wants to compute $\sigma_0^s(x^t)$ modulo $p$.

Fan Ju is not satisfied with just one calculation, so he creates an $n \times n$ matrix $A$, ensuring that the element $a_{i,j}$ in the $i$-th row and $j$-th column ($1 \le i, j \le n$) satisfies:

$$ a_{i,j} = \sum_{d \mid \gcd(i,j)} \mu\left(\frac{\gcd(i,j)}{d}\right) \times (\sigma_0(d^s))^t $$

Fan Ju wants to know what this matrix looks like, but it is too large, so please tell him the result of $\det A$ modulo $10^9+7$.

Notes:

  1. The meanings of various functions in the expression can be found here ($\mu$ represents the Möbius function, $\sigma_0$ represents the divisor count function).
  2. $\det A$ denotes the determinant of matrix $A$.

Input Format

One line containing three integers $n, s, t$.

Output Format

One line containing an integer representing the answer.

Sample Input and Output

Sample Input #1

2 1 2

Sample Output #1

2

Sample Input #2

2 3 4

Sample Output #2

254

Sample Input #3

19 8 10

Sample Output #3

913255725

Sample Input #4

10000000000 1 2

Sample Output #4

880793261

Notes

Sample 1 Explanation

Matrix $A$ is as follows:

$$ \begin{bmatrix} 1 & 1 \\ 1 & 3 \end{bmatrix} $$

The determinant is $1 \times 3 - 1 \times 1 = 2$.

Sample 2 Explanation

Matrix $A$ is as follows:

$$ \begin{bmatrix} 1 & 1 \\ 1 & 255 \end{bmatrix} $$

The determinant is $1 \times 255 - 1 \times 1 = 254$.

Data Range

This problem uses subtask-based testing.

For $100\%$ of the data, it is guaranteed that $1 \le n \le 10^{11}$, $0 \le s, t < 10^9+7$.

Subtask Number $n$ Special Properties Score
Subtask #1 $\le 500$ None $8$
Subtask #2 $\le 10^7$ $s=1, t=2$ $5$
Subtask #3 $\le 10^7$ $s=1$ $10$
Subtask #4 $\le 10^{11}$ $s=1, t=2$ $10$
Subtask #5 $\le 10^{11}$ $s=1$ $10$
Subtask #6 $\le 10^{11}$ $t=1$ $2$
Subtask #7 $\le 10^7$ $t \le 9$ $10$
Subtask #8 $\le 10^{11}$ $t \le 9$ $15$
Subtask #9 $\le 10^7$ None $10$
Subtask #10 $\le 10^{11}$ None $20$

The Special Properties column is empty if there are no special properties. The values of variables not specified in the subtasks are generated within the range $[0, 10^9+7)$.

Time Limit: $2000$ ms;

Space Limit: $512$ MB.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 1 2
样例输出
2