#P460. 练83.2 汽水瓶
练83.2 汽水瓶
Description
Here's a brain teaser: "A store has a rule: three empty soda bottles can be exchanged for one full bottle of soda. If Xiao Zhang has ten empty bottles, how many bottles of soda can she drink at most?" The answer is bottles, as follows: first exchange empty bottles for full bottles, drink them, leaving empty bottles. Then exchange empty bottles for full bottle, drink it, leaving empty bottles. Then borrow one bottle from the store owner, drink it, and use the empty bottles to exchange for one full bottle to return to the owner. If Xiao Zhang has empty bottles, how many bottles of soda can she drink at most?
Input Format
Each line contains a positive integer (), representing the number of empty bottles Xiao Zhang has. indicates the end of input, and your program should not process this line.
Output Format
For each test case, output one line containing the maximum number of bottles of soda that can be drunk. If no bottles can be drunk, output .
Sample
3
10
81
01
5
40