405855: GYM102135 H Large and even

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

Description

H. Large and eventime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Let f(x) be the greatest even divisor of x or 0, if there is no such divisor.

You are given n queries li, ri. For each of them you have to find .

Input

The first line contains one integer n (1 ≤ n ≤ 105) — the number of queries.

Each line of n subsequent lines contains two space-separated integers li and ri (1 ≤ li ≤ ri ≤ 105) — the description of i-th request.

Output

Print n integers. On i-th line print one integer — the answer for the i-th query.

ExamplesInput
1
2 12
Output
42
Input
2
1 42
42 45
Output
462
86

加入题单

算法标签: