Under construction

Still being built. Things may change

Kangaroo

Time limit2sMemory limit512 MB

Summary
Count the alternating-direction routes by which a kangaroo visits every cell of a row exactly once, starting at cs and ending at cf.
Level

Medium7 of 10

Topics
Dynamic programming, Combinatorics
Solved
No attempts yet

Problem

A garden is one row of NN cells numbered 1 to NN. Every cell holds a plant at the start.

A kangaroo lands on cell csc_s and eats the plant there. After that it jumps from cell to cell, eats the plant in every cell it lands on, visits all NN cells exactly once, and stops on cell cfc_f. The starting cell and the last cell count as visited, so the kangaroo makes exactly N−1N-1 jumps.

To avoid being caught, the kangaroo changes the direction of its next jump after every jump. If it jumped from cell prevprev to cell currentcurrent and then jumps from cell currentcurrent to cell nextnext, both conditions below hold.

  • If prev<currentprev < current, then next<currentnext < current.
  • If current<prevcurrent < prev, then current<nextcurrent < next.

Given the number of cells NN, the starting cell csc_s, and the last cell cfc_f, count the distinct routes the kangaroo can take.

Input

The first line contains the positive integers NN, csc_s, cfc_f, separated by spaces.

  • 2≤N≤20002 \le N \le 2000
  • 1≤cs≤N1 \le c_s \le N
  • 1≤cf≤N1 \le c_f \le N
  • cs≠cfc_s \ne c_f
  • A route is determined by the order in which the cells are visited.
  • Every input has at least one route that follows the rules.
  • The kangaroo may make its first jump from cell csc_s in either direction.

Output

Print the number of distinct routes that follow the rules, modulo 10000000071000000007 (109+710^9 + 7), on one line.

Hint

In the first example the kangaroo starts on cell 2 and stops on cell 3. Two routes follow the rules: 2 → 1 → 4 → 3 and 2 → 4 → 1 → 3.

Examples2

  1. Example 1

    Input
    4 2 3
    
    Expected output
    2
    
  2. Example 2

    Input
    2 1 2
    
    Expected output
    1