#P2461. [SDOI2008] 递归数列
[SDOI2008] 递归数列
Description
A sequence of natural numbers is defined as follows:
For : .
For : .
Here and are given natural numbers.
Write a program that, given natural numbers , computes .
Input Format
The first line contains a natural number .
The second line contains natural numbers .
The third line contains natural numbers .
The fourth line contains three natural numbers .
Output Format
Output one positive integer on a single line, representing the value of .
2
1 1
1 1
2 10 1000003
142
Hint
For of the testdata, .
For another of the testdata, .
For of the testdata, , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号