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.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
    static int mod = 1000_000_007;
    static long mod1 = 998244353;
    static boolean memory = true;
    static FastScanner f;
    static PrintWriter pw;
    static double eps = 1e-6;
    static int oo = (int) 1e9;

    // Pair class in Java , overrides equals()
    public static class Pair {
        int x;
        int y;

        public Pair(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public boolean equals(Object obj) {
            if (this == obj)
                return true;
            if (obj == null)
                return false;
            if (getClass() != obj.getClass())
                return false;
            Pair other = (Pair) obj;
            return this.x == other.x && this.y == other.y;
        }

        @Override
        public int hashCode() {
            final int prime = 31;
            int result = 1;
            result = prime * result + x;
            result = prime * result + y;
            return result;
        }
    }

    static int cmp(Pair a , Pair b) {
        if (a.y != b.y) return a.y - b.y;
        return a.x - b.x;
    }
    
    public static void solve() throws Exception {
        int n = f.ni();
        TreeSet<Pair> mp = new TreeSet<>(Main::cmp);
        
        for (int i = 0; i < n; ++i) {
            int x = f.ni();
            if (x == 0) continue;
            mp.add(new Pair(i + 1 , x));
        }


        int cnt = 0;
        StringBuffer sb = new StringBuffer("");
        while (mp.size() > 1) {
            Pair min = mp.pollFirst();
            Pair max = mp.pollLast();
            ++cnt;
            sb.append(min.x + " " + max.x + "\n");
            if (min.y > 1) {
                mp.add(new Pair(min.x , min.y - 1));
            }
            if (max.y > 1) {
                mp.add(new Pair(max.x , max.y - 1));
            }
        }
        pn(cnt);
        p(sb);
    }

    public static void main(String[] args) throws Exception {
        if (memory)
            new Thread(null, new Runnable() {
                public void run() {
                    try {
                        Main.run();
                    } catch (Exception e) {
                        e.printStackTrace();
                        System.exit(1);
                    }
                }
            }, "", 1 << 28).start();
        else {
            Main.run();
        }
    }

    static void run() throws Exception {
        if (System.getProperty("ONLINE_JUDGE") == null) {
            f = new FastScanner("");
            File file = new File("!out.txt");
            pw = new PrintWriter(file);
        } else {
            f = new FastScanner();
            pw = new PrintWriter(System.out);
        }

        int t = f.ni();
        while (t-- > 0) {
            solve();
        }

        pw.flush();
        pw.close();
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String str) throws Exception {
            try {
                br = new BufferedReader(new FileReader("!a.txt"));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int ni() throws IOException {
            return Integer.parseInt(next());
        }

        public long nl() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nd() throws IOException {
            return Double.parseDouble(next());
        }

    }

    public static void pn(Object... o) {
        for (int i = 0; i < o.length; ++i)
            pw.print(o[i] + (i + 1 < o.length ? " " : "\n"));
    }

    public static void p(Object... o) {
        for (int i = 0; i < o.length; ++i)
            pw.print(o[i] + (i + 1 < o.length ? " " : ""));
    }

    public static void pni(Object... o) {
        for (Object obj : o)
            pw.print(obj + " ");
        pw.println();
        pw.flush();
    }

    public 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);
    }

    public 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);
    }
}