Brownian Bears
문제
Dr. Ursula Major is an internationally renowned expert in the study of bears, specifically brown bears, which are known in many parts of North America as grizzly bears. She is most famous for her discovery of an extremely rare brown bear subspecies --- the Brownian bear, whose feeding behavior seems to be guided by an intriguing mixture of regularity and randomness.
At present, Dr. Major is studying a pair of Brownian bears living on a narrow strip of land that is oriented east-west. This territory has evenly spaced locations where the bears can forage for berries, and Dr. Major has labelled these locations from west to east. Every morning, each Brownian bear wakes up in one of the locations and randomly chooses to move either east or west to the neighboring location. What is remarkable is that the probability of moving in either direction is exactly (Dr. Major's working theory is that this is rooted in some kind of quantum mechanical phenomenon in the bears' brains.) If a bear happens to start the day in one of the end locations ( or ), then it will randomly choose between moving to the sole neighboring location or staying where it is. After making its choice, the bear spends the day foraging for berries in the chosen location, and then also sleeps there that night. The next morning, the process begins all over again.
Dr. Major is particularly interested in days when the two bears forage together, i.e., in the same location, so she plans to observe them over a period of time, possibly as long as a month (or until her funding runs out). At the beginning of the first observation day, the two bears wake up in different locations. Can you help Dr. Major determine the probability that the two bears will forage together for at least one day during the course of her experiment?
Note that the two bears can move past each other without foraging together. For example, if the bears start a particular day in locations and , and if the bear in location moves east and the bear in location moves west, then the bears simply pass each other that morning without foraging together.
입력
The input consists of a single line containing four integers, , where is the number of locations, and are the locations where the two bears wake up at the beginning of the first observation day, and is the number of observation days.
출력
Output a line containing the probability that the two bears forage together for at least one day during the observation days. Express this probability as a fraction in lowest terms, where is a non-negative integer and is a positive integer. See the sample outputs for examples.
예제
예제 1
4 1 2 2
3/8
예제 2
6 2 5 2
0/1
예제 3
2 1 2 1
1/2