#P10988. [2015杭电多校]Hack it!

[2015杭电多校]Hack it!

Hack it!

Problem Description

Let f(s)f(s) be a hash function of string ss. If s=s0s1sn1s=s_0s_1\dots s_{n-1},f(s)=(i=0n1w(si)basei)modrf(s)=(\sum_{i=0}^{n-1} w(s_i)base^i) \bmod r. Teacher Mai wants to find two different regular bracket sequences a,ba,b with the same length(104)(\leq 10^4) and the same hash value(f(a)=f(b))(f(a)=f(b)), where w("(")=pp,w(")")=qq. Let us define a regular brackets sequence in the following way: Empty sequence is a regular sequence. If SS is a regular sequence, then (S)(S) is regular sequences. If AA and BB are regular sequences, then ABAB is a regular sequence.

Input

There are multiple test cases. All the test cases are generated randomly. For each test case, there is one line contains four numbers p,q,r,base(1p,q,r,base1018)p,q,r,base(1\leq p,q,r,base\leq 10^{18})

Output

For each test case, print two different regular bracket sequences a,ba,b with the same length(104)(\leq 10^4) and the same hash value(f(a)=f(b))(f(a)=f(b))

Sample Input

4 7 37 10

Sample Output

((()))
()()()

Author

xudyh

Source

2015 Multi-University Training Contest 9