시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB101676265.263%

문제

You are given a pair of positive integers $a$ and $b$ ($a ≤ b$). Among those integers between $a$ and $b$, inclusive, your task is to find the sparsest one, that is, the one with the least number of 1’s in its binary representation. If there are two or more such integers, you should find the smallest among them.

Suppose, for instance, that $a = 10$ and $b = 13$. The integers between $a$ and $b$, inclusive, are $10$, $11$, $12$, and $13$, and their binary representations are 1010, 1011, 1100, and 1101, respectively. Thus, in this case, the answer is $10$, since $10$ and $12$ have the least number of 1’s in their binary representations and $10$ is smaller than $12$.

입력

The input consists of a single test case of the following format.

$a$ $b$

Here, $a$ and $b$ ($a ≤ b$) are integers between $1$ and $10^{18}$, inclusive.

출력

Output a line containing the smallest among the sparsest integers between $a$ and $b$, inclusive.

예제 입력 1

10 13

예제 출력 1

10

예제 입력 2

11 15

예제 출력 2

12

예제 입력 3

11 20

예제 출력 3

16

예제 입력 4

1 1000000000000000000

예제 출력 4

1

예제 입력 5

9876543210 9876543210

예제 출력 5

9876543210