说明
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) .
样例
样例
提示
|In the first example, f4=90 , f5=72900 . | In the second example, f17≈2.28×1029587 . |