CF778B Bitwise Formula
Description
Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game.
Initially, Bob chooses integer $ m $ , bit depth of the game, which means that all numbers in the game will consist of $ m $ bits. Then he asks Peter to choose some $ m $ -bit number. After that, Bob computes the values of $ n $ variables. Each variable is assigned either a constant $ m $ -bit number or result of bitwise operation. Operands of the operation may be either variables defined before, or the number, chosen by Peter. After that, Peter's score equals to the sum of all variable values.
Bob wants to know, what number Peter needs to choose to get the minimum possible score, and what number he needs to choose to get the maximum possible score. In both cases, if there are several ways to get the same score, find the minimum number, which he can choose.
Input Format
The first line contains two integers $ n $ and $ m $ , the number of variables and bit depth, respectively ( $ 1
Output Format
In the first line output the minimum number that should be chosen by Peter, to make the sum of all variable values minimum possible, in the second line output the minimum number that should be chosen by Peter, to make the sum of all variable values maximum possible. Both numbers should be printed as $ m $ -bit binary numbers.
Explanation/Hint
In the first sample if Peter chooses a number $ 011_{2} $ , then $ a=101_{2},b=011_{2},c=000_{2} $ , the sum of their values is $ 8 $ . If he chooses the number $ 100_{2} $ , then $ a=101_{2},b=011_{2},c=111_{2} $ , the sum of their values is $ 15 $ .
For the second test, the minimum and maximum sum of variables $ a $ , $ bb $ , $ cx $ , $ d $ and $ e $ is 2, and this sum doesn't depend on the number chosen by Peter, so the minimum Peter can choose is $ 0 $ .