#include using namespace std; typedef long long ll; #define all(x) (x).begin(),(x).end() const int mod=1000000007,MAX=200005,INF=1<<30; struct C{ double x; double y; C operator + (const C &other)const{ return {x+other.x , y+other.y}; }; C operator - (const C &other)const{ return {x-other.x , y-other.y}; }; C operator * (const C &other)const{ return {x*other.x-y*other.y , x*other.y+y*other.x}; }; }; vector fft(vector &a,bool inverse){//inverse==1のとき逆変換 int n=a.size(); int h=0; for(int i=0;(1<>k)&1)<<(h-1-k); if(i fft(vector &a,bool inverse){//オーバーロード vector a_complex(a.size()); for(int i=0;i convolve(vector &a,vector &b){//解く int s=a.size()+b.size()-1; int t=1; while(t A=fft(a,0),B=fft(b,0); for(int i=0;i>P>>Q; vector A(2000001,0.0),B(2000001,0.0); A[2]=1.0; B[2]=1.0; for(int i=3;i<=2000000;i++){ ll k=(ll(A[i-1])*P+ll(A[i-2]))%mod; A[i]=k; B[i]=k; } vector ans=convolve(A,B); while(Q--){ int a;cin>>a; cout<