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

FIB Query

Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1027    Accepted Submission(s): 471


Problem Description
We all know the definition of Fibonacci series: fib[i]=fib[i-1]+fib[i-2],fib[1]=1,fib[2]=1.And we define another series P associated with the Fibonacci series: P[i]=fib[4*i-1].Now we will give several queries about P:give two integers L,R, and calculate ¡ÆP[i](L <= i <= R).
 

Input
There is only one test case.
The first line contains single integer Q ¨C the number of queries. (Q<=10^4)
Each line next will contain two integer L, R. (1<=L<=R<=10^12)
 

Output
For each query output one line.
Due to the final answer would be so large, please output the answer mod 1000000007.
 

Sample Input
2 1 300 2 400
 

Sample Output
838985007 352105429
 

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-04-20 11:52:08, Gzip enabled