#include <bits/stdc++.h>
using namespace std;
double C(int a, int b) {
  double x = 1.0L;
  for (int i = 1; i <= b; ++i) x = x * a-- / i;
  return x;
}
long double p[100005][105], tmp[155];
int a[100005], init[100005];
long double res;
int main() {
  int n, u, v, k, q;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    p[i][init[i] = a[i] = x] = 1.0;
    if (!a[i]) res += 1;
  }
  scanf("%d", &q);
  for (int tr = 0; tr < q; tr++) {
    scanf("%d %d %d", &u, &v, &k);
    fill(tmp, tmp + init[u] + 5, 0.0);
    for (int i = 0; i <= init[u] && i <= a[u]; i++)
      for (int j = 0; j <= i && j <= k; j++)
        if ((a[u] - i) >= (k - j))
          tmp[i - j] += p[u][i] * C(i, j) * C(a[u] - i, k - j) / C(a[u], k);
    res += tmp[0] - p[u][0];
    for (int j = 0; j <= init[u]; j++) p[u][j] = tmp[j];
    a[u] -= k, a[v] += k;
    printf("%.15lf\n", double(res));
  }
}
