The main (potentially tragic) hero of this task is Kile, otherwise known as the joker from the bench of the semiliterate team El Locos, and who is celebrating his birthday today.
His best friend Ivan has decided to gift him a special pharmaceutical scale. The specialty of this scale is that it is recursive, i.e., at the end of each beam, there is either a weight, a new scale, or nothing. Of course, the scale leans to the left if the total mass on its left beam is larger than the total mass on its right beam. Analogously, if the mass is larger on the right beam, then the scale leans to the right. Otherwise, we say that the scale is balanced.
Kile really likes the gift, and, as a true computer scientist, he immediately tries to balance it using new weights for which total mass is the lowest possible. New weights should be positive real numbers. We say that a recursive scale is balanced if it is balanced and all its subscales are balanced.
After having successfully balanced the scale, Kile decided to tattoo on his chest the total mass of the weights placed on the scale, in binary notation, without leading zeros. What number is tattooed on Kile's chest?
Input Specification
The first line of input contains the positive integer
The
All numbers from the input are in absolute value less than or equal to
Output Specification
The first and only line of output must contain the total mass of the weights located on Kile's scale. This number needs to be in binary notation, without leading zeros.
Sample Input 1
2
2 -10
-4 -3
Sample Output 1
10100
Explanation for Sample Output 1
The example corresponds to the image from the task. Kile will add another weight of mass 10100
in binary notation.
Sample Input 2
4
2 3
-9 4
-2 -13
-1 -7
Sample Output 2
111000
Comments