#include #include #include #define N_MAX 2000000 using namespace std; int main() { int N, S, X, Y, Z, Q, T, U, V, *A, *B; cin >> N >> S >> X >> Y >> Z >> Q; A = new int[N]; B = new int[N]; A[0] = S; for (int i = 1; i < N; ++i) A[i] = (X*A[i - 1] + Y) % Z; for (int i = 0; i < Q; ++i) { cin >> S >> T >> U >> V; memcpy(B+S-1, A+S-1, sizeof(int)*(T-S)); for (int k = U - 1; k < V; ++k) { A[k] += B[k - U + S]; } } for (int i = 0; i < N; ++i) { if (A[i] & 1) cout << 'O'; else cout << 'E'; } return 0; }