#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7, N = 2e5 + 7;
const long long oo = 1e18;
int t[N], h[N];
long long dp[N][3];
vector<int> G[N];
void dfs(int u, int p = 0) {
  dp[u][0] = dp[u][1] = dp[u][2] = oo;
  int cnt = 0;
  vector<int> in, out, both;
  for (int v : G[u])
    if (v != p) {
      dfs(v, u);
      cnt++;
      if (h[v] < h[u])
        in.push_back(v);
      else if (h[v] > h[u])
        out.push_back(v);
      else
        both.push_back(v);
    }
  long long ans = 0;
  int deg = 0;
  for (int v : in) {
    long long cost = oo;
    for (int i = 0; i < 3; i++)
      cost = min(cost, (i == 0 ? 0 : t[v]) + dp[v][i] + t[u]);
    ans += cost;
    deg--;
  }
  for (int v : out) {
    long long cost = oo;
    for (int i = 0; i < 3; i++)
      cost = min(cost, (i == 2 ? 0 : t[v]) + dp[v][i]);
    ans += cost;
    deg++;
  }
  vector<long long> aux;
  for (int v : both) {
    long long cost1 = oo;
    for (int i = 0; i < 3; i++)
      cost1 = min(cost1, (i == 0 ? 0 : t[v]) + dp[v][i] + t[u]);
    long long cost2 = oo;
    for (int i = 0; i < 3; i++)
      cost2 = min(cost2, (i == 2 ? 0 : t[v]) + dp[v][i]);
    deg--;
    ans += cost1;
    aux.push_back(cost2 - cost1);
  }
  if (u == 2)
    cerr << "LINE(" << 67 << ") ->"
         << "ans"
         << " is " << ans << endl;
  sort((aux).begin(), (aux).end());
  for (int i = 0; i <= int(aux.size()); i++) {
    long long tt = ans + (long long)max(deg, 0) * t[u];
    if (deg < 0)
      dp[u][0] = min(dp[u][0], tt);
    else if (deg > 0)
      dp[u][2] = min(dp[u][2], tt);
    else
      dp[u][1] = min(dp[u][1], tt);
    deg += 2;
    if (i < int(aux.size())) ans += aux[i];
  }
}
signed main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> t[i];
  for (int i = 1; i <= n; i++) cin >> h[i];
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  dfs(1);
  long long ans = oo;
  for (int i = 0; i < 3; i++) ans = min(ans, dp[1][i]);
  cout << ans << '\n';
}
