Mr. Cocktail like a game named Hearthstone. In this game, there is a game mode "Arena" with the four rules as follows.
1.The record of each player is described as
%7D)
, where

means number of wins, and

means number of losses. At the beginning of the game, the record is
%7D)
, that is,

wins and

losses.
2.For each round, the number of wins in winner's record will be added one point. And the defeated one will be added one point in the number of losses in his record. There is no tie in this game.
3.Each round will be start between two persons with same record. That is, when your record is
%7D)
, your opponent's record is also
%7D)
. Obviously, a player with a record of
%7D)
will be produced after each round, and a record of
%7D)
players.
4.When someone win

times or lost

times , he will automatically exit and end his game.
In order for everyone to have an opponent before the end of the game,

players were assigned to participate by Mr. Cocktail.
He will ask

times, and each time he give

,

and want to know how many people were automatically out of the game with a record of
%7D)
. (Guaranteed that
%7D)
meets the exit conditions).
Since the answer may be very large, you only need to output the result after the answer is modulo

.