func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, first[200050], nxt[200050], to[200050], tot;   void add(int x, int y) { nxt[++tot] = first[x], first[x] = tot, to[tot] = y; }   double w[200050], ans, sum[200050];   int fa[200050];   void dfs(int u, int f) {     ans += w[f] * (1 - w[u]);     for (int i = first[u]; i; i = nxt[i]) {       int t = to[i];       if (t == f) continue;       fa[t] = u;       sum[u] += (1 - w[t]);       dfs(t, u);     }   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %lf , &w[i]);     }     for (int i = 1; i < n; i++) {       int x, y;       scanf( %d%d , &x, &y);       x++;       y++;       add(x, y);       add(y, x);     }     w[0] = 1;     dfs(1, 0);     scanf( %d , &m);     while (m--) {       int u;       double v;       scanf( %d%lf , &u, &v);       u++;       ans -= (1 - w[u]) * w[fa[u]];       ans -= w[u] * sum[u];       sum[fa[u]] -= (1 - w[u]);       w[u] = v;       sum[fa[u]] += (1 - w[u]);       ans += w[u] * sum[u];       ans += (1 - w[u]) * w[fa[u]];       printf( %0.5lf n , ans);     }     return 0;   }   