#include <bits/stdc++.h>
using namespace std;
const int inf = 2 * (1e9) + 10;
const long long infl = 2 * (1e18) + 10;
const long long MOD = 998244353;
const long NMAX = 400005;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
struct segment {
  long long states[2][2];
  segment(int l = 0, int r = 0) {
    this->l = l;
    this->r = r;
    memset(states, 0, sizeof(states));
    states[0][1] = infl;
    states[1][0] = infl;
  }
  int l, r;
};
struct edge {
  int to;
  long long w1;
  long long w2;
  edge(long long to = 0, long long w1 = 0, long long w2 = 0) {
    this->to = to;
    this->w1 = w1;
    this->w2 = w2;
  }
};
long long w1[NMAX], w2[NMAX], c[NMAX];
int pa[NMAX];
vector<edge> E[NMAX];
int n, m;
int cnt[NMAX], l[NMAX];
int nod[NMAX];
int num[NMAX];
int dp[25][NMAX];
vector<int> lst[NMAX];
segment combine(segment a, segment b) {
  segment ab;
  for (int i = 0; i <= 1; ++i) {
    for (int j = 0; j <= 1; ++j) {
      ab.states[i][j] = infl;
      for (int n = 0; n <= 1; ++n) {
        for (int m = 0; m <= 1; ++m) {
          long long comm = infl;
          if (n == 0 && m == 0)
            comm = min(w1[nod[b.l]], w2[nod[b.l]] + c[nod[a.r]] + c[nod[b.l]]);
          if (n == 0 && m == 1)
            comm = min(w1[nod[b.l]] + c[nod[b.l]], w2[nod[b.l]] + c[nod[a.r]]);
          if (n == 1 && m == 0)
            comm = min(w1[nod[b.l]] + c[nod[a.r]], w2[nod[b.l]] + c[nod[b.l]]);
          if (n == 1 && m == 1)
            comm = min(w1[nod[b.l]] + c[nod[a.r]] + c[nod[b.l]], w2[nod[b.l]]);
          ab.states[i][j] =
              min(ab.states[i][j], a.states[i][n] + b.states[m][j] + comm);
        }
      }
    }
  }
  ab.l = a.l;
  ab.r = b.r;
  return ab;
}
segment combine2(segment a, segment b) {
  segment ab;
  for (int i = 0; i <= 1; ++i) {
    for (int j = 0; j <= 1; ++j) {
      ab.states[i][j] = infl;
      ab.states[i][j] = min(
          min(a.states[0][i] + b.states[0][j], a.states[1][i] + b.states[1][j]),
          min(a.states[0][i] + c[nod[a.l]] + b.states[1][j],
              a.states[1][i] + c[nod[a.l]] + b.states[0][j]));
    }
  }
  return ab;
}
segment t[4 * NMAX];
segment query(int n, int l, int r, int ql, int qr) {
  if (ql <= l && r <= qr) return t[n];
  int pivot = (l + r) / 2;
  segment rs;
  if (ql <= pivot) rs = query(2 * n, l, pivot, ql, qr);
  if (qr > pivot) {
    segment rsr = query(2 * n + 1, pivot + 1, r, ql, qr);
    if (rs.l)
      rs = combine(rs, rsr);
    else
      rs = rsr;
  }
  return rs;
}
void build(int n, int l, int r) {
  if (l == r) {
    t[n].states[0][1] = c[nod[l]];
    t[n].states[1][0] = c[nod[l]];
    t[n].l = l;
    t[n].r = r;
    return;
  }
  int pivot = (l + r) / 2;
  build(2 * n, l, pivot);
  build(2 * n + 1, pivot + 1, r);
  t[n] = combine(t[2 * n], t[2 * n + 1]);
}
void make_HLD(int x, int p, int d) {
  cnt[x] = 1;
  l[x] = d;
  if (x != 1 && E[x].size() == 1) {
    lst[m].push_back(x);
    num[x] = m++;
    return;
  }
  int mi = 0;
  for (edge y : E[x]) {
    if (y.to == p) continue;
    make_HLD(y.to, x, d + 1);
    pa[y.to] = x;
    w1[y.to] = y.w1;
    w2[y.to] = y.w2;
    cnt[x] += cnt[y.to];
    if (cnt[y.to] > cnt[mi]) mi = y.to;
  }
  num[x] = num[mi];
  lst[num[x]].push_back(x);
}
int lca(int v, int w) {
  if (l[v] < l[w]) swap(v, w);
  for (int step = log2(l[v]) + 1; step >= 0; --step)
    if (l[v] - (1 << step) >= l[w]) v = dp[step][v];
  if (v == w) return v;
  for (int step = log2(l[w]) + 1; step >= 0; --step)
    if (dp[step][v] && dp[step][v] != dp[step][w])
      v = dp[step][v], w = dp[step][w];
  return dp[0][v];
}
segment subpath(int v, int u) {
  segment rs;
  while (num[v] != num[u]) {
    segment prs = query(1, 1, n, cnt[lst[num[v]].back()], cnt[v]);
    if (!rs.l) {
      rs = prs;
    } else {
      rs = combine(prs, rs);
    }
    v = pa[lst[num[v]].back()];
    if (v < 1) break;
  }
  if (v >= 1) {
    segment prs;
    prs = query(1, 1, n, cnt[u], cnt[v]);
    if (!rs.l) {
      rs = prs;
    } else {
      rs = combine(prs, rs);
    }
  }
  return rs;
}
int main() {
  cin.sync_with_stdio(0);
  cin >> n;
  long long a, b;
  for (int i = 1; i <= n; ++i) {
    cin >> a;
    c[i] = a;
  }
  cnt[0] = -1;
  for (int i = 1; i < n; ++i) {
    long long ww1, ww2;
    cin >> a >> b >> ww1 >> ww2;
    E[a].push_back(edge(b, ww1, ww2));
    E[b].push_back(edge(a, ww1, ww2));
  }
  set<pair<long long, int>> T;
  for (int i = 1; i <= n; ++i) {
    T.insert(make_pair(c[i], i));
  }
  while (!T.empty()) {
    int v = (*(T.begin())).second;
    T.erase(T.begin());
    for (auto el : E[v]) {
      if (c[v] + el.w1 + el.w2 < c[el.to]) {
        c[el.to] = c[v] + el.w1 + el.w2;
        T.insert(make_pair(c[el.to], el.to));
      }
    }
  }
  make_HLD(1, 0, 0);
  for (int i = 1; i <= n; ++i) {
    dp[0][i] = pa[i];
  }
  for (int step = 1; (1 << step) <= n; ++step)
    for (int i = 1; i <= n; ++i) dp[step][i] = dp[step - 1][dp[step - 1][i]];
  int x = n;
  for (int i = 0; i < m; i++) {
    for (int j : lst[i]) {
      nod[x] = j;
      cnt[j] = x--;
    }
  }
  build(1, 1, n);
  int q;
  cin >> q;
  for (int i = 1; i <= q; ++i) {
    int u, v;
    cin >> u >> v;
    int u1 = (u - 1) / 2 + 1;
    int v1 = (v - 1) / 2 + 1;
    int lc = lca(u1, v1);
    segment rs;
    if (lc == u1 || lc == v1) {
      if (l[u1] < l[v1]) {
        rs = subpath(v1, u1);
        cout << rs.states[1 - u % 2][1 - v % 2] << "\n";
      } else {
        rs = subpath(u1, v1);
        cout << rs.states[1 - v % 2][1 - u % 2] << "\n";
      }
    } else {
      segment rs1 = subpath(u1, lc);
      segment rs2 = subpath(v1, lc);
      rs = combine2(rs1, rs2);
      cout << rs.states[1 - u % 2][1 - v % 2] << "\n";
    }
  }
  return 0;
}
