#include using namespace std; #define REP(i,a,b) for(i=a;i stB) { if(sb==eb){ if(sa2) b[sb-sa1-1] ^= (a[sb]&(bit[ee]&(bit[64]^bit[se])))<<(64-sa2); b[sb-sa1] ^= (a[sb]&(bit[ee]&(bit[64]^bit[se])))>>sa2; } else { if(sa2) b[sb-sa1-1] ^= (a[sb]&(bit[64]^bit[se]))<<(64-sa2); b[sb-sa1] ^= (a[sb]&(bit[64]^bit[se]))>>sa2; for(i=sb+1;i>sa2; } if(sa2) b[eb-sa1-1] ^= (a[eb]&(bit[ee]))<<(64-sa2); b[eb-sa1] ^= (a[eb]&(bit[ee]))>>sa2; } } else { if(sb==eb){ b[sb-sa1] ^= (a[sb]&(bit[ee]&(bit[64]^bit[se])))>>sa2; if(sa2) b[sb-sa1-1] ^= (a[sb]&(bit[ee]&(bit[64]^bit[se])))<<(64-sa2); } else { b[eb-sa1] ^= (a[eb]&(bit[ee]))>>sa2; if(sa2) b[eb-sa1-1] ^= (a[eb]&(bit[ee]))<<(64-sa2); for(i=eb-1;i>sb;i--){ b[i-sa1] ^= a[i]>>sa2; if(sa2) b[i-sa1-1] ^= a[i]<<(64-sa2); } b[sb-sa1] ^= (a[sb]&(bit[64]^bit[se]))>>sa2; if(sa2) b[sb-sa1-1] ^= (a[sb]&(bit[64]^bit[se]))<<(64-sa2); } } } ll A[2000010], B[2000010]; int arr[2000001]; ull bit[100000]; int N, X, Y, Z, Q; int S, T, U, V, L; char mode[10]; int main(){ int i, j, k; scanf("%d%d%d%d%d",&N,&S,&X,&Y,&Z); assert(1 <= N && N <= 2000000); assert(0 <= S && S <= 1000000000); assert(0 <= X && X <= 1000000000); assert(0 <= Y && Y <= 1000000000); assert(1 <= Z && Z <= 1000000000); A[0] = S; REP(i,1,N) A[i] = (A[i-1] * X + Y) % Z; rep(i,N) if(A[i]%2) bit[i/64] |= (1ULL << (i%64)); rep(i,N) arr[i] = A[i]%2; // rep(i,N) printf("%lld ", A[i]); puts(""); scanf("%d",&Q); assert(0 <= Q && Q <= 200000); while(Q--){ scanf("%d%d%d%d",&S,&T,&U,&V); assert(1 <= S && S <= T && T <= N); assert(1 <= U && U <= V && V <= N); assert(T-S == V-U && T-S <= 100000); S--; U--; L = T-S; // rep(i,L) B[i] = A[S+i]; // rep(i,L) A[U+i] += B[i]; // rep(i,N) printf("%lld,", A[i]); puts(""); if(S >= U){ rep(i,L) arr[U+i] ^= arr[S+i]; } else { rep(i,L) arr[U+L-1-i] ^= arr[S+L-1-i]; } // bitXOR(bit, bit, S, U, L); } /* rep(i,N){ if(bit[i/64]&(1ULL<<(i%64))){ putchar('O'); // assert(arr[i]); } else { putchar('E'); // assert(!arr[i]); } } puts(""); */ rep(i,N){ if(arr[i]){ putchar('O'); } else { putchar('E'); } } puts(""); { int d; assert(scanf("%d",&d)!=1); } return 0; }