#P2104. 二进制

二进制

Description

Xiao Z recently learned about binary numbers. He thinks very small binary numbers are boring, so he wants to perform the following 44 basic operations on a huge binary number:

Operation 11: Add 11 to the entire binary number.

Operation 22: Subtract 11 from the entire binary number.

Operation 33: Multiply the entire binary number by 22.

Operation 44: Integer divide the entire binary number by 22.

Xiao Z really wants to know the result after the operations, so he asks you for help.

(P.S.: To simplify the problem, the testdata guarantees that the + and - operations will not cause a carry-out or a borrow at the most significant bit.)

Input Format

The first line contains two positive integers n,mn, m, representing the length of the original binary number and the number of operations.

The second line contains nn characters, each being 0 or 1, representing this binary number.

The third line contains mm characters, each being one of +, -, *, /, corresponding to operations 1,2,3,41, 2, 3, 4.

Output Format

Output one line with some characters, representing the binary number after performing the operations.

4 10
1101
*/-*-*-/*/
10110

Hint

Constraints:

For 30%30\% of the testdata, 1n,m10001 \leq n, m \leq 1000.

For 60%60\% of the testdata, 1n,m1051 \leq n, m \leq 10^5.

For 100%100\% of the testdata, 1n,m5×1061 \leq n, m \leq 5 \times 10^6.

Translated by ChatGPT 5