#P9511. 『STA - R3』大豆

『STA - R3』大豆

Background

Soy (Soybean) has a very promising future.

Problem Description

For a sequence {a}\{a\}, define its Soybeanization sequence {b}\{b\} by the following process:

  1. Initially, {b}\{b\} is the same as {a}\{a\}.
  2. Traverse all positive integers nn in increasing order. For each nn, do:
    • Traverse all integers i2i \ge 2 in increasing order. For each ii, apply bnbnbnib_n\gets b_n-b_{\lfloor\frac ni\rfloor}.
    • If i>ni>n, stop the process.

Furthermore, define the kk-Soybeanization sequence of a sequence as the sequence obtained after applying the Soybeanization operation kk times.

Now you are given an integer sequence {tn}\{t_n\}. Repeat {t}\{t\} infinitely to obtain the sequence {a}\{a\}. Find the mm-th term of the kk-Soybeanization sequence of {a}\{a\}.

Indices start from 1. The answer may be very large; output it modulo 2306867323068673 (a prime).

Input Format

The first line contains three positive integers n,m,kn,m,k.

The second line contains nn positive integers describing the sequence {t}\{t\}.

Output Format

Output one line containing the answer modulo 2306867323068673.

2 3 1
1 2
23068672
3 5 2
2 1 2
23068666
5 1000000000 1
1 5 10 3 2
68769

5 1000000000 3
1 5 10 3 2
5430204

Hint

Sample Explanation

Sample 1 Explanation

Construct the sequence {b}\{b\} as follows:

  • b1=a1=1b_1=a_1=1.
  • b2=a2b22=a2b1=1b_2=a_2-b_{\lfloor\frac 22\rfloor}=a_2-b_1=1.
  • $b_3=a_3-b_{\lfloor\frac 32\rfloor}-b_{\lfloor\frac 33\rfloor}=a_3-b_1-b_1=-1$.

Therefore, the answer is b3=123068672(mod23068673)b_3=-1\equiv 23068672\pmod{23068673}.

Sample 2 Explanation

The first 5 terms after the first Soybeanization: 2,1,2,1,42,\,-1,\,-2,\,-1,\,-4.

The first 5 terms after the second Soybeanization: 2,3,6,2,72,\,-3,\,-6,\,-2,\,-7.

So the answer is 723068666(mod23068673)-7\equiv 23068666\pmod{23068673}.

Constraints

$$\newcommand{\arraystretch}{1.5} \begin{array}{c|c|c|c}\hline\hline \textbf{Subtask} & \bm{m}\le & \textbf{Score} & \textbf{Special Property} \\\hline \textsf{1} & 10^6 & 10 & \\\hline \textsf{2} & 10^9 & 20 & \\\hline \textsf{3} & 10^{10} & 20 & k=1 \\\hline \textsf{4} & 10^{10} & 50 & \\\hline\hline \end{array}$$

For all testdata, 1n1041\le n\le 10^4, 1m10101\le m\le 10^{10}, k{1,2,3}k\in\{1,2,3\}, 0ai1090\le a_i\le 10^9.

Translated by ChatGPT 5