#include #include #include #include #include using namespace std; template void show(T &a, string sep = " ") { for (auto it = a.begin(); it != a.end(); it++) { cout << *it << sep; } cout << endl; } int main() { long long n, s, x, y, z, q; cin >> n >> s >> x >> y >> z; vector a(n, 0); a[0] = s; for (int i = 0; i < n; i++) { a[i + 1] = (x * a[i] + y) % z; } // show(a); cin >> q; long long ss, tt, uu, vv; for (int i = 0; i < q; i++) { cin >> ss >> tt >> uu >> vv; vector b(a.begin() + ss - 1, a.begin() + tt); // show(b); // printf("%d %lld %d\n", b.size(), vv - uu, b[0]); for (int j = uu - 1; j <= vv - 1; j++) { a[j] += b[j - uu + 1]; } // show(a); } for (int i = 0; i < n; i++) { cout << (a[i] % 2 ? "O" : "E"); } cout << endl; return 0; }