A1 Paper

No attempts yetTime limit1sMemory limit256 MB

Problem

Björn likes the square root of two, 2=1.41421356\sqrt{2} = 1.41421356\ldots, so much that he decided to write its first 10000 digits on a single sheet of paper. He started on an A4 sheet and ran out of room after 1250 digits. He worked out that all the digits fit on an A1 sheet. Björn has no A1 sheet, but he has smaller sheets that he can tape together.

Taping two A2 sheets together along their long side makes an A1 sheet, and two A3 sheets make an A2 sheet. Every smaller size follows the same rule. The tape needed to join two sheets is as long as their long side. An A2 sheet is 25/42^{-5/4} meters by 23/42^{-3/4} meters, and each next size (A3, A4, ...) has the same shape with half the area of the previous one.

You are given how many sheets of each size Björn has. Find the smallest total length of tape that makes one A1 sheet.

Input

The first line contains the A-size nn of the smallest sheets Björn has (2n302 \le n \le 30).

The second line contains n1n-1 integers: the number of sheets of size A2, A3, ..., Ann in that order. Each value is between 0 and 10910^9.

Output

If Björn can make an A1 sheet, print on one line the smallest total length of tape in meters, rounded to exactly six decimal places. Otherwise print impossible.