#P1998. DGF 等比求和
DGF 等比求和
Description
Given a number-theoretic function , define as:
$$f^n=\begin{cases}f&n=1\\f^{n-1}* f &n\ge 2\end{cases}.$$Here denotes the Dirichlet convolution.
For positive integers , let the number-theoretic function . Compute , and take the answers modulo .
To control the output size, it is sufficient to output the value of .
Input Format
The first line contains two positive integers .
The second line contains non-negative integers, representing in order.
Output Format
Output one non-negative integer on a single line, representing .
10 10
1 1 4 5 1 4 1 9 1 9
1864
Hint
Constraints: For all testdata, it is guaranteed that , , and for , always .
In particular, , .
For Sample 1, the first terms of are .
The time limit is 4 times that of the "std". Please use fast I/O.
Translated by ChatGPT 5
京公网安备 11011102002149号