ZZ
Time limit15sMemory limit64 MB
Starting from Fibonacci-like values a and b, repeat prefix sums c times and output the d-th value modulo 1000000009.
- Level
Hard8 of 10
- Topics
- Combinatorics, Number theory, Dynamic programming
- Solved
- No attempts yet
Problem
The function is defined as follows.
Given four integers , , , , write a program that computes .
Input
The first line contains the number of test cases . ()
Each of the next lines holds one test case as four integers , , , . (, , )
Output
For each test case, print modulo on its own line.