Limits 2s, 512 MB

Neema and Mouri loves to collect coins. When they get bored, they bring out all of their coins. Usually, they count their coins as entertainment. But counting coins are monotonous at times, and soon they loose interest. So, they have decided to play a new game with the coins, a game that would keep them busy for a longer period of time.

In this game, Neema and Mouri place all the coins side by side in a line. Then they start picking coins sequentially from left to right. Both Neema and Mouri takes turn alternatively and Neema goes first. In each turn, one of them pick two or more coins from the left side of the line and remove them. The game ends when there are no coins left. There are situations when they have only 1 coin left after some turns. If this scenario occurs, they call this an invalid game and start off their game again.

Given the number of coins that Neema has and the number of coins that Mouri has, you have to determine the number of ways this game can end in a valid way. Two ways are considered different, if:

  1. Two games differ by the number of moves.
  2. Two games have the same number of moves, but there is at least one move i, in which the number of coins taken in the first game is not equal to the number of coins taken in the second game.


The only line contains two integers NN and MM (1N,M1051 ≤ N , M ≤ 10^5), the total number of coins that Neema and Mouri possesses respectively. Please note that Neema and Mouri's coins are indistinguishable once they are placed in the line.


For each input, print one line, the number of ways the game can be played in a valid way. Since the answer can be large, print the reminder of the answer when divided with 100.


1 1
2 2


Login to submit.


79% Solution Ratio
tasmeemrezaEarliest, Feb '17
ruhanhabib39Fastest, 0.0s
shahed95Lightest, 131 kB
shahed95Shortest, 288B
Toph uses cookies. By continuing you agree to our Cookie Policy.