#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 7;
int n, m, A[N], B[N];
long long C[1007][1007];
double Ret, Ans, Dp[N][300];
inline void Init() {
  for (int i = (0), iLimit = (1000); i <= iLimit; (++(i)))
    for (int j = (0), jLimit = (i); j <= jLimit; (++(j)))
      if (j == 0 || j == i)
        C[i][j] = 1;
      else
        C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
}
int main() {
  Init();
  scanf("%d", &n);
  for (int i = (1), iLimit = (n); i <= iLimit; (++(i)))
    scanf("%d", A + i), B[i] = A[i], Dp[i][A[i]] = 1, Ans += Dp[i][0];
  int u, v, w;
  scanf("%d", &m);
  for (int q = (1), qLimit = (m); q <= qLimit; (++(q))) {
    scanf("%d%d%d", &u, &v, &w);
    Ans -= Dp[u][0];
    for (int i = (0), iLimit = (A[u]); i <= iLimit; (++(i))) {
      Ret = 0;
      for (int j = (0), jLimit = (w); j <= jLimit; (++(j)))
        if (B[u] >= i + j)
          Ret +=
              Dp[u][i + j] * C[i + j][j] * C[B[u] - i - j][w - j] / C[B[u]][w];
      Dp[u][i] = Ret;
    }
    B[u] -= w, B[v] += w, Ans += Dp[u][0];
    printf("%.10lf\n", Ans);
  }
  return 0;
}
