Problem F
Fibonacci Gjöf
Languages
en
is
Siggi got an array of
Siggi is playing around with his new array and he greatly enjoys applying the two following operations to the array:
-
Siggi chooses a positive integer
and some interval in the array that starts at and ends at , i.e. . He then adds the value to all values in the array in this interval. -
Siggi chooses some interval in the array starting at
and ending at and calculates the sum of all the Fibonacci numbers that these integers denote:
He’s getting a bit tired of doing this by hand and asks you for help. Given the original array that Siggi got as a present and what operations Siggi applies, can you calculate the answer for every operation of the second type that Siggi applies?
Input
The first line of the input contains two integers
The next line contains
-
1
: Siggi applies the first operation using the value on the interval , ( , ). -
2
: Siggi applies the second operation on the interval , ( ).
Output
For each operation of the second type, print a line with the
value of the sum that Siggi calculates. Since this value can
become very large we ask you to print the remainder of that
value after dividing it by
Scoring
Group |
Points |
Constraints |
1 |
22 |
|
2 |
26 |
|
3 |
25 |
|
4 |
27 |
No further constraints |
Sample Input 1 | Sample Output 1 |
---|---|
4 5 1 1 1 1 2 2 3 1 1 2 2 2 2 3 1 2 2 4 2 1 4 |
2 3 17 |
Sample Input 2 | Sample Output 2 |
---|---|
5 6 10 7 3 5 4 2 1 1 2 2 3 2 4 5 1 1 3 20 1 3 5 100 2 1 5 |
55 15 8 403785010 |