#include <bits/stdc++.h>
using namespace std;
double c[101010 * 5][6];
int a[101010], b[101010];
double dp[101010][101];
int main() {
  for (int i = 0; i < 101010 * 5; i++) {
    for (int j = 0; j < 6; j++) {
      if (i == j || j == 0)
        c[i][j] = 1;
      else
        c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
    }
  }
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  double ans = 0;
  for (int i = 1; i <= n; i++) {
    b[i] = a[i];
    dp[i][a[i]] = 1;
    if (!a[i]) ans += 1;
  }
  int q, u, v, k;
  for (scanf("%d", &q); q--;) {
    scanf("%d%d%d", &u, &v, &k);
    double *d = dp[u];
    ans -= d[0];
    for (int i = 0; i <= a[u]; i++) {
      d[i] = d[i] * c[b[u] - i][k] / c[b[u]][k];
      for (int j = 1, ed = min(k, min(a[u], b[u]) - i); j <= ed; j++) {
        d[i] += d[j + i] * c[i + j][j] / c[b[u]][k] * c[b[u] - i - j][k - j];
      }
    }
    b[u] -= k;
    b[v] += k;
    ans += d[0];
    printf("%.10lf\n", ans);
  }
  return 0;
}
