#P1349. 广义斐波那契数列
广义斐波那契数列
Description
A generalized Fibonacci sequence is a sequence of the form .
Given the two coefficients and , the first two terms and , and two integers and , compute the -th term modulo .
Input Format
The input contains one line with six integers: .
Output Format
Output a single integer on one line: the answer.
1 1 1 1 10 7
6
Hint
The -th term is , and .
Constraints
For of the testdata, , .
: Added a new set of hack testdata.
Translated by ChatGPT 5
京公网安备 11011102002149号