Dice#2373

Dice

3 seconds
256 megabytes
Easy

Feadagor enjoys playing tabletop role-playing games. He recently found a new game and wants to play it with his friends. Unfortunately, he cannot invite them right now because the game requires an unusual set of dice. According to the game description, there must be dice, and the -th die must have a_i faces. Each die must be shaped so that all faces have an equal probability of appearing.

According to the game rules, the numbers from to , where m = a_1 + a_2 + \dots + a_n, must be distributed over all the faces so that each number in this range is used exactly once. The arrangement must be chosen so that when all dice are rolled simultaneously, the mathematical expectation of the sum of the resulting numbers is maximized.

The rules say that only the Maiar are wise enough to arrange the numbers properly (and therefore your only option is to buy the dice for dollars; telepathy is quite expensive these days). But maybe there is a simpler way to find the optimal arrangement?

Input

The first line contains a single integer (1 \leq n \leq 1000). The second line contains integers a_1, a_2, \ldots, a_n (1 \leq a_i \leq 100).

Output

Output the maximal possible expectation — a real number with exactly digits after the decimal point.

Then output lines describing the arrangement of the numbers: the -th line must contain a_i integers corresponding to the numbers to be written on the faces of the -th die.

Examples

Example 1

Loading
Loading