#include #define mod 1000000007 using namespace std; long long C[100005]; long long fast(long long a,long long b) { long long ans = 1; while(b!=0) { if(b%2==1) ans = (ans*a)%mod; a=(a*a)%mod; b/=2; } return ans; } int main() { long long n,a,b,q; scanf("%lld %lld %lld %lld",&n,&a,&b,&q); for(int c=0;c