#include <bits/stdc++.h>
using namespace std;
int n, m;
int now[100010], a[100010];
double ans;
double f[100010][110], c[500010][7];
int read() {
  int r = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c <= '9' && c >= '0') r = (r << 1) + (r << 3) + c - '0', c = getchar();
  return r * f;
}
void put(int x) {
  if (x < 0) {
    putchar('-');
  }
  if (x > 9) put(x / 10);
  putchar(x % 10 + '0');
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++)
    now[i] = a[i] = read(), f[i][now[i]] = 1, ans += f[i][0];
  m = read();
  for (int i = 0; i <= 500000; i++) c[i][0] = 1;
  c[1][1] = 1;
  for (int i = 2; i <= 500000; i++)
    for (int j = 1; j <= 5; j++) c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
  while (m--) {
    int u = read(), v = read(), w = read();
    ans -= f[u][0];
    for (int j = 0; j <= a[u]; j++) {
      double sum = 0;
      for (int k = j; k <= min(j + w, now[u]); k++)
        sum += f[u][k] * c[k][k - j] * c[now[u] - k][w - (k - j)];
      f[u][j] = 1.0 * sum / c[now[u]][w];
    }
    now[u] -= w, now[v] += w, ans += f[u][0];
    printf("%.9lf\n", ans);
  }
  return 0;
}
