For any positive integer sequence a1,a2,,ama_1,a_2,cdots,a_ma1,a2,,am, define its weight f=∑i>1gcdwf=sum_{i>1} gcdcdot wf=∑i>1gcdw, Here w=px3+qx2+rxw=px^3+qx^2+rxw=px3+qx2+rx. p,q,r,mp,q,r,mp,q,r,m are given constants, Calculate the sum of the weight of all such sequences whose sum is nnn, The answer might be very huge, print it module 109+710^9+7109+7.
For any positive integer sequence a1,a2,⋯ ,ama_1,a_2,cdots,a_ma1,a2,⋯,am, define its weight f(a)=∑i>1gcd(ai,ai−1)⋅w(ai)f(a)=sum_{i>1} gcd(a_i,a_{i-1})cdot w(a_i)f(a)=∑i>1gcd(ai,ai−1)⋅w(ai)。 Here w(x)=px3+qx2+rxw(x)=px^3+qx^2+rxw(x)=px3+qx2+rx. p,q,r,mp,q,r,mp,q,r,m are given constants。 Calculate the sum of the weight of all such sequences whose sum is nnn。 The answer might be very huge, print it module 109+710^9+7109+7.
![HBC237448[HEOI2012]采花,数据结构,线段树,树状数组gcds题解
-第1张图片-东莞河马信息技术 HBC237448[HEOI2012]采花,数据结构,线段树,树状数组gcds题解
-第1张图片-东莞河马信息技术](https://www.xxstcz.com/zb_users/upload/2023/11/20231124115102170079786269844.jpeg)
(图片来源网络,侵删)