This is an interactive problem.
Agent 008 is playing roulette at a casino. In each round, he bets on a color (red or black). In case of a loss, the casino takes the bet, and in case of a win, the bet is returned doubled. It is known that the agent never loses more than three times in a row.
Before going to the casino, the agent received 200 pounds at the cashier. Additionally, he found a crumpled tenner in his pocket, so he ended up with an initial amount of 210 pounds. Help him increase this amount to 1000 pounds (or more) by playing no more than 100 times.
Your program should repeatedly do the following.
Output a positive integer — the amount of the bet (this amount must be available), then a space and the letter R or B (R — red, B — black) followed by a newline. Immediately after outputting, flush the buffer to the standard output (see the note).
After that, input a single integer — the result of the round. This number will be 0, 1, or -1, where 0 — loss, 1 — win, -1 — error (invalid bet or color). If the result is -1, terminate the program. Also terminate the program if the current amount becomes greater than or equal to 1000. Otherwise, continue playing.
Example input-output:
output:
1 R
input:
0
output:
2 B
input:
1
...(and so on)
It is not guaranteed that the casino plays fairly, meaning the color may not come up randomly. However, it is guaranteed that after three consecutive losses, there will definitely be a win.
Flushing the output buffer to the output stream in different languages is done as follows: