#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const int MAXN = 1e6 + 7;
const long double EPS = 1e-8;
int n;
vector<vector<int> > data;
vector<int> my, sons, f;
void dfs(int vertex, int last) {
  f[vertex] = last;
  for (int i = 0; i < data[vertex].size(); i++) {
    int to = data[vertex][i];
    if (to == last) continue;
    sons[vertex] += my[to];
    dfs(to, vertex);
  }
}
int read() {
  string x;
  cin >> x;
  int A = 0;
  for (int i = 0; i < x.size(); i++) {
    if (x[i] == '.') continue;
    A *= 10;
    A += (x[i] - '0');
  }
  return A;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  data.resize(n), my.resize(n), sons.resize(n, 0.), f.resize(n);
  for (int i = 0; i < n; i++) {
    my[i] = read();
  }
  for (int i = 0; i < n; i++) my[i] = 100 - my[i];
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    data[a].push_back(b);
    data[b].push_back(a);
  }
  dfs(0, -1);
  int ans = 0;
  for (int i = 0; i < n; i++) ans += my[i] * (100 - sons[i]);
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int a;
    cin >> a;
    int x = read();
    x = 100 - x;
    int old = my[a] * (100 - sons[a]);
    int F = f[a];
    if (F != -1) old += my[F] * (100 - sons[F]);
    if (F != -1) sons[F] += x - my[a];
    my[a] = x;
    int nw = my[a] * (100 - sons[a]);
    if (F != -1) nw += my[F] * (100 - sons[F]);
    ans += nw - old;
    cout << ans / 10000 << "." << ans % 10000 << "\n";
  }
}
