CSES - HIIT Open 2016 - Fixed points
  • Time limit: 2.00 s
  • Memory limit: 256 MB

A fixed point for a function f is a value x such that f(x)=x.

In this task we focus on the following function: f(x) = ((a \cdot x) \oplus b) \bmod 2^{64}The operator \oplus is the xor operator (written ^ in C++/Java).

Given a and b, can you find a fixed point for the function?

Input

The first input line contains an integer t: the number of test cases.

After this, there are t lines that describe the test cases. Each line contains two integers a and b.

All test cases have been generated so that a and b have been chosen uniformly randomly from the range 0 \ldots 2^{64}-1.

Output

For each case, output a number 0\leq x\leq 2^{64}-1 that is a fixed point for the function, or "-" if no such number exists.

If there are several possible solutions, you can output any of them.

Constraints

  • 1 \le t \le 10^5
  • 0\leq a, b\leq 2^{64}-1

Example

Input:

3
2 5
1 1
0 7

Output:

3
-
7

For example, in the first test case, f(3)=((2\cdot3) \oplus 5) \bmod 2^{64}=3.