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.*;
import java.util.stream.Collectors;

public class Main {
    static PrintWriter writer = new PrintWriter(System.out);
    static Reader reader = new Reader();
    public static void main(String[] args) {
        /*char[] s = reader.readString();
        Node[] nodes = new Node[s.length];

        for(int i = 0; i < s.length; i++) {
            nodes[i] = s[i] == '(' ? new Node(0,1,0) : new Node(0,0,1);
        }

        ST st = new ST(s.length);
        st.build(0, 0, s.length - 1, nodes);

        int m = reader.readInt();
        for (int i = 0; i < m; i++) {
            int x = reader.readInt() - 1, y = reader.readInt() - 1;
            writer.println(st.get(0, 0, s.length - 1, x, y).data);
        }*/

        int t = reader.readInt();
        ArrayList<Pair> rs = new ArrayList<>(2*100000 + 1);
        while (t-- > 0) {
            int n = reader.readInt();
            Pair[] a = new Pair[n];
            Node[] nodes = new Node[n];
            for (int i = 0; i < n; i++) {
                a[i] = new Pair(reader.readInt(), i);
                nodes[i] = new Node(a[i], a[i]);
            }

            ST st = new ST(n);
            st.build(0, 0, n - 1, nodes);

            while (true) {
                Node node = st.get(0, 0, n - 1, 0, n - 1);
                Pair max = node.max;
                Pair min = node.min;
                if (min.w == max.w || min.v == 0 || max.v == 0) break;

                rs.add(new Pair(min.w + 1, max.w + 1));

                st.update(0, 0, n - 1, min.w, new Node(new Pair(min.v - 1, min.w), new Pair(min.v - 1, min.w)));
                st.update(0, 0, n - 1, max.w, new Node(new Pair(max.v - 1, max.w), new Pair(max.v - 1, max.w)));
            }

            writer.println(rs.size());
            for (Pair r : rs) {
                writer.println(r.toString());
            }
            rs.clear();
        }

        writer.flush();


    }

}

class Utils {
    static long pow(long a, long b) {
        if (b == 0) return 1;

        long rs = pow(a, b / 2);
        return rs * rs * (b % 2 == 0 ? 1 : a);
    }

    static int GCD(int a, int b) {
        if (a == 0) return b;
        return GCD(b % a, a);
    }

    static int LCM(int a, int b) {
        return (a / GCD(a,b)) * b;
    }
}

class Pair implements Comparable<Pair> {
    int v;
    int w;

    Pair(int v, int w) {
        this.v = v;
        this.w = w;
    }

    @Override
    public int compareTo(Pair that) {
        return Integer.compare(this.v, that.v);
    }

    @Override
    public String toString() {
        return v + " " + w;
    }
}

class DSU {
    int[] p;

    DSU(int size) {
        p = new int[size];
    }

    int root(int u) {
        if (p[u] < 0) return u;
        return p[u] = root(p[u]);
    }

    void join(int u, int v) {
        int x = root(u);
        int y = root(v);
        if (x == y) return;

        if (p[y] < p[x]) {
            int t = x;
            x = y;
            y = t;
        }
        p[x] += p[y];
        p[y] = x;
    }
}

class Node {
    Pair min;
    Pair max;

    Node() {
        this.min = new Pair(Integer.MAX_VALUE, 0);
        this.max = new Pair(-Integer.MAX_VALUE, 0);
    }

    Node (Pair min, Pair max) {
        this.min = min;
        this.max = max;
    }

    Node add(Node that) {
        Pair _min;
        if (this.min.v < that.min.v) {
            _min = this.min.v > 0 ? this.min : that.min;
        } else if (this.min.v > that.min.v) {
            _min = that.min.v > 0 ? that.min : this.min;
        } else {
            _min = this.min.w < that.min.w ? this.min : that.min;
        }

        Pair _max;
        if (this.max.v > that.max.v) {
            _max = this.max;
        } else if (this.max.v < that.max.v) {
            _max = that.max;
        } else {
            _max = this.max.w < that.max.w ? that.max : this.max;
        }

        return new Node(_min, _max);
    }
}

class ST {
    Node[] st;

    ST(int n) {
        st = new Node[4 * Integer.highestOneBit(n)];
    }

    void build(int id, int l, int r, Node[] nodes) {
        if (l == r) {
            st[id] = nodes[l];
            return;
        }
        int mid = (l + r) >> 1;
        build((id << 1) + 1, l, mid, nodes);
        build((id << 1) + 2, mid + 1, r, nodes);
        st[id] = st[(id << 1) + 1].add(st[(id << 1) + 2]);
    }

    void update(int id, int l, int r, int i, Node node) {
        if (i < l || r < i) return;
        if (l == r) {
            st[id] = node;
            return;
        }
        int mid = (l + r) >> 1;
        update((id << 1) + 1, l, mid, i, node);
        update((id << 1) + 2, mid + 1, r, i, node);
        st[id] = st[(id << 1) + 1].add(st[(id << 1) + 2]);
    }

    Node get(int id, int l, int r, int x, int y) {
        if (x > r || y < l) return new Node();
        if (x <= l && r <= y) return st[id];
        int mid = (l + r) >> 1;
        return get((id << 1)+ 1, l, mid, x, y).add(get((id << 1) + 2, mid + 1, r, x, y));
    }
}

class Reader {
    private BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private StringTokenizer st = new StringTokenizer("");

    private String next() {
        while (!st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int readInt() {
        return Integer.parseInt(next());
    }

    long readLong() {
        return Long.parseLong(next());
    }

    char[] readString() {
        return next().toCharArray();
    }

    int[] readArrayInt(int n) {
        int[] a = new int[n];
        for(int i = 0; i < n; i++)
            a[i] = readInt();
        return a;
    }
}


