#include <bits/stdc++.h>
using namespace std;
double p[100010][101];
double u[101], v[101];
int d[100010], dd[100010];
double g(int n, int k) {
  int i;
  double re = 1;
  for (i = 0; i < k; i++) {
    re = re * (n - i) / (i + 1);
  }
  return re;
}
double f(int a, int b, int m, int c) {
  if (m - c > b || c > a || m > a + b) return 0;
  return g(a, c) * g(b, m - c) / g(a + b, m);
}
int main() {
  int n, m, x, y, z, i, j;
  double ans = 0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &x);
    dd[i] = d[i] = x;
    p[i][x] = 1;
    if (x == 0) ans++;
  }
  scanf("%d", &m);
  while (m--) {
    scanf("%d%d%d", &x, &y, &z);
    int ddd = min(dd[x], d[x]);
    for (i = 0; i <= ddd; i++) {
      u[i] = p[x][i];
      v[i] = 0;
    }
    for (i = 0; i <= ddd; i++) {
      for (j = 0; j <= z && j <= i; j++) {
        v[i - j] += u[i] * f(i, d[x] - i, z, j);
      }
    }
    ans += v[0] - u[0];
    for (i = 0; i <= ddd; i++) {
      p[x][i] = v[i];
    }
    d[y] += z;
    d[x] -= z;
    printf("%.10f\n", ans);
  }
  return 0;
}
