#include <bits/stdc++.h>
using namespace std;
int n, p, u, v, k, a[100010];
double sum, dp[100010][110], c[1000010][6];
int main() {
  c[0][0] = 1.0;
  for (int i = 1; i <= 1000000; i++) {
    c[i][0] = 1.0;
    for (int j = 1; j <= min(5, i); j++)
      c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
  }
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    dp[i][a[i]] = 1.0;
    sum += (a[i] == 0);
  }
  cin >> p;
  for (int ii = 0; ii < p; ii++) {
    cin >> u >> v >> k;
    u--;
    v--;
    double ndp[110] = {0.0};
    for (int i = 0; i < min(a[u] + 1, 101); i++) {
      for (int j = i; j <= min(a[u], i + k); j++) {
        ndp[i] += dp[u][j] * c[j][j - i] * c[a[u] - j][k - j + i] / c[a[u]][k];
      }
    }
    sum += ndp[0] - dp[u][0];
    for (int i = 0; i < 101; i++) dp[u][i] = ndp[i];
    a[u] -= k;
    a[v] += k;
    printf("%.10lf\n", sum);
  }
}
