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
/*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

*/
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
	static PrintWriter out;
	static int MOD = 1000000007;
	static FastReader scan;

    /*-------- I/O usaing short named function ---------*/
	public static String ns(){return scan.next();}
	public static int ni(){return scan.nextInt();}
	public static long nl(){return scan.nextLong();}
	public static double nd(){return scan.nextDouble();}
	public static String nln(){return scan.nextLine();}
	public static void p(Object o){out.print(o);}
	public static void ps(Object o){out.print(o + " ");}
	public static void pn(Object o){out.println(o);}
    /*-------- for output of an array ---------------------*/
     static void iPA(int arr []){
     	 StringBuilder output = new StringBuilder();
	     for(int i=0; i<arr.length; i++)output.append(arr[i] + " ");out.println(output);
	}
	static void lPA(long arr []){
	     StringBuilder output = new StringBuilder();
	     for(int i=0; i<arr.length; i++)output.append(arr[i] + " ");out.println(output);
	}
	static void sPA(String arr []){
	     StringBuilder output = new StringBuilder();
	     for(int i=0; i<arr.length; i++)output.append(arr[i] + " ");out.println(output);
	}
	static void dPA(double arr []){
	     StringBuilder output = new StringBuilder();
	     for(int i=0; i<arr.length; i++)output.append(arr[i] + " ");out.println(output);
	}
    /*-------------- for input in an array ---------------------*/
	static void iIA(int arr[]){
	     for(int i=0; i<arr.length; i++)arr[i] = ni();
	}
	static void lIA(long arr[]){
	     for(int i=0; i<arr.length; i++)arr[i] = nl(); 
	}
	static void sIA(String arr[]){
	     for(int i=0; i<arr.length; i++)arr[i] = ns(); 
	}
	static void dIA(double arr[]){
	     for(int i=0; i<arr.length; i++)arr[i] = nd();
	}
	/*------------ for taking input faster ----------------*/
     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;
		}
	}

	// Method to check if x is power of 2
    static boolean isPowerOfTwo (int x) { return x!=0 && ((x&(x-1)) == 0);}
    //Method to return gcd of two numbers
    static int gcd(int a, int b){return a==0?b:gcd(b % a, a); }
    //Method to count digit of a number
    static int countDigit(long n){return (int)Math.floor(Math.log10(n) + 1);}
    //Method for sorting
	static void sort(int[] a) {
		ArrayList<Integer> l=new ArrayList<>();
		for (int i:a) l.add(i);
		Collections.sort(l);
		for (int i=0; i<a.length; i++) a[i]=l.get(i);
	}
	//Method for sorting
	static void sort(long[] a) {
		ArrayList<Long> l=new ArrayList<>();
		for (long i:a) l.add(i);
		Collections.sort(l);
		for (int i=0; i<a.length; i++) a[i]=l.get(i);
	}
	//Method foAr checking if a number is prime or not
	static boolean isPrime(int n) { 
        if (n <= 1) return false; 
        if (n <= 3) return true; 
        if (n % 2 == 0 || n % 3 == 0) return false; 
        for (int i = 5; i * i <= n; i = i + 6) 
            if (n % i == 0 || n % (i + 2) == 0) 
            	return false; 
        return true; 
    } 

	public static void main (String[] args) throws java.lang.Exception
	{
        out =new PrintWriter(System.out);
        scan =new FastReader();
		//for fast output sometimes
		StringBuilder res = new StringBuilder();
		int t = ni();
		while(t-->0){
			StringBuilder sb = new StringBuilder();
			int n = ni();
			int arr[] = new int[n];
			iIA(arr);

			/*ArrayList<Pair> list = new ArrayList<>();

			for(int i=0; i<n; i++){
				if(arr[i] > 0)
					list.add(new Pair(arr[i], i+1));
			}

			Collections.sort(list, (p1, p2) -> (p1.val - p2.val));

			int l = 0, r = list.size()-1;

			long count = 0;

			while(l<r){
				count++;
				sb.append(list.get(l).idx + " " + list.get(r).idx + "\n");
				list.get(l).val--;
				list.get(r).val--;

				if(list.get(l).val == 0){
					l++;
				}
				if(list.get(r).val == 0){
					r--;
				}
			}
			
        }*/

        /*TreeSet<Pair> ts = new TreeSet<Pair>((p1, p2) -> (p1.val - p2.val));

        for(int i=0; i<n; i++){
        	ts.add(new Pair(i+1, arr[i]));
        }

        pn("------ " + ts.size());
        long count = 0;
        while(!ts.isEmpty()){
        	

        	Pair min = ts.first();
        	ts.remove(min);
        	if(ts.isEmpty()){
        		break;
        	}
        	count++;
        	Pair max = ts.last();
        	ts.remove(max);

        	//pn(min.val + " " + max.val);
        	sb.append(min.idx + " " + max.idx + "\n");


        	min.val--;
        	max.val--;


        	if(min.val > 0){
        		ts.add(min);
        	}
        	if(max.val>0){
        		ts.add(max);
        	}
        }*/

        long count = 0;

        TreeMap<Integer, Stack<Integer>> map = new TreeMap<>();

        for(int i=0; i<n; i++){
        	if(arr[i]>0 && !map.containsKey(arr[i])){
        		map.put(arr[i], new Stack<Integer>());
        	}
        	if(arr[i]>0)
        		map.get(arr[i]).add(i+1);
        }

        //pn(" -- " + map.size());

        while(!map.isEmpty()){

        	int min = map.firstKey();

        	int l = map.get(min).pop();

        	if(map.get(min).isEmpty()){
        		map.remove(min);
        	}

        	if(map.size() == 0){
        		break;
        	}

        	int max = map.lastKey();

        	int r = map.get(max).pop();

        	if(map.get(max).isEmpty()){
        		map.remove(max);
        	}

        	sb.append(l + " " + r + "\n");


        	min--;
        	max--;

        	if(min>0){
        		if(!map.containsKey(min)){
        			map.put(min, new Stack<Integer>());
        		}
        		map.get(min).add(l);
        	}

        	if(max>0){
        		if(!map.containsKey(max)){
        			map.put(max, new Stack<Integer>());
        		}
        		map.get(max).add(r);
        	}


        	count++;
        }

        res.append(count).append("\n");
			res.append(sb);
}
        p(res.toString());
        out.flush();
		out.close();
	}
	
}
class Pair{
	int val, idx;
	Pair(int idx, int val){
		this.val = val;
		this.idx = idx;
	}
}