#include <bits/stdc++.h>
using namespace std;
struct timer {
  time_t start;
  timer() { start = clock(); }
  ~timer() {
    cerr << 1. * (clock() - start) / CLOCKS_PER_SEC << " secs" << endl;
  }
};
int n, a[100010];
double dp[100010][101];
double nCr[501000][6];
int b[100010];
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  for (int i = 0; i < (501000); i++) {
    nCr[i][0] = 1;
    for (int j = 1; j < (6); j++) {
      nCr[i][j] = nCr[i][j - 1] * (i + 1 - j) / j;
    }
  }
  cin >> n;
  double ans = 0;
  for (int i = 0; i < (n); i++) {
    cin >> a[i];
    if (a[i] == 0) ans++;
    b[i] = a[i];
    dp[i][a[i]] = 1;
  }
  int q, u, v, K;
  cin >> q;
  double dp2[101];
  for (int ii = 0; ii < (q); ii++) {
    cin >> u >> v >> K;
    u--;
    v--;
    memset(dp2, 0, sizeof(dp2));
    for (int i = 0; i < (a[u] + 1); i++)
      if (dp[u][i]) {
        for (int j = 0; j < (min(i, K) + 1); j++) {
          dp2[i - j] +=
              dp[u][i] * nCr[i][j] * nCr[b[u] - i][K - j] / nCr[b[u]][K];
        }
      }
    ans += dp2[0] - dp[u][0];
    cout << setprecision(12) << ans << endl;
    for (int i = 0; i < (a[u] + 1); i++) dp[u][i] = dp2[i];
    b[u] -= K;
    b[v] += K;
  }
}
