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:
/**
 * Created by Aminul on 11/28/2018.
 */

import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class D {
    public static void main(String[] args)throws Exception {
        FastReader in = new FastReader(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        n = in.nextInt();
        a = new int[n+1];
        g = genList(n+1);
        G = genList(n+1);
        ones = new ArrayDeque<>();
        general = new PriorityQueue<>();
        long sum = 0;
        for (int i = 1; i <= n; i++) {
            a[i] = in.nextInt();
            if(a[i] == 1) ones.add(new Pair(a[i], i));
            else general.add(new Pair(a[i], i));
            sum += a[i];
        }
        if(sum < (n-1)*2) {
            pw.println("NO"); pw.close(); return;
        }

        if(!ones.isEmpty()) {
            a[ones.peek().s]++;
            dfs(root = ones.poll().s, 0);
        }
        else {
            a[general.peek().s]++;
            dfs(root = general.poll().s, 0);
        }

        pw.println("YES "+diameter());
        pw.println(n-1);
        for (int i = 1; i <= n; i++) {
            for(int v: g[i]) {
                pw.println(i+" "+v);
            }
        }
          
        pw.close();
    }

    static PriorityQueue<Pair> general;
    static Queue<Pair> ones;
    static int n, a[], root, maxLevel = 0;

    static void dfs(int u, int l) {
        maxLevel = max(maxLevel, l);
        if(general.isEmpty() && ones.isEmpty()) return;
        for(int i = 0; i < a[u] - 1; i++) {
            if(!general.isEmpty()) {
                int v = general.poll().s;
                g[u].add(v);
                    G[u].add(v); G[v].add(u);
                dfs(v, l+1);
            }
            else if(!ones.isEmpty()) {
                int v = ones.poll().s;
                g[u].add(v);
                    G[u].add(v); G[v].add(u);
                dfs(v, l+1);
            }
            else return;
        }
    }


    static List<Integer> g[], G[];

    static int diameter() {
        int vis[] = bfs(root);
        int x = root;
        for(int i = 1; i <= n; i++) {
            if(vis[x] < vis[i]) x = i;
        }
        vis = bfs(x);
        int max = 0;
        for(int i : vis) max = max(max, i);
        return max;
    }

    static int[] bfs(int source){
        int vis[] = new int[n+1], inf = -1;
        Arrays.fill(vis, inf);
        Queue<Integer> q = new ArrayDeque<>();
        q.add(source); vis[source] = 0;
        while (!q.isEmpty()){
            int p = q.poll();
            for(int u : G[p]){
                if(vis[u] != inf) continue;
                vis[u] = 1 + vis[p];
                q.add(u);
            }
        }
        return vis;
    }

    static <T>List<T>[] genList(int n){
        List<T> list[] = new List[n];
        for(int i = 0; i < n; i++) list[i] = new ArrayList<T>();
        return list;
    }

    static class Pair implements Comparable<Pair> {
        int f, s;

        Pair(int F, int S) {
            f = F;
            s = S;
        }

        public int compareTo(Pair p) {
            if (f == p.f) return s - p.s;
            return f - p.f;
        }

        public String toString() {
            return f + " " + s;
        }
    }

    static void debug(Object...obj) {
        System.err.println(Arrays.deepToString(obj));
    }

    static class FastReader {
        InputStream is;
        private byte[] inbuf = new byte[1024];
        private int lenbuf = 0, ptrbuf = 0;

        public FastReader(InputStream is) {
            this.is = is;
        }

        public int readByte() {
            if (lenbuf == -1) throw new InputMismatchException();
            if (ptrbuf >= lenbuf) {
                ptrbuf = 0;
                try {
                    lenbuf = is.read(inbuf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (lenbuf <= 0) return -1;
            }
            return inbuf[ptrbuf++];
        }

        public boolean isSpaceChar(int c) {
            return !(c >= 33 && c <= 126);
        }
        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

        public int skip() {
            int b;
            while ((b = readByte()) != -1 && isSpaceChar(b)) ;
            return b;
        }

        public String next() {
            int b = skip();
            StringBuilder sb = new StringBuilder();
            while (!(isSpaceChar(b))) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }



        public String nextLine() {
            int c = skip();
            StringBuilder sb = new StringBuilder();
            while (!isEndOfLine(c)){
                sb.appendCodePoint(c);
                c = readByte();
            }
            return sb.toString();
        }

        public int nextInt() {
            int num = 0, b;
            boolean minus = false;
            while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            while (true) {
                if (b >= '0' && b <= '9') {
                    num = (num << 3) + (num << 1) + (b - '0');
                } else {
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }

        public long nextLong() {
            long num = 0;
            int b;
            boolean minus = false;
            while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
            if (b == '-') {
                minus = true;
                b = readByte();
            }

            while (true) {
                if (b >= '0' && b <= '9') {
                    num = (num << 3) + (num << 1) + (b - '0');
                } else {
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public char[] next(int n) {
            char[] buf = new char[n];
            int b = skip(), p = 0;
            while (p < n && !(isSpaceChar(b))) {
                buf[p++] = (char) b;
                b = readByte();
            }
            return n == p ? buf : Arrays.copyOf(buf, p);
        }

        public char readChar() {
            return (char) skip();
        }
    }
}