#P10886. 【MX-S3-T2】「FeOI Round 1」Journey
【MX-S3-T2】「FeOI Round 1」Journey
Background
Original link: https://oier.team/problems/S3B。
Problem Description
Little W has recently been learning a programming language.
This programming language has a statement as follows:
range(a,b,c)
This statement represents a sequence, and the sequence is:
Here, is the largest non-negative integer such that . For example, range(1,7,2) represents the sequence .
Little W wants to ask you a question: given a sequence of length (indexed starting from ), compute the value of the following expression, and output the answer modulo .
$$\sum_{a=1}^{n}\sum_{b=a+1}^{n+1}\sum_{c=1}^{n}\sum\limits_{i\in \mathrm{range}(a,b,c)} g_i$$Input Format
To speed up input, we use the following input method.
The input consists of one line with five non-negative integers .
Here, is the length of the sequence , are parameters for generating the data, and is the -th term of the sequence .
For the -th term of the sequence (), it satisfies .
Output Format
Output one line with one non-negative integer, which is the required answer in the problem.
2 0 1 1 1
11
9 0 1 0 663
422994
20 1 0 0 998244353
560706529
114514 17723 134 1045 233337
442762986
Hint
Sample Explanation #1
(indexed starting from ).
Let .
When , .
When , .
When , .
When , .
When , .
When , .
The answer is .
Sample Explanation #2
This sample satisfies Special Property A.
Constraints
For of the testdata: , .
| Test Point ID | Special Property | |
|---|---|---|
| AB | ||
| None | ||
| A | ||
| B | ||
| None | ||
| A | ||
| B | ||
| None | ||
| A | ||
| B | ||
| None | ||
| A | ||
| B | ||
| None | ||
| A | ||
| B | ||
| None | ||
Special Property A: it is guaranteed that all are equal.
Special Property B: it is guaranteed that only .
Translated by ChatGPT 5