#include <bits/stdc++.h>
using namespace std;
const long long N = 300005, G = 19, inf = 4e18;
long long n, q, v[N], dep[N], par[G][N], cost[G][N][2][2];
vector<pair<long long, pair<long long, long long> > > adj[N];
void downcalc(long long C, long long P) {
  for (auto &first : adj[C]) {
    long long T = first.first, A, B;
    tie(A, B) = first.second;
    if (T == P) continue;
    downcalc(T, C);
    v[C] = min(v[C], v[T] + A + B);
  }
}
void upcalc(long long C, long long P) {
  for (auto &first : adj[C]) {
    long long T = first.first, A, B;
    tie(A, B) = first.second;
    if (T == P) continue;
    par[0][T] = C;
    dep[T] = dep[C] + 1;
    v[T] = min(v[T], v[C] + A + B);
    cost[0][T][0][0] = min(v[C] + v[T] + B, A);
    cost[0][T][0][1] = min(A + v[C], B + v[T]);
    cost[0][T][1][0] = min(A + v[T], B + v[C]);
    cost[0][T][1][1] = min(v[C] + v[T] + A, B);
    upcalc(T, C);
  }
}
long long getlca(long long A, long long B) {
  if (dep[A] < dep[B]) swap(A, B);
  for (long long i = G; i--;) {
    if (dep[A] - dep[B] >= (1 << i)) A = par[i][A];
  }
  if (A == B) return A;
  for (long long i = G; i--;) {
    if (par[i][A] != par[i][B]) {
      A = par[i][A];
      B = par[i][B];
    }
  }
  return par[0][A];
}
pair<long long, long long> get(long long first, long long second, long long Z) {
  long long V[2];
  V[second] = 0;
  V[second ^ 1] = v[first];
  for (long long i = G; i--;) {
    if (dep[first] - dep[Z] >= (1 << i)) {
      long long W[2] = {inf, inf};
      for (long long k1 = 0; k1 < 2; k1++)
        for (long long k2 = 0; k2 < 2; k2++) {
          W[k2] = min(W[k2], V[k1] + cost[i][first][k1][k2]);
        }
      V[0] = W[0];
      V[1] = W[1];
      first = par[i][first];
    }
  }
  return {V[0], V[1]};
}
void solve() {
  long long AX, AY, BX, BY, C;
  scanf("%lld%lld", &AX, &BX);
  AY = (AX - 1) % 2;
  AX = (AX - AY + 1) / 2;
  BY = (BX - 1) % 2;
  BX = (BX - BY + 1) / 2;
  C = getlca(AX, BX);
  pair<long long, long long> AA = get(AX, AY, C), BB = get(BX, BY, C);
  printf("%lld\n", min(AA.first + BB.first, AA.second + BB.second));
}
int main() {
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &v[i]);
  }
  for (long long i = 1; i < n; i++) {
    long long A, B, C, D;
    scanf("%lld%lld%lld%lld", &A, &B, &C, &D);
    adj[A].push_back({B, {C, D}});
    adj[B].push_back({A, {C, D}});
  }
  downcalc(1, 0);
  upcalc(1, 0);
  for (long long i = 1; i < G; i++) {
    for (long long j = 1; j <= n; j++) {
      par[i][j] = par[i - 1][par[i - 1][j]];
      for (int k1 = 0; k1 < 2; k1++)
        for (int k2 = 0; k2 < 2; k2++) {
          long long T = inf;
          for (int k3 = 0; k3 < 2; k3++) {
            T = min(
                T, cost[i - 1][j][k1][k3] + cost[i - 1][par[i - 1][j]][k3][k2]);
          }
          cost[i][j][k1][k2] = T;
        }
    }
  }
  scanf("%lld", &q);
  while (q--) solve();
}
