#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500100;
int n, num[100100], q, now[100100], u, v, k;
double f[100100][110], c[500500][10], res, ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%d", now + i), num[i] = now[i], f[i][num[i]] = 1, res += f[i][0];
  for (int i = 0; i <= MAXN; i++) c[i][0] = 1;
  for (int i = 1; i <= MAXN; i++)
    for (int j = 1; j <= min(i, 5); j++)
      c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
  scanf("%d", &q);
  while (q--) {
    scanf("%d%d%d", &u, &v, &k);
    res -= f[u][0];
    for (int i = 0; i <= num[u]; i++) {
      ans = 0;
      for (int j = i; j <= min(now[u], i + k); j++)
        ans += f[u][j] * c[j][j - i] * c[now[u] - j][k - j + i];
      f[u][i] = ans / c[now[u]][k];
    }
    res += f[u][0], now[u] -= k, now[v] += k;
    printf("%.9lf\n", res);
  }
  return 0;
}
