#include <bits/stdc++.h>

#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

typedef long double ld; 
const ld INF = 1e+12;

int main() {
  while(1){
    int n;
    cin>>n;
    if(!n)break;
    vector<ld> p(n),p2;
    REP(i,n) cin>>p[i];
    int l = 0;
    vector<int> len;
    p2.push_back(1);
    REP(i,n) {
      if (p[i] != 1) {
        len.push_back(l);
        p2.push_back(p[i]);
        l = 0;
      }
      ++l;
    }
    len.push_back(l);
    n = p2.size();
    vector<ld> dp(n+1,INF);
    dp[0] = 0;
    REP(i,n) {
      ld e = 0.0;
      REP(j,100) {
        if(i+j>=n)break;
        e = e + len[i+j] + (e+1) * (1-p2[i+j]) / p2[i+j];
        dp[i+j+1] = min(dp[i+j+1], dp[i] + e + 1);
      }
    }
    cout << setprecision(10) << fixed;
    cout << dp[n] - 1 << endl;
  }
  return 0;
}