CF1182E.Product Oriented Recurrence
提高+/省选-
通过率:0%
时间限制:1.00s
内存限制:256MB
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).
对于 x≥4,定义 fx=c2x−6⋅fx−1⋅fx−2⋅fx−3。
给定整数 n、f1、f2、f3 和 c,求 fnmod(109+7)。
输入格式
The only line contains five integers n, f1, f2, f3, and c (4≤n≤1018, 1≤f1, f2, f3, c≤109).
唯一的一行包含五个整数 n、f1、f2、f3 和 c(其中 4≤n≤1018,1≤f1,f2,f3,c≤109)。
输出格式
Print fnmod(109+7).
输出 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.
在第一个例子中,f4=90,f5=72900。
在第二个例子中,f17≈2.28×1029587。
输入解题思路,AI测评打分。不知道怎么写?