#GYM104786C. John and Olaf
John and Olaf
Description
John and his dog Olaf are in a complicated relationship. Therefore, John is trying to run away from his canine companion, but Olaf, surely enough, won't let him.
The road from their house to the park is a straight line. The line consists of $N$ points labeled from $1$ to $N$. John and Olaf can move from any point to an adjacent one in $1$ minute. Olaf is at point $x$ and John at point $y$.
John, being very tired, is stumbling. Thus, he moves uniformly at random each minute, either to the left or right. In the meantime, Olaf moves to the right one step each minute. Due to some suspicious law of the universe, John can't move to the right of the park, located at the $N$th point. As a result, when he is at the Nth point, John will certainly go to the left during the next minute.
You have to calculate the expected number of minutes after which they will meet. The expected value can be written in the form $\frac{p}{q} $. Please output $p \cdot q^{-1} \pmod{1000000007} $, where $q^{-1}$ is the modular inverse of $q$.
It is guaranteed that $x < y$.
Please note, they do not have to meet at a point, they can meet between points. In that case, we still consider only whole minutes (see the examples).
The first line contains three integers $N$, $x$ and $y$.
$ 1 \le x \lt y \le N \le 2000 $
Print a single line, the expected number of minutes until our characters meet.
Input
The first line contains three integers $N$, $x$ and $y$.
$ 1 \le x \lt y \le N \le 2000 $
Output
Print a single line, the expected number of minutes until our characters meet.
3 1 3
3 2 3
5 2 5
30 10 17
1
1
500000006
858335509
Note
In the first test case, they will always meet in 1 minute because John can only go to the left 1 step and Olaf goes to the right one step.
In the second test case, they meet half-way, the answer is still 1.