CF1194A.Remove a Progression

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Remove a Progression

You have a list of numbers from 11 to nn written from left to right on the blackboard.

You perform an algorithm consisting of several steps (steps are 11-indexed). On the ii-th step you wipe the ii-th number (considering only remaining numbers). You wipe the whole number (not one digit).

When there are less than ii numbers remaining, you stop your algorithm.

Now you wonder: what is the value of the xx-th remaining number after the algorithm is stopped?

Input

The first line contains one integer TT (1T1001 \le T \le 100) — the number of queries. The next TT lines contain queries — one per line. All queries are independent.

Each line contains two space-separated integers nn and xx (1x<n1091 \le x \lt n \le 10^{9}) — the length of the list and the position we wonder about. It's guaranteed that after the algorithm ends, the list will still contain at least xx numbers.

Output

Print TT integers (one per query) — the values of the xx-th number after performing the algorithm for the corresponding queries.

Samples

3
3 1
4 2
69 6
2
4
12

在线编程 IDE

建议全屏模式获得最佳体验