#include using namespace std; long long A[100010],tree[400040]; #define mod 1000000007 #define getchar_unlocked() getchar() inline int inp() { register int r=0,c; for(c=getchar_unlocked(); c<=32; c=getchar_unlocked()); if(c=='-') return -inp(); for(; c>32; r=(r<<1)+(r<<3)+c-'0',c=getchar_unlocked()); return r; } long long pr(long long x, long long y) { long long t=x,ans=1; while(y) { if(y&1) { ans*=t; ans%=mod; } t*=t; t%=mod; y/=2; } return ans; } void update(int node, int st, int en, int idx, int val) { if(st == en) { A[idx] = val; tree[node] = val; } else { int mid = (st + en) / 2; if(st <= idx and idx <= mid) { update(2*node, st, mid, idx, val); } else { update(2*node+1, mid+1, en, idx, val); } tree[node] = tree[2*node] + tree[2*node+1]; tree[node]%=mod; } } int query(int node, int st, int en, int l, int r) { if(r < st or en < l) { return 0; } if(l <= st and en <= r) { return tree[node]; } int mid = (st+ en) / 2; int p1 = query(2*node, st, mid, l, r); int p2 = query(2*node+1, mid+1, en, l, r); return (p1 + p2)%mod; } void build(int node, int st, int en) { if(st==en) { tree[node] = A[st]; } else { int mid = (st + en) / 2; build(2*node, st, mid); build(2*node+1, mid+1, en); tree[node] = tree[2*node] + tree[2*node+1]; tree[node]%=mod; } } int main() { int n; n=inp(); long long a,b,x; int y,q; a=inp(); b=inp(); q=inp(); long long num=1,den=1; long long ans,ttt; for(int i=0;i