Find different sequences of game to find winner Alice  and Bob  are having a racing competition to see who is the best runner. They don't want to decide this in a single race, so they choose a number N which is the minimum number of points one of them should have to be declared the winner. Here are the rules:


*

*Both start with a score of zero.

*No race ends in a tie. Whoever wins, gets a point.

*If one of them gets to a score of $N$ while the other's score is less than or equal to $N-2$, he/she is the winner.

*If both of them reach a score of $N-1$, they continue to race until there is an absolute score difference of $2$, in which case the person having the higher score at the end is declared the winner.


Given N, R (Alice score) and S (Bob score) we need to count the number of different sequences of getting points that can lead to these scores at the end. 
Example : Let $N=25$ , $R=3$ and $S=25$ then answer is $2925$.
How to do this for given N,R and S?
 A: To better keep track of things, and to avoid caps, we let the target total score be $n$, the Alice score be $a$, and the Bob score be $b$.  By symmetry we need only deal with the situations in which Alice ultimately wins. 
For $a=n$, and $b\le n-2$, we need Alice to win the last game, and Bob to win $b$ of the first $n+b-1$ games. The games that Bob wins can be chosen in $\binom{n+b-1}{b}$ ways.
Next we need to deal with the situations in which $a\gt n$. This can only happen with $b=a-2$.  The precondition is that each player has won $n-1$ of the first $2n-2$ games. There are $\binom{2n-2}{n-1}$ ways this can happen. 
To get the answer exactly right, it is useful to focus on a numerical example, such as $n=21$. They have reached a score of $20$-$20$. (i) If Alice wins the next $2$ games, the series is over; (ii) If they split the next $2$ games, and Alice wins the $2$ after that, the series is over; (iii) If they split $2$ games, then split $2$ more, and Alice wins the next $2$, the series is over. And so on. These are the only ways Alice can ultimately win if at some point there is a $20$-$20$ tie. 
So a final score of $22$-$20$, with Alice winning, can be reached in $\binom{40}{20}$ ways. A final score of $23$-$21$, with Alice winning, can be reached in $\binom{40}{20}\cdot 2$ ways. For $24$-$22$ we get $\binom{40}{20}\cdot 2^2$ ways, and so on. 
In general, Alice winning with $a=n+k+1$ (and therefore Bob with $n+k-1$), can be reached in $\binom{2n-2}{n-1}\cdot 2^k$ ways.  For they must tie with each having $n-1$, then $k$ pairs of consecutive games must be split, and Alice must then win $2$ games in a row.  
Summary: For $a=n$ and $b\le n-2$, the number of ways is $\binom{n+b-1}{b}$. For $b=n$ and $a\le n-2$ the number of ways is $\binom{n+a-1}{a}$.
For $a\gt n$ and $b=a-2$, the number of ways is $\binom{2n-2}{n-1}\cdot 2^k$, where $k=a-n-1$.  A similar formula holds for $b\gt n$ and $a=b-2$. 
For all other triples $(a,b,n)$ the number of ways is $0$.   
