402842: GYM100917 I Interactive Casino

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. Interactive Casinotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

This is interactive problem.

In the Interactive Casino game "Binary Roulette" is very popular. Here are the rules of the game.

  • Initially the player has 160 tokens.
  • In one turn player can bet any positive integer amount of tokens, as long as it does not exceed number of tokens player currently has.
  • Inside of slot machine an integer x between 0 and 220 - 1 is generated. If sum of bits of this integer is odd, then player wins (i.e. returns his bet and additional k tokens), otherwise the player loses his bet. Note that player does not know value of x.
  • If the player has zero tokens, game is lost.
  • If the player makes more than 200 bets, game is lost.
  • If the player at some time has 200 tokens, he won the game.

You found on the Algoleaks site that each next integer on the sloth machine is generated using the formula . Source of x1, unluckly, on this site is not revealed.

Your goal is to ensure the victory.

Input

Your program will receive on the input one integer — number of tokens You currently have or  - 1 in case when game is over by some reason.

Output

If you received  - 1, immediately exit your program with code 0 (otherwise you may get the random verdict from the system). Otherwise, if you received integer T > 0, print one integer between 1 and T, inclusively — your next bet. Dont forget to print end-of-line character and flush the output.

ExampleInput
160
155
165
180
-1
Output
5
10
15
20

加入题单

算法标签: