#include <bits/stdc++.h>
using namespace std;
int Read() {
  char c;
  while (c = getchar(), (c != '-') && (c < '0' || c > '9'))
    ;
  bool neg = (c == '-');
  int ret = (neg ? 0 : c - 48);
  while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + c - 48;
  return neg ? -ret : ret;
}
const int MAXN = 100005;
int N, Q, a[MAXN], b[MAXN];
double ans, f[MAXN][105];
void init() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++)
    a[i] = b[i] = Read(), f[i][a[i]] = 1, ans += (a[i] == 0);
}
void work() {
  scanf("%d", &Q);
  for (int ca = 1; ca <= Q; ca++) {
    int u = Read(), v = Read(), w = Read();
    ans -= f[u][0];
    for (int i = 0; i <= w - 1; i++)
      for (int j = 0; j <= b[u]; j++)
        f[u][j] = f[u][j] * (a[u] - i - j) / (a[u] - i) +
                  f[u][j + 1] * (j + 1) / (a[u] - i);
    a[u] -= w, a[v] += w, printf("%.13f\n", ans += f[u][0]);
  }
}
int main() {
  init();
  work();
  return 0;
}
