题目描述
Xinlv wrote some sequences on the paper a long time ago, they might be arithmetic or geometric sequences. The numbers are not very clear now, and only the first three numbers of each sequence are recognizable. Xinlv wants to know some numbers in these sequences, and he needs your help.
输入要求
The first line contains an integer N, indicting that there are N sequences. Each of the following N lines contain four integers. The first three indicating the first three numbers of the sequence, and the last one is K, indicating that we want to know the Kth numbers of the sequence.
You can assume 0 < K <= 10^9, and the other three numbers are in the range [0, 2^63). All the numbers of the sequences are integers. And the sequences are nondecreasing.
输出要求
Output one line for each test case, that is, the Kth number module (%) 200907.
假如输入
2 1 2 3 5 1 2 4 5
应当输出
5 16
题目大意很简单，就是给你一个序列的前三项，该序列不是等差就是等比，让你求第K项余200907，求等比时用到快速求幂，不用的话应该会TLE，下面介绍快速求幂：
快速求幂实现代码为



