Problem F: Fibonacii

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $0$ 正确数量 $0$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签

Fibonacii-like sequence is a sequence which has certain style like that:





The S(N) is defined as


The input includes several cases. For each case, there are 3 lines.
The first line contains 2 integers N and M (1<=N<=10^8, 1<=M<=10)
The second line contains m integers, represent F(0), F(1), F(2)…F(M-1) (-10000<F(i)<10000).
The third line contains m integers, represent    (-10000< <10000)
For each case, output S(N) mod 10007
14 2
0 1
1 1
986
Matrix