The greatest common divisor of 198 and 300 is 6. So you can write 6 as an integer linear combination of 198 and 300, and clearly any such linear combination is divisible by 6. So you can structure your deposits and withdrawals to extract any multiple of 6. (For example, you can withdraw amounts in multiple of 6 by making 3 deposits followed by 2 withdrawals.) The multiple of 6 closest to 500 is 498, so you can extract that amount.