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 Solution{
    InputStream is;
    static PrintWriter out;
    String INPUT = "";
    static long mod = (long)1e9+7L;
    static class Edge implements Comparable<Edge>{
        int u, v;
        Edge(int a, int b){
            u = a; v = b;
        }
        public int compareTo(Edge e){
            return this.v - e.v;
        }
        public String toString(){
            return "("+u+","+v+")";
        }
    }
    public void solve(){
        int n = ni();
        LinkedList<Edge> degree = new LinkedList<Edge>();
        for(int i = 0; i < n; i++){
            degree.add(new Edge(i+1, ni()));
        }
        Collections.sort(degree, Collections.reverseOrder());
        LinkedList<Edge> ans = new LinkedList<Edge>();

        int dia = -1, ct1 = 0;
        for(int i = 0; i < n; i++){
            Edge node = degree.get(i);
            if(node.v == 1 && ct1 < 2){
                ct1 +=1;
                dia+=1;
            }
            else if(node.v == 1 && ct1 == 2){
                break;
            }
            else if(node.v > 1){
                dia+=1;
            }
        }
        LinkedList<Edge> newd = new LinkedList<Edge>();

        int i;
        for(i = 1; i < n; i++){
            Edge prev = degree.get(i-1);
            Edge curr = degree.get(i);
        
            if(prev.v > 0 && curr.v > 0){
                ans.add(new Edge(prev.u, curr.u));
                prev.v -= 1;
                curr.v -= 1;
            }
            else{
                break;
            }
        }

        int j = i, k=0;
        for(; j < n; j++ ){
            Edge curr = degree.get(j);
            if(curr.v == 0)continue;
            if(k == i){
                break;
            }
            Edge prev = degree.get(k);
            if(prev.v == 0){
                k+=1;
                j-=1;
                continue;
            }

            if(prev.v > 0 && curr.v > 0){
                ans.add(new Edge(prev.u, curr.u));
                prev.v -= 1;
                curr.v -= 1;
            }
        }

        if(j == n){
            out.println("YES "+dia);
            out.println(ans.size());
            for(Edge edge : ans){
                out.println(edge.u +" "+ edge.v);
            }
        }
        else{
            out.println("NO");
        }

    }
    

    void run(){
        is = new DataInputStream(System.in);
        out = new PrintWriter(System.out);
        int t=1;while(t-->0)solve();
        out.flush();
    }
    public static void main(String[] args)throws Exception{new Solution().run();}
    long mod(long v, long m){if(v<0){long q=(Math.abs(v)+m-1L)/m;v=v+q*m;}return v%m;}
    long mod(long v){if(v<0){long q=(Math.abs(v)+mod-1L)/mod;v=v+q*mod;}return v%mod;}
    //Fast I/O code is copied from uwi code.
    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;
    private 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++];
    }
    private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
    private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
    private double nd() { return Double.parseDouble(ns()); }
    private char nc() { return (char)skip(); }
    private String ns(){
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    private char[] ns(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);
    }
    private char[][] nm(int n, int m){
        char[][] map = new char[n][];
        for(int i = 0;i < n;i++)map[i] = ns(m);
        return map;
    }
    private int[] na(int n){
        int[] a = new int[n];
        for(int i = 0;i < n;i++)a[i] = ni();
        return a;
    }
    private int ni(){
        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 * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }
    private long nl(){
        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 * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }
    static  int i(long x){return (int)Math.round(x);}
    static class Pair implements Comparable<Pair>{
        long fs,sc;
        Pair(long a,long b){
            fs=a;sc=b;
        }
        public int compareTo(Pair p){
            if(this.fs>p.fs)return 1;
            else if(this.fs<p.fs)return -1;
            else{
                return i(this.sc-p.sc);
            }
            //return i(this.sc-p.sc);
        }
        public String toString(){
            return "("+fs+","+sc+")";
        }   
    }
    
}