|
||||||||||
SequenceTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 3968 Accepted Submission(s): 1431 Problem Description Let us define a sequence as below $$\left\{\begin{eqnarray*} F_1 &=& A \\ F_2 &=& B \\ F_n &=& C\cdot{}F_{n-2}+D\cdot{}F_{n-1}+\left\lfloor\frac{P}{n}\right\rfloor \end{eqnarray*}\right.$$ Your job is simple, for each task, you should output $F_n$ module $10^9+7$. Input The first line has only one integer $T$, indicates the number of tasks. Then, for the next $T$ lines, each line consists of $6$ integers, $A$ , $B$, $C$, $D$, $P$, $n$. $1 \leq T \leq 20 \\ 0 \leq A, B, C, D \leq 10^9 \\ 1 \leq P, n \leq 10^9$ Sample Input
Sample Output
Source | ||||||||||
|