#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int SUM = 0, ff = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    SUM = (SUM << 3) + (SUM << 1) + (ch ^ 48);
    ch = getchar();
  }
  return SUM * ff;
}
const int N = 100010;
const int M = 1010;
long long a[N], have[N];
double c[M][M];
int n, Q;
double ans = 0;
double dp[N][110];
int main() {
  c[0][0] = 1;
  for (int i = 1; i <= 1000; i++) {
    c[i][0] = 1;
    for (int j = 1; j <= i; j++) c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
  }
  n = read();
  for (int i = 1; i <= n; i++) {
    a[i] = read(), have[i] = a[i];
    dp[i][a[i]] = 1;
    ans += dp[i][0];
  }
  Q = read();
  while (Q--) {
    int u = read(), v = read(), k = read();
    ans -= dp[u][0];
    for (int i = 0; i <= a[u]; i++) {
      double tmp = 0;
      for (int j = 0; j <= k; j++)
        tmp += 1.0 * dp[u][i + j] * c[i + j][j] * c[have[u] - i - j][k - j] /
               c[have[u]][k];
      dp[u][i] = tmp;
    }
    ans += dp[u][0];
    have[u] -= k, have[v] += k;
    printf("%.10lf\n", ans);
  }
  return 0;
}
