Cycle shifts#27

Cycle shifts

1 second
128 megabytes
Easy

Let us write the integer in binary notation and generate all its left cyclic shifts, moving the first digit to the end each time.

For example, if n = 11, in binary this is . Its cyclic shifts are , , , . The maximum value among all obtained numbers is 1110_2 = 14_{10}.

Find the maximum value that can be obtained from all left cyclic shifts of the binary representation of the given .

Input

One integer (1 \leq n \leq 2 \cdot 10^9).

Output

One integer .

Examples

Example 11

Loading
Loading