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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class D {
    private static final FastReader fs = new FastReader();
    private static final PrintWriter out = new PrintWriter(System.out);
    private static long m = 1_000_000_009;
    private static long p = 31;
    private static long mod = 1_000_000_007;
    private static long ool = 1_000_000_000_000_000_009l;
    private static int ooi = 1_000_000_009;

    private static class Pair implements Comparable<Pair> {
        int num;
        int idx;
        public Pair(int num, int idx){
            this.num = num;
            this.idx = idx;
        }

        public int compareTo(Pair p){
            return num == p.num ? (idx == p.idx ? 0 : idx < p.idx ? -1 : 1) : (num < p.num ? -1 : 1);
        }
    }

    private static void solve() {
        int n = fs.nextInt();
        TreeSet<Pair> in = new TreeSet<>();
        for(int i = 0; i <n ;i++)
            in.add(new Pair(fs.nextInt(), i));
        while(!in.isEmpty()){
            Pair p1 = in.first();
            if(p1.num == 0){
                in.remove(p1);
            }
            else
                break;;
        }
        int i = 0, j = n-1;
        int talk = 2_000_05;
        ArrayList<int[]> ans = new ArrayList<>();
        while(talk > 0 && !in.isEmpty()){
            if(in.size() == 1)
                break;
            Pair p1 = in.first();
            Pair p2 = in.last();
            in.remove(p1);
            in.remove(p2);
            ans.add(new int[] {p1.idx + 1, p2.idx+1});
            if(p1.num-1 > 0)
                in.add(new Pair(p1.num-1, p1.idx));
            if(p2.num-1 > 0)
                in.add(new Pair(p2.num-1, p2.idx));
            talk -= 1;
        }
        out.println(ans.size());
        for(int[] aa : ans)
            out.println(aa[0] + " " + aa[1]);
    }

    public static void main(String[] args) {
        Thread t = new Thread(null, null, "", 1 << 28) {
            public void run() {
                int test_case = 1;
                test_case = fs.nextInt();
                for (int cs = 1; cs <= test_case; cs++)
                    solve();
                out.close();
            }
        };
        t.start();
        try {
            t.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    private 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[] readintarray(int n) {
            int res[] = new int[n];
            for (int i = 0; i < n; i++)
                res[i] = nextInt();
            return res;
        }

        long[] readlongarray(int n) {
            long res[] = new long[n];
            for (int i = 0; i < n; i++)
                res[i] = nextLong();
            return res;
        }
    }

    private static int max(int... arg) {
        int length = arg.length;
        if(length == 0)
            throw null;
        int maxVal = arg[0];
        for(int i = 1; i < length; i++)
            maxVal = Math.max(maxVal, arg[i]);
        return maxVal;
    }

    private static int min(int... arg) {
        int length = arg.length;
        if(length == 0)
            throw null;
        int maxVal = arg[0];
        for(int i = 1; i < length; i++)
            maxVal = Math.min(maxVal, arg[i]);
        return maxVal;
    }

    private static long max(long... arg) {
        int length = arg.length;
        if(length == 0)
            throw null;
        long maxVal = arg[0];
        for(int i = 1; i < length; i++)
            maxVal = Math.max(maxVal, arg[i]);
        return maxVal;
    }

    private static long min(long... arg) {
        int length = arg.length;
        if(length == 0)
            throw null;
        long maxVal = arg[0];
        for(int i = 1; i < length; i++)
            maxVal = Math.min(maxVal, arg[i]);
        return maxVal;
    }

    private static int abs(int a) {
        return a >= 0 ? a : -a;
    }

    private static int abs(int a, int b) {
        return a-b >= 0 ? a-b : b-a;
    }

    private static long abs(long a) {
        return a >= 0 ? a : -a;
    }

    private static long abs(long a, long b) {
        return a-b >= 0 ? a-b : b-a;
    }

    private static int power(int base, int exponent) {
        int res = 1;
        while(exponent > 0) {
            if((exponent & 1) != 0)
                res *= base;
            exponent >>= 1;
            base *= base;
        }
        return res;
    }

    private static long power(long base, long exponent) {
        long res = 1;
        while(exponent > 0) {
            if((exponent & 1) != 0)
                res *= base;
            exponent >>= 1;
            base *= base;
        }
        return res;
    }

    private static long mPower(long base, long exponent) throws Exception {
        long res = 1;
        base %= mod;
        while(exponent > 0) {
            if((exponent & 1) != 0)
                res = mul(res, base);
            exponent >>= 1;
            base = mul(base, base);
        }
        return res;
    }

    private static long mul(long a, long b) {
        return a*b % mod;
    }

    private static long add(long a, long b) {
        return (a+b) % mod;
    }

    private static long sub(long a, long b) {
        long res = (a - b) % mod;
        if(res < 0)
            res += mod;
        return res;
    }

    private static long xor(long n){
        long r = n % 4;
        if(r == 0)
            return n;
        else if(r == 1)
            return 1;
        else if(r == 2)
            return n+1;
        else
            return 0;
    }
}