I have not a penny in my pocket and the only money available to me is $500, deposited in a crazy bank with some very strange rules:

a. There is no interest on money deposited.
b. There are no charges for withdrawal, but one can only draw exactly $300,- no overdraft and no other amounts allowed.
c. There is only one specific amount of money one can deposit - $198 to be exact, happily enough no charges for this .

Using only those operations, what is the biggest amount I can rescue from this bank?

II. Shift a token.

On a ruler, marked from 0 to 147 cm, a token is placed on one of the marked places.
You can move this token any time: either 100cm to the right or 47 cm to the left.
Prove that after 147 permissible moves the token is at its starting point.

The $500 on deposit is 2 more than a multiple of 6, so $498 can be rescued. In fact 498 is 83 * 6, and from the above we see that that is 83 * (2*300 - 3*198), so 83*2 = 166 withdrawals combined with 83*3 = 249 deposits would result in the required net retrieval. However, this is not the minimum, as we see that 33 withdrawals exactly balance 50 deposits, so we can subtract four times each of these without going into negative territory: 166 - 33*4 = 34 withdrawals, and 249 - 50*4 = 49 deposits will also do the trick, leaving $2 in the account, having rescued $498. The order of deposits and withdrawals doesn't matter, so whenever there's over $300 in the account, withdraw that amount; otherwise you have at least $200 in your hand and can therefore make a $198 deposit.

Adding 100 and subtracting 47 are congruent mod 147, so we need consider only adding 100 mod 147. After 147 moves, all possible positions will have been gone through, in fact only once each, since 147 and 47 (or 100) are relatively prime. The only exception is that if you start on 0 you might end up at 147 and vice versa, since these are equivalent positions mod 147, as in:

In fact, this sequence repeated infinitely, lists the possible moves at any given point, given that 0 and 147 are considered interchangeable, and constitutes another proof of the proposition presented. The other numbers are not interchangeable, and so repeat each 147 moves.