#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a; BS res[1<<(22-BIT)]; signed main(){ cin.tie(0); ios::sync_with_stdio(0); int n,s,x,y,z; cin>>n>>s>>x>>y>>z; BS all(0); for(int i=0;i>BIT][i&MSK]=a&1; a=(1LL*x*a+y)%z; } int q; cin>>q; for(int i=0;i>a>>b>>c>>d; a--;c--; BS tmp(0); int p=((a>>BIT)+1)<>BIT]>>(a&MSK); tmp|=(res[p>>BIT]&(all>>(MAX-(b-p))))<<(p-a); }else{ tmp|=(res[a>>BIT]>>(a&MSK))&(all>>(MAX-(b-a))); } int q=((c>>BIT)+1)<>BIT]^=tmp<<(c&MSK); res[q>>BIT]^=tmp>>(q-c); } for(int i=0;i>BIT][i&MSK]?'O':'E'); cout<