This page is still under construction.

Parts of this page are still being built. What you see may change.

A1 Paper

Time limit1sMemory limit256 MB

Summary
Combine the given smaller sheets into one A1 sheet with the least tape, or report impossible.
Level

Medium6 of 10

Topics
Greedy, Math
Solved
No attempts yet

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 2−5/42^{-5/4} meters by 2−3/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 (2≤n≤302 \le n \le 30).

The second line contains n−1n-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.

Examples4

  1. Example 1

    Input
    2
    2
    
    Expected output
    0.594604
    
  2. Example 2

    Input
    4
    1 0 5
    
    Expected output
    1.609655
    
  3. Example 3

    Input
    3
    0 3
    
    Expected output
    impossible
    
  4. Example 4

    Input
    2
    1
    
    Expected output
    impossible