A group of friends went for a vacation. One Night, they went to a casino and enjoyed a lot. A person from the group started gambling there and found his game hard to crack as it was very difficult and logical. That game is played with set of n number of cards. Number on cards are mentioned from 1 to n. One side of card is white and other is black colour.
On each chance he can perform any of the following 4 actions:
1) All the cards flip to opposite side, those that are white side are turned towards black side and those that are black are turned towards white side.
2) Flips the side of all the odd numbered cards.
3) Flips the side of all the even numbered cards.
4) Flips the side of the cards whose number is of the form 3K+1 (with K>=0), i.e., 1, 4, 7...
There is a counter that records total number of chances played. When the game starts, all the cards turn towards white side and counter is set to zero.
He needs to determine the final combinations of all the N cards that are consistent with the given information without any repetition of the card combinations.
Input Format
You will be given a function with four arguments. Argument 1: is the integer value which is total number of cards available.
Argument 2: is the integer value which is total number of chances.
Argument 3: Third input will be the string containing comma separated card numbers which are turned towards white side in the final combination. This string consist 1, if there is no restriction of white side.
Argument 4: Forth input will be the string containing comma separated card numbers, which are turned towards black side in the final combination. This string consist 1, if there is no restriction of black side.
Output Format
It will be a string containing all final combinations separated by #, where all white cards are denoted by 1 and all black cards are denoted by 0 in each combination and Combination of cards should be in numerical ascending order in the output string.
For example, if we have two final combinations '0110110110' and '0101010101' then the correct output will be "0101010101#0110110110" not "0110110110#0101010101".
Constraints
The total number of cards are constrained by 10 <= N <= 100
The total number of chances are constrained by 1 <= C <= 10000
The number of cards you are informed to be on white side (W), in the final combination, is constrained by 0 <= W <= 2 .
The number of cards you are informed to be on black side (B), in the final combination,, is constrained by 0 <= B<= 2 .
There is at least one possible final combination for each input test case.
Sample Test Case 1
Input
10
1
1
7
Output
0000000000#0101010101#0110110110
Explanation
In this case, there are three possible final combinations:

Either all cards are turned towards black side

All the cards 1, 4, 7, 10 are turned towards black side, and cards 2, 3, 5, 6, 8, 9 are turned towards white side

All the cards 1, 3, 5, 7, 9 are turned towards black side, and cards 2, 4, 6, 8, 10 are turned towards white side
Sample Test Case 2
Input
40
3
16
2,25
Output
0011100011100011100011100011100011100011