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.util.*;
import java.io.*;
import java.text.DecimalFormat;


public class Ay { 

	static class Reader 
    { 
        final private int BUFFER_SIZE = 1 << 16; 
        private DataInputStream din; 
        private byte[] buffer; 
        private int bufferPointer, bytesRead; 
  
        public Reader() 
        { 
            din = new DataInputStream(System.in); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } 
  
        public Reader(String file_name) throws IOException 
        { 
            din = new DataInputStream(new FileInputStream(file_name)); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } 
  
        public String readLine() throws IOException 
        { 
            byte[] buf = new byte[1000000]; // line length 
            int cnt = 0, c; 
            while ((c = read()) != -1) 
            { 
                if (c == '\n') 
                    break; 
                buf[cnt++] = (byte) c; 
            } 
            return new String(buf, 0, cnt); 
        } 
  
        public int nextInt() throws IOException 
        { 
            int ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do
            { 
                ret = ret * 10 + c - '0'; 
            }  while ((c = read()) >= '0' && c <= '9'); 
  
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        public long nextLong() throws IOException 
        { 
            long ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        public double nextDouble() throws IOException 
        { 
            double ret = 0, div = 1; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
  
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
  
            if (c == '.') 
            { 
                while ((c = read()) >= '0' && c <= '9') 
                { 
                    ret += (c - '0') / (div *= 10); 
                } 
            } 
  
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        private void fillBuffer() throws IOException 
        { 
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); 
            if (bytesRead == -1) 
                buffer[0] = -1; 
        } 
  
        private byte read() throws IOException 
        { 
            if (bufferPointer == bytesRead) 
                fillBuffer(); 
            return buffer[bufferPointer++]; 
        } 
  
        public void close() throws IOException 
        { 
            if (din == null) 
                return; 
            din.close(); 
        } 
    } 

    static void oracle(int graph[][], int dist[][], int V) 
    { 
        int i, j, k; 
  
        for (i = 1; i < V; i++) 
            for (j = 1; j < V; j++) 
                dist[i][j] = graph[i][j]; 
  
        for (k = 1; k < V; k++) 
        { 
            for (i = 1; i < V; i++) 
            { 
                for (j = 1; j < V; j++) 
                { 
                    if (dist[i][k] + dist[k][j] < dist[i][j]) 
                        dist[i][j] = dist[i][k] + dist[k][j]; 
                } 
            } 
        } 
    } 
    // static int nCrModPFermat(int n, int r, int p) 
    // { 
    //     if (r == 0) 
    //         return 1; 
    //     int[] fac = new int[n+1]; 
    //     fac[0] = 1;           
    //     for (int i = 1 ;i <= n; i++) 
    //         fac[i] = fac[i-1] * i % p;       
    //     return (fac[n]* findMMI_fermat(fac[r], p)% p * findMMI_fermat(fac[n-r], p) % p) % p; 
    // } 

    public static void main(String args[])throws IOException{
    	Reader sc=new Reader(); 
        // Scanner sc=new Scanner(System.in);
        PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int i,j;
        // sc.nextLong()
        int t=sc.nextInt();
        while(t-->0){
            int n=sc.nextInt();
            int x=sc.nextInt();
            pw.println(2*x);
        }
        pw.close();
        
    }
}	