#icpc2014autumnc. [icpc2014autumn_c]Speedrun

[icpc2014autumn_c]Speedrun

MathJax.Hub.Config({ tex2jax: { inlineMath: [["","",""], ["\\(","\\)"]], processEscapes: true }}); blockquote { font-family: Menlo, Monaco, "Courier New", monospace; color: #333333; display: block; padding: 8.5px; margin: 0 0 9px; font-size: 12px; line-height: 18px; background-color: #f5f5f5; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.15); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; white-space: pre; white-space: pre-wrap; word-break: break-all; word-wrap: break-word; }

Problem Statement

Infinite Chronicle -Princess Castle- is a simple role-playing game. There are n+1n + 1 checkpoints, numbered 00 through nn, and for each i=1,2,ldots,ni = 1, 2, \\ldots, n, there is a unique one-way road running from checkpoint i1i - 1 to ii. The game starts at checkpoint 00 and ends at checkpoint nn. Evil monsters will appear on the roads and the hero will have battles against them. You can save your game progress at any checkpoint; if you lose a battle, you can restart the game from the checkpoint where you have saved for the last time. At the beginning of the game, the progress is automatically saved at checkpoint 00 with no time.

Rabbit Hanako is fond of this game and now interested in speedrunning. Although Hanako is an expert of the game, she cannot always win the battles because of random factors. For each ii, she estimated the probability p_ip\_i to win all the battles along the road from checkpoint i1i - 1 to ii. Everytime she starts at checkpoint i1i - 1, after exactly one miniutes, she will be at checkpoint ii with probability p_ip\_i and where she saved for the last time with probability 1p_i1 - p\_i.

What puzzles Hanako is that it also takes one minute (!) to save your progress at a checkpoint, so it might be a good idea to pass some checkpoints without saving in order to proceed quickly. The task is to compute the minimum possible expected time needed to complete the game.


Input

The input consists of multiple datasets. The number of datasets is no more than 5050. Each dataset has two lines: the first line contains an integer nn (1lenle1051 \\le n \\le 10^5), representing the number of roads, and the second line contains nn numbers p_1,p_2,ldots,p_np\_1, p\_2, \\ldots, p\_n (0ltp_ile10 \\lt p\_i \\le 1), representing the winning probabilities. Each p_ip\_i has exactly two digits after the decimal point. The end of input is denoted as a line containing only a single zero.

Output

For each dataset, display the minimum expected time in minutes with a relative error of at most 10810^{-8} in a line.


Sample Input

2
0.50 0.40
2
0.70 0.60
4
0.99 1.00 1.00 0.01
0```

### Output for the Sample Input

```plain
5.5000000000
4.0476190476
104.0101010101```

* * *

### Source Name

JAG Practice Contest for ACM-ICPC Asia Regional 2014

* * *