#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int a[MAXN], b[MAXN], n;
double f[MAXN][110], c[1510][1510], ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%d", &a[i]), b[i] = a[i], f[i][a[i]] = 1.00, ans += f[i][0];
  for (int i = 0; i <= 1500; i++) c[i][0] = 1;
  for (int i = 1; i <= 1500; i++)
    for (int j = 1; j <= i; j++) c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
  int m;
  scanf("%d", &m);
  while (m--) {
    int u, v, k;
    scanf("%d %d %d", &u, &v, &k);
    ans -= f[u][0];
    for (int i = 0; i <= a[u]; i++) {
      double tmp = 0;
      for (int j = 0; j <= k && j + i <= b[u]; j++)
        tmp += f[u][i + j] * (double)c[i + j][j] * c[b[u] - i - j][k - j] /
               c[b[u]][k];
      f[u][i] = tmp;
    }
    b[u] -= k;
    b[v] += k;
    ans += f[u][0];
    printf("%.9lf\n", ans);
  }
  return 0;
}
