F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Fibonacci Sum

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 4795    Accepted Submission(s): 1135


Problem Description
The Fibonacci numbers are defined as below:

Given three integers N, C and K, calculate the following summation:

Since the answer can be huge, output it modulo 1000000009 ($10^9$+9).
 

Input
The first line contains an integer T (1≤T≤200), denoting the number of test cases. Each test case contains three space separated integers in the order: N, C, K (1≤N,C≤$10^{18}$,1≤K≤$10^5$).
 

Output
For each test case, output a single line containing the answer.
 

Sample Input
2 5 1 1 2 1 2
 

Sample Output
12 2
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-06-26 13:03:45, Gzip enabled