3412.Sereja and Intervals

Time Limit: 1s Memory Limit: 256MB

Sereja is interested in intervals of numbers, so he has prepared a problem about intervals for you. An interval of numbers is a pair of integers [l,r] (1 \le l \le r \le m). Interval [l1,r1] belongs to interval [l2,r2] if the following condition is met: l2 \le l1 \le r1 \le r2.

Sereja wants to write out a sequence of n intervals [l1,r1], [l2,r2], ..., [ln,rn] on a piece of paper. At that, no interval in the sequence can belong to some other interval of the sequence. Also, Sereja loves number x very much and he wants some (at least one) interval in the sequence to have li=x. Sereja wonders, how many distinct ways to write such intervals are there?

Help Sereja and find the required number of ways modulo 1000000007 (109+7).

Two ways are considered distinct if there is such j (1 \le j \le n), that the j-th intervals in two corresponding sequences are not equal.

Input Format(From the terminal/stdin)

The first line contains integers n, m, x (1 \le n \cdot m \le 100000,1 \le x \le m) - the number of segments in the sequence, the constraints on the numbers in segments and Sereja's favourite number.

Output Format(To the terminal/stdout)

In a single line print the answer modulo 1000000007 (109+7).

Sample Input 1

Copy
1 1 1
 · · \n

Sample Output 1

Copy
1
 \n

Sample Input 2

Copy
3 5 1
 · · \n

Sample Output 2

Copy
240
   \n

Sample Input 3

Copy
2 3 3
 · · \n

Sample Output 3

Copy
6
 \n

Hints

In third example next sequences will be correct: {[1,1],[3,3]}, {[1,2],[3,3]}, {[2,2],[3,3]}, {[3,3],[1,1]}, {[3,3],[2,2]}, {[3,3],[1,2]}.

Submit

请先 登录

© 2025 FAQs