题目描述
In the year 4242, the language Haskell has evolved so much that it has become an AI. It can solve very challenging problems, in very little time. Humanity is worried that Haskell will take over the world. All hopes remain tied to the Competitive Programming community as they are the expert in shaving milliseconds off code runtime. Haskell creators have found one particular task that if solved faster than Haskell itself, can be used to hack into Haskell's codebase and thus defeat it. The exact details of the task are as follows,
" Calculate the sum, S(N, K) = , for Q queries. Here Fi is ith Fibonacci number defined as: Fi = i if i = 0 or 1 and Fi = Fi-1 + Fi-2 if i >= 2. "
You being a member of the Competitive Programming community are encouraged to make a submission to this task.
-----Input-----
The first line contains a single integer Q, the number of queries.
Each of the next Q lines contain two integers each, Ni and Ki.
-----Output-----
Output Q lines with one integer each. The ith line should contain the value S(Ni, Ki).
-----Constraints-----
- 1 <= Q <= 5*104
- 1 <= N <= 1018
- 1 <= K <= 1018
-----Example-----
Input:
1
1 1
Output:
1
输入格式
见题面
输出格式
见题面