QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 128 MB Total points: 10

#10646. Binary Dodgeball [A]

Statistics

Bituś and Bajtuś are playing "binary dodgeball." The game is played on a board consisting of $n$ squares numbered from 1 to $n$. There is one pawn on each square. Players take turns. A move consists of taking a pawn from square $i$ and moving it to square $2^{k}i$, for any $k \ge 1$, provided that such a square exists. If there was a pawn on the new square, a "capture" occurs, and both pawns are eliminated from the game. The player who cannot make a move loses.

Each time, Bituś prepares the board (i.e., chooses a positive integer $n$) and magnanimously gives the first move to Bajtuś. However, Bituś does not like to lose, so he decided to always choose a board on which the second player has a winning strategy. This is the case, for example, for boards of lengths 1, 10, or 11. He does not want Bajtuś to start suspecting anything, so he must choose a board of a different size each time.

He has asked you for help. Write a program that, for a given number $k$, outputs the $k$-th smallest board size for which the second player has a winning strategy.

Input

The only line of input contains a single integer $k$ ($1 \le k \le 1\,000\,000\,000$).

Output

The only line of output should contain a single integer equal to the size of the $k$-th smallest board that guarantees a win for the second player.

Examples

Input 1

2

Output 1

10

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.