#include <bits/stdc++.h>
using namespace std;
int n, a[100010], cnt[100010];
double prob[100010][110], ans;
double fac[10];
void Read(int &digit) {
  digit = 0;
  char c;
  for (c = getchar(); c < '0' || c > '9'; c = getchar())
    ;
  for (; c >= '0' && c <= '9'; digit = digit * 10 + c - '0', c = getchar())
    ;
}
void read() {
  ans = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    cnt[i] = a[i];
    prob[i][a[i]] = 1;
    if (a[i] == 0) ans += 1;
  }
}
double C(int a, int b) {
  double u = 1;
  for (int i = a; i > a - b; i--) u *= i;
  u /= fac[b];
  return u;
}
void work() {
  fac[0] = 1;
  for (int i = 1; i <= 5; i++) fac[i] = fac[i - 1] * i;
  int m;
  Read(m);
  for (int i = 1, u, v, s; i <= m; ++i) {
    Read(u), Read(v), Read(s);
    ans -= prob[u][0];
    int tot = cnt[u];
    double z = C(tot, s);
    double sum;
    double p;
    for (int i = 0; i <= a[u]; ++i) {
      sum = 0;
      if (s + i > tot) {
        prob[u][i] = 0;
        continue;
      }
      p = C(tot - i, s) / z;
      for (int j = i; j <= i + s; ++j) {
        sum += prob[u][j] * p;
        p = p * (j + 1) / (j - i + 1) / (tot - j) * (s - j + i);
      }
      prob[u][i] = sum;
    }
    ans += prob[u][0];
    cnt[u] -= s;
    cnt[v] += s;
    printf("%.10lf\n", ans);
  }
}
int main() {
  read();
  work();
  return 0;
}
