You have a list of numbers from 1 to n written from left to right on the blackboard.

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

<image>

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

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

Input

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

Each line contains two space-separated integers n and x (1 ≤ x < n ≤ 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 x numbers.

Output

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

Example

Input


3
3 1
4 2
69 6


Output


2
4
12
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class _p001194A {
    static public void main(final String[] args) throws java.io.IOException {
        p001194A._main(args);
    }
//begin p001194A.java
static private class p001194A{static public void _main(String[]args)throws IOException
{new Solver(){{{nameIn="p001194A.in";singleTest=false;}}@Override public void process
(BufferedReader br,PrintWriter pw)throws IOException{int[]nx=readIntArray(br);solve
(nx[0],nx[1],pw);}private void solve(int n,int x,PrintWriter pw){pw.println(x*2)
;}}.run();}}
//end p001194A.java
//begin net/leksi/contest/Solver.java
static private abstract class Solver{protected String nameIn=null;protected String
nameOut=null;protected boolean singleTest=false;protected boolean preprocessDebug
=false;protected boolean doNotPreprocess=false;private void preProcess(final BufferedReader
br,final PrintWriter pw)throws IOException{if(!singleTest){int t=Integer.valueOf
(br.readLine().trim());while(t-->0){process(br,pw);}}else{process(br,pw);}}abstract
public void process(final BufferedReader br,final PrintWriter pw)throws IOException
;protected int[]readIntArray(final BufferedReader br)throws IOException{return Arrays
.stream(br.readLine().trim().split("\\s+")).mapToInt(Integer::valueOf).toArray()
;}protected long[]readLongArray(final BufferedReader br)throws IOException{return
Arrays.stream(br.readLine().trim().split("\\s+")).mapToLong(Long::valueOf).toArray
();}protected String readString(final BufferedReader br)throws IOException{return
br.readLine().trim();}protected String intArrayToString(final int[]a){return Arrays
.stream(a).mapToObj(Integer::toString).collect(Collectors.joining(" "));}protected
String longArrayToString(final long[]a){return Arrays.stream(a).mapToObj(Long::toString
).collect(Collectors.joining(" "));}protected List<Long>longArrayToList(final long
[]a){return Arrays.stream(a).mapToObj(Long::valueOf).collect(Collectors.toList()
);}protected List<Integer>intArrayToList(final int[]a){return Arrays.stream(a).mapToObj
(Integer::valueOf).collect(Collectors.toList());}protected List<Long>intArrayToLongList
(final int[]a){return Arrays.stream(a).mapToObj(Long::valueOf).collect(Collectors
.toList());}public void run()throws IOException{try{try(FileReader fr=new FileReader
(nameIn);BufferedReader br=new BufferedReader(fr);PrintWriter pw=select_output()
;){preProcess(br,pw);}}catch(Exception ex){try(InputStreamReader fr=new InputStreamReader
(System.in);BufferedReader br=new BufferedReader(fr);PrintWriter pw=select_output
();){preProcess(br,pw);}}}private PrintWriter select_output()throws FileNotFoundException
{if(nameOut !=null){return new PrintWriter(nameOut);}return new PrintWriter(System
.out);}}
//end net/leksi/contest/Solver.java
}
