題目來源:judgegirl from ntu prof. pangfeng Liu
Task Description
Write a program to simulate a Pachinko. For this problem, we will use a very simple pachinko. There are rows of pins in this pachinko. The -th pin of a row is between the -th and -th pin in the previous row, as shown in the figure below. When a ball drops on a pin, it will go either left or right. This probability varies from pin to pin. After hitting pins, the ball will fall into one of the buckets. After knowing the probability of going left or right for every pin, compute the probability that a ball falls into each bucket.
- The number of rows of pins is less than or equal to .
Input
The first line of the input has the number of rows . The next line has two integers , , that indicate the ratio of the probability that the ball will go left or right. The probability ratio is given from top to bottom, from left to right. , and it is guaranteed that one of .
Output
Please output lines -- each has a fractional number. The -line has the probability of the ball falling into the -th bucket. Each line has a ratio of to indicate the probability. You need to simplify the ratio; you should output instead of .
Sample input
2
1 2
2 3
3 1
Sample output
2/15
7/10
1/6
Hint
In order to prevent arithmetic overflow, you should reduce the denominator and numerator of each fractional number you use.