#include <bits/stdc++.h>
using namespace std;
int read() {
  int q = 0;
  char ch = ' ';
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch >= '0' && ch <= '9') q = q * 10 + ch - '0', ch = getchar();
  return q;
}
const int N = 100005;
double P[N][110], ans;
int n, m, a[N], b[N];
double C(int d, int u) {
  if (d < u || d < 0 || u < 0) return 0;
  double ans = 1;
  for (register int i = d - u + 1; i <= d; ++i) ans *= i;
  for (register int i = 1; i <= u; ++i) ans /= i;
  return ans;
}
int main() {
  n = read();
  for (register int i = 1; i <= n; ++i)
    a[i] = b[i] = read(), P[i][a[i]] = 1, ans += (a[i] == 0);
  m = read();
  while (m--) {
    int x = read(), y = read(), k = read();
    ans -= P[x][0];
    for (register int i = 0; i <= a[x]; ++i) {
      double tmp = 0, all = C(b[x], k);
      for (register int j = 0; j <= k; ++j)
        tmp += P[x][i + j] * C(b[x] - i - j, k - j) * C(i + j, j);
      P[x][i] = tmp / all;
    }
    ans += P[x][0], b[x] -= k, b[y] += k;
    printf("%.10lf\n", ans);
  }
  return 0;
}
