#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int ans = 0;
  bool flag = false;
  char c = getchar();
  while ((c > '9' || c < '0') && c != '-') c = getchar();
  if (c == '-') c = getchar(), flag = false;
  while (c <= '9' && c >= '0') {
    ans = (ans << 3) + (ans << 1) + int(c - '0');
    c = getchar();
  }
  if (flag) return (~ans) + 1;
  return ans;
}
struct Edge {
  int v;
  Edge* next;
} pool[100000], *h[100005];
int tot = 0, fa[100005], n;
double P[100005];
void addEdge(int u, int v) {
  Edge* p = &pool[++tot];
  p->v = v;
  p->next = h[u];
  h[u] = p;
}
void dfs(int u, int father) {}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lf", &P[i]);
  for (int i = 1; i <= n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    addEdge(u + 1, v + 1);
    addEdge(v + 1, u + 1);
  }
  P[0] = 1;
  return 0;
}
