CF1182E.Product Oriented Recurrence
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Let fx=c2x−6⋅fx−1⋅fx−2⋅fx−3 for x≥4 .
You have given integers n , f1 , f2 , f3 , and c . Find fnmod(109+7) .
输入格式
The only line contains five integers n , f1 , f2 , f3 , and c ( 4≤n≤1018 , 1≤f1 , f2 , f3 , c≤109 ).
输出格式
Print fnmod(109+7) .
输入输出样例
输入#1
5 1 2 5 3
输出#1
72900
输入#2
17 97 41 37 11
输出#2
317451037
说明/提示
In the first example, f4=90 , f5=72900 .
In the second example, f17≈2.28×1029587 .