Let's build a tree with the following structure: starting at the root, there is one vertex. From this vertex, A_1 edges branch out. From each of these A_1 leaves, A_2 edges emerge. Continuing this pattern, from the A_1A_2 vertices at level (where the root is level , the next A_1 vertices are level , and so on), A_3 edges emerge. This process continues up to level . The entire tree is then symmetrically mirrored, except for the level numbered , creating a lace-like structure of edges, with vertex at levels and .

Each edge connecting levels and I+1 has a uniform resistance R_i. Your task is to determine the resistance between the vertices at levels and .
The input begins with an integer (N \le 50). The next line contains integers, representing the number of edges emerging from level , level , level , and so on. Following this, there are integers, each indicating the resistance of the conductors connecting levels and , level and level , and so forth. Constraints are 1 \le A_i \le 50 and 1 \le R_i \le 100.
Output a single number representing the total resistance of the system. The result should be printed with up to decimal places, but if the desired precision is reached earlier, trailing zeros should not be included.
Example 1