CF1182E Product Oriented Recurrence

题目描述

当 $x \geq 4$ 时,$f_x = c^{2x - 6} \cdot f_{x - 1} \cdot f_{x - 2} \cdot f_{x - 3}$ 。 现在已知 $n,f_1,f_2,f_3,c$ 的值,求 $f_n$ 的值,对 $10^9 + 7$ 取模。 $(4 \leq n \leq 10^{18},1 \leq f_1,f_2,f_3,c \leq 10^9)$

输入格式

输出格式

说明/提示

In the first example, $ f_{4} = 90 $ , $ f_{5} = 72900 $ . In the second example, $ f_{17} \approx 2.28 \times 10^{29587} $ .