PivotOJ

Brownian Bears

시간 제한: 4000ms메모리 제한: 2048MB출처: ICPC ECNA 2024-2025BOJ 32808

문제

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 nn evenly spaced locations where the bears can forage for berries, and Dr. Major has labelled these locations 1,2,,n1, 2, \ldots, n from west to east. Every morning, each Brownian bear wakes up in one of the nn 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 50%!50\%! (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 (11 or nn), 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 44 and 55, and if the bear in location 44 moves east and the bear in location 55 moves west, then the bears simply pass each other that morning without foraging together.

입력

The input consists of a single line containing four integers, nn xx yy dd, where nn (2n100)(2 \leq n \leq 100) is the number of locations, xx and yy (1x,yn,xy)(1 \leq x, y \leq n, x \neq y) are the locations where the two bears wake up at the beginning of the first observation day, and dd (1d31)(1 \leq d \leq 31) 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 dd observation days. Express this probability as a fraction a/ba/b in lowest terms, where aa is a non-negative integer and bb 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
코드를 제출하려면 로그인하세요.