#P5999. Kangaroo’s Alternating Route

    ID: 19223 Type: Default 1000ms 256MiB

Kangaroo’s Alternating Route

Kangaroo’s Alternating Route

You are given a garden with (n) grass clumps arranged in a line and numbered from (1) to (n). A kangaroo starts at clump (s) and must visit every clump exactly once, ending at clump (t). In other words, the kangaroo makes exactly (n-1) jumps. To avoid being detected by humans, the direction of each jump (after the first) must be opposite to that of the previous jump. More precisely, suppose the kangaroo arrives at the current clump via a jump from a clump (prev) to a clump (now). Then for the next jump to a clump (next):

[ \text{if } prev < now, \text{ then } next < now; \quad \text{if } prev > now, \text{ then } next > now. ]

Note that the first jump from (s) can be made in any direction. Two routes are considered different if the order in which the clumps are visited is different. Compute the number of valid routes from (s) to (t) modulo (10^9+7).

inputFormat

The input consists of a single line with three integers (n), (s), and (t) ((1 \le s, t \le n)).\par It is guaranteed that there is at least one valid route.

outputFormat

Output a single integer, the number of valid routes modulo (10^9+7).

sample

3 2 1
1