Problems
ZZ
ZZ
ZZ-function, a shorter name of ZeedZaad-function is defines as followed.
Given 4 integers a, b, c and d your task is to find ZZ(c, d).
Input
First line is a number of test cases t (t ≤ 200).
Each test case is a line containing 4 integers a, b, c and d (0 ≤ a, b ≤ 109
, 1 ≤ c ≤ 100, 1 ≤ c * d ≤ 108
).
Output
For each test case print ZZ(c, d) mod 1000000009.
Input example #1
5 1 1 1 1 1 1 1 4 1 1 2 3 1 1 5 5 24995 8633 1 25158567
Output example #1
1 7 7 155 512203519