#include using namespace std; using ll = long long; int main(){ unsigned long long n, s, x, y, z, b64 = 63; cin >> n >> s >> x >> y >> z; vector a(n); array v{}, temp{}; a[0] = s; for(int i = 1; i < n; i++){ a[i] = (x * a[i - 1] + y) % z; } int sz = (n + 63) / 64, q, S, T, U, V; for(int i = 0, j = 0, k = 0; i < n; i++){ v[k] |= (a[i] & 1ULL) << j; if(++j == 64) j = 0, k++; } /*for(int i = 0; i < sz; i++){ cerr << bitset<64>(v[i]) << ' '; } cerr << '\n';*/ cin >> q; while(q--){ cin >> S >> T >> U >> V; S--, U--; int len = T - S, r = ((len + 63) / 64), smod = S & b64, umod = U & b64; temp[len / 64] = 0; cerr << smod << ' '; for(int i = 0; i < len / 64; i++){ temp[i] = v[S / 64 + i] >> smod; if(smod)temp[i] |= v[S / 64 + i + 1] << 64 - smod; } for(int i = 0, idx = S + len / 64 * 64; i < (len & b64); i++, idx++){ if((v[idx / 64] >> (idx & b64)) & 1)temp[len / 64] |= 1ULL << i; } //cerr << bitset<64>(temp[0]) << '\n'; for(int i = 0; i < r; i++){ v[U / 64 + i] ^= temp[i] << umod; if(umod) v[U / 64 + i + 1] ^= temp[i] >> 64 - umod; } /*for(int i = 0; i < sz; i++){ cerr << bitset<64>(v[i]) << ' '; } cerr << '\n';*/ } for(int i = 0, j = 0, k = 0; i < n; i++){ cout << (v[k] >> j & 1 ? 'O' : 'E'); if(++j == 64)j = 0, k++; } cout << '\n'; }