eolymp
bolt
Try our new interface for solving problems

Dice

Time limit 3 seconds
Memory limit 256 MiB

Along with other things, Feadagor is fond of playing tabletop role playing games. He has just discovered a new game and he'd like to play it with his friends. Unluckily, he cannot call his friends right now, as the game requires quite an unusual set of dice. The description of the game says that there must be n dice, and i-th dice must have a_i faces. Each dice must be shaped so its faces fall equiprobably.

According to the game manual, the numbers from 1 to m, where m = , must be written on the faces, and each number from the interval must be used exactly once. The numbers arrangement must be chosen so that if you throw all the dice simultaneously, then the mathematical expectation E of the total value in such experiment will be maximal.

The manual says that only Maiar have enough wisdom to arrange the numbers properly (and therefore your only choice is to buy the dice just for 133 dollars, telepathy is quite expensive now). But maybe there is a simpler way to make the proper arrangement?

Input data

The first line of the input file contains a single integer number n (1 n1000). The following line contains n integer numbers a_1, a_2 ... a_n (1a_i100).

Output data

The first line of the output file must contain maximal possible expectation E - a floating-point number precise up to 5 digits after the decimal point.

The following n lines must contain the numbers arrangement: i-th line must contain a_i integer numbers - the numbers to be written on the faces of i-th dice.

Examples

Input example #1
2
1 4
Output example #1
7.500000
5
4 3 2 1