#include <bits/stdc++.h>
inline int read() {
  int r = 0, f = 0;
  char c;
  while (!isdigit(c = getchar())) f |= (c == '-');
  while (isdigit(c)) r = (r << 1) + (r << 3) + (c ^ 48), c = getchar();
  return f ? -r : r;
}
inline int min(int a, int b) { return a < b ? a : b; }
int n, m, cnt[101101], Max[101101];
double ans, f[101101][111], c[101101 * 5][11];
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    cnt[i] = Max[i] = read();
    f[i][cnt[i]] = 1.000;
    ans += f[i][0];
  }
  for (int i = 0; i <= 500100; i++) {
    c[i][0] = 1.000;
    for (int j = 1; j <= min(i, 5); j++)
      c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
  }
  m = read();
  for (int i = 1; i <= m; i++) {
    int u = read(), v = read(), k = read();
    ans -= f[u][0];
    for (int j = 0; j <= Max[u]; j++) {
      double s = 0;
      for (int a = j; a <= min(j + k, cnt[u]); a++)
        s += f[u][a] * c[a][a - j] * c[cnt[u] - a][k - (a - j)];
      f[u][j] = s / c[cnt[u]][k];
    }
    ans += f[u][0];
    cnt[u] -= k;
    cnt[v] += k;
    printf("%.12lf\n", ans);
  }
  return 0;
}
