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:
//package com.company;

import java.io.*;
import java.util.*;


public class Main {
    public static class Task {
        public class Pair {
            int idx, maxDeg;

            public Pair(int idx, int maxDeg) {
                this.idx = idx;
                this.maxDeg = maxDeg;
            }
        }

        public static int diameter(List<Integer>[] tree) {
            int furthestVertex = (int) dfs(tree, 0, -1, 0);
            return (int) (dfs(tree, furthestVertex, -1, 0) >>> 32);
        }

        static long dfs(List<Integer>[] tree, int u, int p, int depth) {
            long res = ((long) depth << 32) + u;
            for (int v : tree[u])
                if (v != p)
                    res = Math.max(res, dfs(tree, v, u, depth + 1));
            return res;
        }

        public void solve(Scanner sc, PrintWriter pw) throws IOException {
            int n = sc.nextInt();
            Pair[] vertices = new Pair[n];
            for (int i = 0; i < n; i++) {
                vertices[i] = new Pair(i, sc.nextInt());
            }
            Arrays.sort(vertices, new Comparator<Pair>() {
                @Override
                public int compare(Pair o1, Pair o2) {
                    return Integer.compare(o2.maxDeg, o1.maxDeg);
                }
            });
            List<Integer>[] tree = new List[n];
            for (int i = 0; i < n; i++) {
                tree[i] = new ArrayList<>();
            }
            ArrayDeque<Pair> allow = new ArrayDeque<>();
            allow.push(vertices[0]);
            int branchIdx = 0;
            for (int i = 1; i < n; i++) {
                if (vertices[i].maxDeg >= 2) {
                     vertices[i].maxDeg -= 1;
                     vertices[branchIdx].maxDeg -= 1;
                     tree[vertices[branchIdx].idx].add(vertices[i].idx);
                     tree[vertices[i].idx].add(vertices[branchIdx].idx);
                     branchIdx = i;
                     allow.push(vertices[i]);
                } else {
                    while (true) {
                        if (allow.isEmpty() || allow.peekLast().maxDeg < 0) {
                            System.out.println("NO");
                            return;
                        }
                        if (allow.peekLast().maxDeg > 0) break;
                        allow.pollLast();
                    }
                    if (i == n - 1) {
                        vertices[i].maxDeg -= 1;
                        vertices[branchIdx].maxDeg -= 1;
                        tree[vertices[branchIdx].idx].add(vertices[i].idx);
                        tree[vertices[i].idx].add(vertices[branchIdx].idx);
                    } else {
                        vertices[i].maxDeg -= 1;
                        allow.peekLast().maxDeg -= 1;
                        tree[vertices[i].idx].add(allow.peekLast().idx);
                        tree[allow.peekLast().idx].add(vertices[i].idx);
                    }

                }
            }
            System.out.println("YES " + diameter(tree));
            System.out.println(n - 1);
            boolean[][] usedEdge = new boolean[n][n];
            for (int i = 0; i < n; i++) {
                for (int j : tree[i]) {
                    if (usedEdge[i][j]) continue;
                    System.out.println(i + 1 + " " + (j + 1));
                    usedEdge[i][j] = usedEdge[j][i] = true;
                }
            }


        }
    }

    private static long TIME_START, TIME_END;
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
//        Scanner sc = new Scanner(new FileInputStream("B-large.in"));
        PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));
//        PrintWriter pw = new PrintWriter(new FileOutputStream("Test.out"));
//        PrintWriter pw = new PrintWriter(new FileOutputStream("Test.in"));
        Runtime runtime = Runtime.getRuntime();
        long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory();
        TIME_START = System.currentTimeMillis();
        Task t = new Task();
        t.solve(sc, pw);
        TIME_END = System.currentTimeMillis();
        long usedMemoryAfter = runtime.totalMemory() - runtime.freeMemory();
        pw.close();
        System.out.println("Memory increased:" + (usedMemoryAfter-usedMemoryBefore) / 1000000 );
        System.out.println("Time used: " + (TIME_END - TIME_START) + ".");
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

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

        public Scanner(FileReader s) throws FileNotFoundException {br = new BufferedReader(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 { return Double.parseDouble(next()); }

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