#include <bits/stdc++.h>
using namespace std;
const int tope = 100001;
int n;
int a[tope];
double p[tope][101];
double pnext[101];
double fact(int n) {
  if (n == 0) return 1;
  return fact(n - 1) * n;
}
double combi(int n, int k) {
  double val = 1;
  for (int i = 0; i < k; i++) val *= n - i;
  return val / fact(k);
}
int main() {
  ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(12);
  cin >> n;
  double suma = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > 0) suma += 1;
    for (int j = 0; j < 101; j++) p[i][j] = 0;
    p[i][a[i]] = 1;
  }
  int q;
  cin >> q;
  for (int caso = 0; caso < q; caso++) {
    int u, v, k;
    cin >> u >> v >> k;
    u--;
    v--;
    int nu = a[u];
    double pant = 0;
    for (int j = 1; j < 101; j++) pant += p[u][j];
    for (int j = 0; j < 101; j++) pnext[j] = 0;
    double combik = combi(nu, k);
    for (int j = 0; j < 101 and j <= nu; j++) {
      int k1 = max(0, k - (nu - j));
      int k2 = k - k1;
      double combik1 = combi(j, k1);
      double combik2 = combi(nu - j, k2);
      for (; k1 <= k and k1 <= j and k2 >= 0; k1++, k2--) {
        pnext[j - k1] += p[u][j] * combik1 * combik2 / combik;
        combik1 *= double(j - k1) / (k1 + 1);
        combik2 *= double(k2) / (nu - j - k2 + 1);
      }
    }
    for (int j = 0; j < 101; j++) p[u][j] = pnext[j];
    double pne = 0;
    for (int j = 1; j < 101; j++) pne += p[u][j];
    suma += pne - pant;
    cout << n - suma << endl;
    a[u] -= k;
    a[v] += k;
  }
}
