John and Brus are training for a card game tournament.
John is practicing his shuffling technique.
John is using a deck of n cards, numbered 1 to n from top to bottom.
This initial deck is called the main deck.
There are two additional decks on the table, called the left and right decks.
These two decks are initially empty.
To shuffle the deck, John will repeat the following sequence of actions m times:
 Move one card from the top of the main deck to the top of the left deck, then one card from the top of the main deck to the top of the right deck, then one card from the top of the main deck to the top of the left deck, and so on, until the main deck is empty.
 While the left deck is not empty, move one card from the top of the left deck to the top of the main deck.
 While the right deck is not empty, move one card from the top of the right deck to the top of the main deck.
Return the number of the card at the top of the main deck after the shuffling is complete.
