Binary Palindromes 2#9578

Binary Palindromes 2

1 second
64 megabytes
Very easy

Your task is to find the -th non-negative binary palindrome.

A binary palindrome is a number that reads the same forwards and backwards in the binary numeral system. For example, the numbers , , , and are binary palindromes, whereas the numbers , , and are not.

Input

The first line contains the integer: .

Output

Output the -th non-negative binary palindrome modulo on a single line.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading

Example 3

Loading
Loading

Example 4

Loading
Loading

Scoring

— i \le 10^5

— i \le 10^{18}