Author: | Антон Карабанов | Time limit: | 1 sec | |
Input file: | Standard input | Memory limit: | 512 Mb | |
Output file: | Standard output |
Student Vasily, having returned to his home village for the holidays, celebrates his successfully passed exams on a grand scale. He's walking along a single street, the schematic of which is shown on the picture. The street has a houses (with numbers 1, 3, 5, …, a × 2 − 1) on the left and b houses (with numbers 2, 4, 6, …, b × 2) on the right. There's a huge puddle in the middle of the street, so one can only cross the street at either start or end of it.
Standing next to a house in an altered state of mind Vasily randomly decides where to go next (each of the two possible directions is chosen with the probability 12). If he finds himself next to a tavern (house with the number t), he will immediately walk in and continue to party till morning, but if he is next to his home (house with the number h), he will decide that this is the sign of fate and he is to stop having fun. What is the probability that Vasily reaches his home and stops the celebration if currently he's standing next to the house with number n?
The first line of input contains two natural numbers separated by space: a and b — street description. The second line contains three natural numbers t, h and n separated by space — houses description. The consistency of the input data is guaranteed. It is guaranteed that the numbers t, h and n are distinct.
Output two space-separated natural numbers — the numerator and denominator of the irreducible fraction expressing the probability of the described event.
1 ≤ a, b ≤ 109
1 ≤ t ≤ a × 2 − 1, if t is odd.
2 ≤ t ≤ b × 2, if t is even.
Constrains for t are similar to h and n.
See picture. The street in the sample only has three houses (with number 1, 2 and 3). Houses on the left side have numbers 1 and 3, while on the right side there's only one house with the number 2. In this sample one it's possible to walk from any house to any other house. Vasily can reach either his home or tavern with equal probability 12.
No. | Standard input | Standard output |
---|---|---|
1 |
|
|