Problem F
Hackenbush Simplicity
Languages
en
is
When calculating the values of Hackenbush positions a
particular operation comes up quite a lot. It takes two dyadic
fractions
All fractions in this problem are given in the format
x/2q where
Input
The input is two lines, each containing a fraction in the
format described above. These fractions are the values
Output
Print the output of applying the operation to
Sample Input 1 | Sample Output 1 |
---|---|
3/2^2 7/2^3 |
13/2^4 |
Sample Input 2 | Sample Output 2 |
---|---|
-1/2^2 1/2^9 |
0 |
Sample Input 3 | Sample Output 3 |
---|---|
9/2^2 19/2^2 |
3 |
Sample Input 4 | Sample Output 4 |
---|---|
1 2 |
3/2^1 |