#include <bits/stdc++.h>
using namespace std;
const int N_MAX = 2e5;
int n, t[N_MAX], h[N_MAX], p[N_MAX], s[N_MAX], nxt = 0;
vector<int> G[N_MAX];
long long dp[N_MAX][2], diff[N_MAX + 1];
void DFS(int u) {
  for (int v : G[u]) {
    if (p[v] == -1) {
      p[v] = u;
      DFS(v);
    }
  }
  s[nxt++] = u;
}
long long extra(int in, int out) { return in + out - min(in, out); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> t[i];
  for (int i = 0; i < n; i++) cin >> h[i];
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  for (int i = 0; i < n; i++) p[i] = -1;
  p[0] = 0;
  DFS(0);
  for (int u = 1; u < n; u++) {
    int i = 0;
    while (G[u][i] != p[u]) i++;
    swap(G[u][i], G[u].back());
    G[u].pop_back();
  }
  for (int uid = 0; uid < n; uid++) {
    int u = s[uid];
    int in = 0, out = 0, eq = 0;
    long long ans = 0;
    for (int v : G[u]) {
      if (h[u] > h[v]) {
        in++;
        ans += dp[v][0];
      } else if (h[u] < h[v]) {
        out++;
        ans += dp[v][1];
      } else {
        in++;
        ans += dp[v][0];
        diff[eq++] = dp[v][1] - dp[v][0];
      }
    }
    sort(diff, diff + eq);
    dp[u][0] = 1e17, dp[u][1] = 1e17;
    for (int i = 0; i <= eq; i++) {
      if (u == 0)
        dp[u][0] = min(dp[u][0], ans + extra(in, out) * t[u]);
      else {
        dp[u][0] = min(dp[u][0], ans + extra(in, out + 1) * t[u]);
        dp[u][1] = min(dp[u][1], ans + extra(in + 1, out) * t[u]);
      }
      ans += diff[i];
      in--;
      out++;
    }
  }
  cout << dp[0][0] << "\n";
  return 0;
}
