Problem: Polycarp studies at the university in the group which consists of n students (including himself). All they are registrated in the social net "TheContacnt!".

Not all students are equally sociable. About each student you know the value ai — the maximum number of messages which the i-th student is agree to send per day. The student can't send messages to himself. 

In early morning Polycarp knew important news that the programming credit will be tomorrow. For this reason it is necessary to urgently inform all groupmates about this news using private messages. 

Your task is to make a plan of using private messages, so that:

  * the student i sends no more than ai messages (for all i from 1 to n); 
  * all students knew the news about the credit (initially only Polycarp knew it); 
  * the student can inform the other student only if he knows it himself. 



Let's consider that all students are numerated by distinct numbers from 1 to n, and Polycarp always has the number 1.

In that task you shouldn't minimize the number of messages, the moment of time, when all knew about credit or some other parameters. Find any way how to use private messages which satisfies requirements above. 

Input

The first line contains the positive integer n (2 ≤ n ≤ 100) — the number of students. 

The second line contains the sequence a1, a2, ..., an (0 ≤ ai ≤ 100), where ai equals to the maximum number of messages which can the i-th student agree to send. Consider that Polycarp always has the number 1.

Output

Print -1 to the first line if it is impossible to inform all students about credit. 

Otherwise, in the first line print the integer k — the number of messages which will be sent. In each of the next k lines print two distinct integers f and t, meaning that the student number f sent the message with news to the student number t. All messages should be printed in chronological order. It means that the student, who is sending the message, must already know this news. It is assumed that students can receive repeated messages with news of the credit. 

If there are several answers, it is acceptable to print any of them. 

Examples

Input

4
1 2 1 0


Output

3
1 2
2 4
2 3


Input

6
2 0 1 3 2 0


Output

6
1 3
3 4
1 2
4 5
5 6
4 6


Input

3
0 2 2


Output

-1

Note

In the first test Polycarp (the student number 1) can send the message to the student number 2, who after that can send the message to students number 3 and 4. Thus, all students knew about the credit. 

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;
import static java.lang.System.in;
import static java.lang.System.out;

public class B {    
    public static void main(String args[]) throws Exception {   
        Foster sc = new Foster();
        PrintWriter p = new PrintWriter(out);
        int n = sc.nextInt();
        int a[] = sc.intArray(n);
        boolean vis[] = new boolean[n];
        ArrayList<Pair> arr = new ArrayList<>();
        PriorityQueue<Pair> pq = new PriorityQueue<>(new Comparator<Pair>(){
            public int compare(Pair a, Pair b){
                if(a.val > b.val)   return -1;
                if(a.val < b.val)   return 1;
                return -a.idx+b.idx;
            }
        });
        for(int i = 1; i < n; i++){
            pq.add(new Pair(i, a[i]));
        }
        arr.add(new Pair(0, a[0]));
        while(!pq.isEmpty()){
            arr.add(pq.poll());
        }
        
        for(int i = 1; i < n; i++){
            pq.add(new Pair(i, a[i]));
        }
        // starts here
        ArrayList<Pair> ans = new ArrayList<>();
        vis[0] = true;
        
        for(int k = 0; k < n; k++){
            Pair current = arr.get(k);
            int maxMes = current.val;
            if(!vis[current.idx])   continue;
            while(!pq.isEmpty() && maxMes > 0){
                Pair cur = pq.poll();
                vis[cur.idx] = true;
                ans.add(new Pair(current.idx+1, cur.idx+1));
                maxMes--;
            }
            pq.clear();
            for(int j = 0; j < n; j++){
                if(!vis[j])
                pq.add(new Pair(j, a[j]));
            }
            boolean allDone = true;
            for(int i = 0; i < n; i++){
                if(!vis[i]) allDone = false;
            }
            if(allDone) break;
        }
        boolean poss = true;
        for(int i = 0; i < n; i++){
            if(!vis[i]) poss = false;
        }
        if(poss){
            p.println(ans.size());
            for(int i = 0; i < ans.size(); i++){
                p.println(ans.get(i).idx + " " + ans.get(i).val);
            }
        }
        else{
            p.println("-1");
        }
        p.close();
    }

    static class Pair{
        int idx, val;
        public Pair(int idx, int val){
            this.idx = idx;
            this.val = val;
        }
    }
    
    static long[] sort(long a[]){
        ArrayList<Long> arr = new ArrayList<>();
        for(long i : a){
            arr.add(i);
        }
        Collections.sort(arr);
        for(int i = 0; i < arr.size(); i++){
            a[i] = arr.get(i);
        }
        return a;
    }

    static int[] sort(int a[]){
        ArrayList<Integer> arr = new ArrayList<>();
        for(int i : a){
            arr.add(i);
        }
        Collections.sort(arr);
        // Collections.reverse(arr);
        for(int i = 0; i < arr.size(); i++){
            a[i] = arr.get(i);
        }
        return a;
    }
    
/*
 * Is that extra condition needed
 * Check overflow in pow function or in general
 * Check indices of read array functions
 * Think of an easier solution because the problems you solve are always easy
 * Check the iterator of loop
 */      

    static class Foster {
        BufferedReader br = new BufferedReader(new InputStreamReader(in));
        StringTokenizer st = new StringTokenizer("");
        String next() {
            while (!st.hasMoreTokens())
                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());
        }
        int[] intArray(int n) {
            int arr[] = new int[n];
            for(int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }
        long[] longArray(int n) {
            long arr[] = new long[n];
            for(int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
        static long pow(long... a) {
            long mod = Long.MAX_VALUE;
            if(a.length == 3)   mod = a[2];
            long res = 1;
            while(a[1] > 0) {
                if((a[1] & 1) == 1)
                    res = (res * a[0]) % mod;
                a[1] /= 2;
                a[0] = (a[0] * a[0]) % mod;
            }
            return res;
        }
    }
}