atcoder#ARC111F. [ARC111F] Do you like query problems?
[ARC111F] Do you like query problems?
Score : points
Problem Statement
Yosupo loves query problems. He made the following problem:
A Query Problem
We have an integer sequence of length : . Initially, . We also have a variable , which is initially . Here, you will be given queries of the following forms:
- Type 1:
- For each , .
- For each , .
- Type 2:
- For each , .
- For each , .
- Type 3:
- Compute and add the result to .
- Compute and add the result to .
Print the final value of .
Here, for each query, holds. Additionally, for Type 1 and 2, holds.
Maroon saw this problem, thought it was too easy, and came up with the following problem:
Query Problems
Given are positive integers . There are valid inputs for "A Query Problem". Find the sum of outputs over all those inputs, modulo .
Find it.
Constraints
- All numbers in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
1 2 2
1
There are valid inputs, and just one of them - shown below - results in a positive value of .
$t_1 = 2, l_1 = 1, r_1 = 1, v_1 = 1, t_2 = 3, l_2 = 1, r_2 = 1$
will be in this case, so the answer is .
3 1 4
0
111 112 113
451848306