An important meeting is to be held and there are exactly n people invited. At any moment, any two people can step back and talk in private. The same two people can talk several (as many as they want) times per meeting.

Each person has limited sociability. The sociability of the i-th person is a non-negative integer a_i. This means that after exactly a_i talks this person leaves the meeting (and does not talk to anyone else anymore). If a_i = 0, the i-th person leaves the meeting immediately after it starts.

A meeting is considered most productive if the maximum possible number of talks took place during it.

You are given an array of sociability a, determine which people should talk to each other so that the total number of talks is as large as possible.

Input

The first line contains an integer t (1 ≤ t ≤ 1000) — the number of test cases.

The next 2t lines contain descriptions of the test cases.

The first line of each test case description contains an integer n (2 ≤ n ≤ 2 ⋅ 10^5) —the number of people in the meeting. The second line consists of n space-separated integers a_1, a_2, ..., a_n (0 ≤ a_i ≤ 2 ⋅ 10^5) — the sociability parameters of all people. 

It is guaranteed that the sum of n over all test cases does not exceed 2 ⋅ 10^5. It is also guaranteed that the sum of all a_i (over all test cases and all i) does not exceed 2 ⋅ 10^5.

Output

Print t answers to all test cases.

On the first line of each answer print the number k — the maximum number of talks possible in a meeting.

On each of the next k lines print two integers i and j (1 ≤ i, j ≤ n and i ≠ j) — the numbers of people who will have another talk.

If there are several possible answers, you may print any of them.

Example

Input


8
2
2 3
3
1 2 3
4
1 2 3 4
3
0 0 2
2
6 2
3
0 0 2
5
8 2 0 1 1
5
0 1 0 0 6


Output


2
1 2
1 2
3
1 3
2 3
2 3
5
1 3
2 4
2 4
3 4
3 4
0
2
1 2
1 2
0
4
1 2
1 5
1 4
1 2
1
5 2
import java.util.*;
import java.io.*;
import java.math.*;

public class Solution{
	
	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
        public FastReader() 
        { 
            br = new BufferedReader(new
                    InputStreamReader(System.in)); 
        }  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        }
        int[] nextIntArray(int n)
        {
            int arr[]=new int[n];
            for(int i=0;i<n;i++)
            {
                arr[i]=Integer.parseInt(next());
            }
            return arr;
        }
        Integer[] nextIntegerArray(int n)
        {
            Integer arr[]=new Integer[n];
            for(Integer i=0;i<n;i++)
            {
                arr[i]=Integer.parseInt(next());
            }
            return arr;
        }
        long[] nextLongArray(int n)
        {
            long arr[]=new long[n];
            for(int i=0;i<n;i++)
            {
                arr[i]=Long.parseLong(next());
            }
            return arr;
        }
    } 
	
	/*
	If we keep on subtracting the larger number from a smaller number gcd doesn't change. Hence, when smaller==larger (or) smaller divides larger we have our gcd=smaller.
	*/
	static int gcd(int larger,int smaller){
		if(larger%smaller==0){
			return smaller;
		}
		return gcd(smaller,larger%smaller);
	}
	
	static long modularInverse(long a,long mod){
	    long ans=1;
	    long y=mod-2;
	    while(y>0){
	        if((y&1)==1){
	            ans=((ans%mod)*(a%mod))%mod;
	        }
	        y>>=1;
	        a=((a%mod)*(a%mod))%mod;
	    }
	    return ans%mod;
	}
	
	static long nCr(int n,int r){//Uses fermat's little theorem for calculating modular inverse of r! and (n-r)!
	    if(r>n){
	        return 0;
	    }
	    if(r==0 || r==n){
	        return 1;
	    }
	    if(n-r<r){
	        r=n-r;
	    }
	    long mod=1000000000+7;
	    long ans=1;
	    long product=1;
	    long in1=1;
	    long in2=1;
	    for(int i=1;i<=n;i++){
	        product=((product%mod)*(i%mod))%mod;
	        if(i==r){
	            in1=modularInverse(product,mod);
	        }
	        if(i==n-r){
	            in2=modularInverse(product,mod);
	        }
	    }
	    return ((((product%mod)*(in1%mod))%mod)*(in2%mod));
	}
	
	
	static void swap(char [] s,int i,int j){
		char t=s[i];
		s[i]=s[j];
		s[j]=t;
	}
	
	static void permute(char[] s,int l,int r,int n){
		
		if(l<r){
			for(int i=l;i<=r;i++){
				swap(s,l,i);
				permute(s,l+1,r,n);
				swap(s,l,i);
			}
		}
		else{
			System.out.println(new String(s));
		}
		
	}
	
	static class Node{
	    int v;
	    int index;
	    Node(int a,int b){
	        v=a;
	        index=b;
	    }
	}
	
	static class sort implements Comparator<Node>{
	    public int compare(Node a,Node b){
	        return a.v-b.v;
	    }
	}
	
	static class pair{
	    int l;
	    int r;
	    pair(int a,int b){
	        l=a;
	        r=b;
	    }
	}
	
    public static void main(String args[]) throws UnsupportedEncodingException, IOException {
        FastReader sc=new FastReader();
		BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512);
		//Below is the code to be used when dealing file handling for input and output.
		/*BufferedReader br = new BufferedReader(
                               new FileReader("input.txt"));
		PrintWriter pw=new PrintWriter(new
                BufferedWriter(new FileWriter("output.txt")));
		pw.flush();
		pw.close();*/
		int te=sc.nextInt();
		for(int qu=0;qu<te;qu++){
		    int n=sc.nextInt();
		    Node[] arr=new Node[n];
		    for(int i=0;i<n;i++){
		        arr[i]=new Node(sc.nextInt(),i+1);
		    }
		    Arrays.sort(arr,new sort());
		    ArrayList<pair> ans=new ArrayList<pair>();
		    int max=0;
		    int i=n-1;
		    int j=n-2;
		    while(j>-1 && i>-1){
		        while(arr[j].v>0 && arr[i].v>0){
		            max++;
		            arr[j].v--;
		            arr[i].v--;
		            ans.add(new pair(arr[j].index,arr[i].index));
		        }
		        while(j>-1 && arr[j].v==0){
		            j--;
		        }
		        while(i>-1 && arr[i].v==0){
		            i--;
		        }
		        if(i==j) j--;
		    }
		    out.write(max+"\n");
		    for(i=0;i<ans.size();i++){
		        out.write(ans.get(i).l+" "+ans.get(i).r+"\n");
		    }
			out.flush();
		}
		out.close();
    }
}