Octopus#8365

Octopus

1 second
64 megabytes
Medium

Petryk recently returned from a seaside vacation, where he was captivated by the abundance of animals, especially his favorite, the octopus. Inspired, he decided to construct octopuses using his building set at home. This set includes flexible sticks that can connect disks, with each of the disks having a_i holes for inserting sticks. A stick cannot connect a disk to itself, and any two disks can be connected by at most one stick.

In Petryk's vision, an octopus is structured as follows:

An octopus can have multiple tentacles or none at all, and several tentacles can be attached to a single disk in the body. The illustration shows examples of octopuses.

Task

Help Petryk construct octopuses under the following conditions:

prb3.jpg

Input

The first line contains a single integer (1 \le n \le 10^5), representing the number of disks in Petryk's set.

The second line contains integers a_i (1 \le a_i < n), indicating the number of holes in the -th disk.

The third line contains an integer , which is if maximizing the number of octopuses is not necessary, and if it is.

Output

On the first line, print "Yes" if it's possible to assemble the octopuses, otherwise print "No". If the answer is positive, also print the number , representing the number of octopuses. Then, provide lines, each containing two integers num_i (1 \le num_i \le c) and p_i. Here, num_i is the octopus number to which disk belongs, and p_i is the number of the neighboring disk closer to the octopus body. If disk is part of the body, set p_i = -1.

Refer to the examples in the problem statement for clarity.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading

Example 3

Loading
Loading

Scoring

Sub-task

Points

Additional Restrictions

Maximization of Octopuses

Required Sub-tasks

0

0

Tests from the condition

Required

-

1

9

For all , a_i \in \{1, 3\}

Not required

-

2

13

For all , a_i \in \{1, 3\}

Required

1

3

27

-

Not required

1

4

51

-

Required

0, 1, 2, 3