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