Problem: Graph constructive problems are back! This time the graph you are asked to build should match the following properties.

The graph is connected if and only if there exists a path between every pair of vertices.

The diameter (aka "longest shortest path") of a connected undirected graph is the maximum number of edges in the shortest path between any pair of its vertices.

The degree of a vertex is the number of edges incident to it.

Given a sequence of n integers a_1, a_2, ..., a_n construct a connected undirected graph of n vertices such that:

  * the graph contains no self-loops and no multiple edges; 
  * the degree d_i of the i-th vertex doesn't exceed a_i (i.e. d_i ≤ a_i); 
  * the diameter of the graph is maximum possible. 



Output the resulting graph or report that no solution exists.

Input

The first line contains a single integer n (3 ≤ n ≤ 500) — the number of vertices in the graph.

The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ n - 1) — the upper limits to vertex degrees.

Output

Print "NO" if no graph can be constructed under the given conditions.

Otherwise print "YES" and the diameter of the resulting graph in the first line.

The second line should contain a single integer m — the number of edges in the resulting graph.

The i-th of the next m lines should contain two integers v_i, u_i (1 ≤ v_i, u_i ≤ n, v_i ≠ u_i) — the description of the i-th edge. The graph should contain no multiple edges — for each pair (x, y) you output, you should output no more pairs (x, y) or (y, x).

Examples

Input


3
2 2 2


Output


YES 2
2
1 2
2 3


Input


5
1 4 1 1 1


Output


YES 2
4
1 2
3 2
4 2
5 2


Input


3
1 1 1


Output


NO

Note

Here are the graphs for the first two example cases. Both have diameter of 2.

<image> d_1 = 1 ≤ a_1 = 2

d_2 = 2 ≤ a_2 = 2

d_3 = 1 ≤ a_3 = 2 

<image> d_1 = 1 ≤ a_1 = 1

d_2 = 4 ≤ a_2 = 4

d_3 = 1 ≤ a_3 = 1

d_4 = 1 ≤ a_4 = 1 

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;
public class D {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int n = sc.nextInt();
        int ones= 0;
        int big = 0;
        Stack<Integer>a = new Stack<>();
        Stack<Integer>b = new Stack<>();
        int[] arr2 = new int[n];
        for(int i=0;i<n;i++){
            int x = sc.nextInt();
            arr2[i] = x;
            if(x==1){
                a.add(i+1);
                ones++;
            }else{
                b.add(i+1);
                big++;
            }
        }
        if((ones>1 && big==0)){
            pw.println("NO");
            pw.flush();
            return;
        }
        StringBuilder res = new StringBuilder("");
        int ss = 0;
        ArrayList<ArrayList<Integer>>arr = new ArrayList<>();
        for(int i=0;i<n;i++)arr.add(new ArrayList<>());
        int last = b.pop();
        int first = last;
        boolean[] v = new boolean[n];
        v[last-1] = true;
        while (!b.isEmpty()){
            ss++;
            int x = b.pop();
            v[x-1] = true;
            res.append(last+" " +x+"\n");
            arr.get(last-1).add(x-1);
            arr.get(x-1).add(last-1);
            last = x;
        }
        if (a.size()>0){
            int x = a.pop();
            ss++;
            res.append(last+" " +x+"\n");
            arr.get(last-1).add(x-1);
            arr.get(x-1).add(last-1);
        }
        if(a.size()>0){
            int x = a.pop();
            ss++;
            res.append(first+" " +x+"\n");
            arr.get(first-1).add(x-1);
            arr.get(x-1).add(first-1);
        }
        for(int i=0;i<n &&!a.isEmpty();i++){
            if(!v[i])continue;
            while (arr.get(i).size()<arr2[i] && !a.isEmpty()){
                int x = a.pop()-1;
                ss++;
                res.append((i+1)+" "+ (x+1) + "\n");
                arr.get(i).add(x);
                arr.get(x).add(i);
            }
        }
        if(!a.isEmpty()){
            pw.println("NO");
            pw.flush();
            return;
        }
        pw.println("YES "+ (treeDiameter(arr)[2]-1));
        pw.println(ss);
        pw.println(res);
        pw.flush();
        pw.close();
    }
    public static int[] treeDiameter(ArrayList<ArrayList<Integer>>adjmat){
        Queue<Integer>q = new LinkedList<>();
        Queue<Integer>dist = new LinkedList<>();
        q.add(0);
        dist.add(1);
        boolean[] v = new boolean[adjmat.size()];
        v[0] = true;
        int max = 0;
        int v1 = 0;
        while(!q.isEmpty()){
            int a = q.poll();
            int d = dist.poll();
            for(int i=0;i<adjmat.get(a).size();i++){
                if(!v[adjmat.get(a).get(i)]){
                    v[adjmat.get(a).get(i)] = true;
                    q.add(adjmat.get(a).get(i));
                    dist.add(d+1);
                    if(max<d+1){
                        max = d+1;
                        v1 = adjmat.get(a).get(i);
                    }
                }
            }
        }
        q = new LinkedList<>();
        v = new boolean[adjmat.size()];
        dist = new LinkedList<>();
        int max2 = 0;
        int v2 = v1;
        q.add(v1);
        dist.add(1);
        v[v1] = true;
        while(!q.isEmpty()){
            int a = q.poll();
            int d = dist.poll();
            for(int i=0;i<adjmat.get(a).size();i++){
                if(!v[adjmat.get(a).get(i)]){
                    v[adjmat.get(a).get(i)] = true;
                    q.add(adjmat.get(a).get(i));
                    dist.add(d+1);
                    if(max2<d+1){
                        max2 = d+1;
                        v2 = adjmat.get(a).get(i);
                    }
                }
            }
        }
        return new int[]{v1,v2,max2};
    }

    static class Pair implements Comparable<Pair> {
        int x;
        int y;

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

        public int compareTo(Pair p) {
            if(p.y==this.y)Long.compare(x,p.x);
            return Long.compare(y, p.y);
        }

        static class Scanner {
            StringTokenizer st;
            BufferedReader br;

            public Scanner(FileReader r) {
                br = new BufferedReader(r);
            }

            public Scanner(InputStream s) {
                br = new BufferedReader(new InputStreamReader(s));
            }

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

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

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

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

            public double nextDouble() throws IOException {
                String x = next();
                StringBuilder sb = new StringBuilder("0");
                double res = 0, f = 1;
                boolean dec = false, neg = false;
                int start = 0;
                if (x.charAt(0) == '-') {
                    neg = true;
                    start++;
                }
                for (int i = start; i < x.length(); i++)
                    if (x.charAt(i) == '.') {
                        res = Long.parseLong(sb.toString());
                        sb = new StringBuilder("0");
                        dec = true;
                    } else {
                        sb.append(x.charAt(i));
                        if (dec)
                            f *= 10;
                    }
                res += Long.parseLong(sb.toString()) / f;
                return res * (neg ? -1 : 1);
            }

            public boolean ready() throws IOException {
                return br.ready();

            }
        }
    }
}