A garden is composed of a row of $N$ cells numbered from $1$ to $N$. Initially, all cells contain plants. A kangaroo arrived in the garden in cell numberedcs. Then he jumps from cell to cell, eating the plants as he goes. He will always finish in cell numberedcf, after visiting each of the $N$ cells exactly once, includingcsandcf. Obviously, the kangaroo will make $N-1$ jumps.
The kangaroo doesn't want to be caught, so after each jump he changes the direction in which he jumps next: if he is currently in cell numberedcurrentafter he jumped there from a cell numberedprev, and will jump fromcurrentto cell numberednext, then:
- if
prev < current, thennext < current;else, - if
current < prev, thencurrent < next.
Knowing the number $N$ of cells in the garden, the starting cellcsfrom where the kangaroo starts to eat plants and the final cellcfwhere the kangaroo finishes, you should calculate the number of distinct routes the kangaroo can take while jumping through the garden.