#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T next_num() {
  T i = 0;
  char c;
  while (!isdigit(c = getchar()) && c != '-')
    ;
  bool flag = c == '-';
  flag ? (c = getchar()) : 0;
  while (i = i * 10 - '0' + c, isdigit(c = getchar()))
    ;
  return flag ? -i : i;
}
template <class T1, class T2>
inline void apmax(T1 &a, const T2 &b) {
  if (a < b) a = b;
}
template <class T1, class T2>
inline void apmin(T1 &a, const T2 &b) {
  if (b < a) a = b;
}
const int N = 100010, A = 110;
const long double EPS = 1e-12;
int a[N], posi[N];
long double f[N][A];
inline long double C(int n, int k) {
  if (n < k) {
    return 0;
  }
  long double ans = 1;
  for (int i = 0; i < k; i++) {
    ans *= (long double)(n - i) / (i + 1);
  }
  return ans;
}
int main() {
  int n = (next_num<int>());
  memset(f, 0, sizeof(f));
  long double ans = 0;
  for (int i = 1; i <= n; i++) {
    f[i][a[i] = posi[i] = (next_num<int>())] = 1;
    ans += f[i][0];
  }
  for (int tot = (next_num<int>()); tot--;) {
    int u = (next_num<int>()), v = (next_num<int>()), k = (next_num<int>());
    ans -= f[u][0];
    const long double div = C(a[u], k);
    for (int i = 0; i <= posi[u]; i++) {
      for (int j = min(k, i); j >= 1; j--) {
        f[u][i - j] += C(i, j) / div * C(a[u] - i, k - j) * f[u][i];
      }
      f[u][i] *= C(a[u] - i, k) / div;
    }
    a[u] -= k, a[v] += k;
    apmin(posi[u], a[u]);
    for (int &i = posi[u]; i >= 0 && f[u][i] < EPS; i--)
      ;
    printf("%.10lf\n", (double)(ans += f[u][0]));
  }
  return 0;
}
