#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 7;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1000000007;
const double eps = 1e-13;
const double PI = acos(-1);
int n, q, depth[N];
long long d[N], gg[N], dp[N][2][2][20];
int f[N][20];
vector<pair<int, pair<long long, long long>>> G[N];
vector<pair<long long, int>> E[N];
void dfs(int u, int fa, pair<long long, long long> dis) {
  depth[u] = depth[fa] + 1;
  if (u > 1) {
    f[u][0] = fa;
    dp[u][0][0][0] = min(dis.first, dis.second + d[u] + d[fa]);
    dp[u][1][1][0] = min(dis.second, dis.first + d[u] + d[fa]);
    dp[u][0][1][0] = min(dis.first + d[fa], dis.second + d[u]);
    dp[u][1][0][0] = min(dis.second + d[fa], dis.first + d[u]);
    for (int i = 1; i < 20; i++) f[u][i] = f[f[u][i - 1]][i - 1];
    for (int i = 1; i < 20; i++) {
      int v = f[u][i - 1];
      dp[u][0][0][i] = min(dp[u][0][0][i - 1] + dp[v][0][0][i - 1],
                           dp[u][0][1][i - 1] + dp[v][1][0][i - 1]);
      dp[u][1][1][i] = min(dp[u][1][1][i - 1] + dp[v][1][1][i - 1],
                           dp[u][1][0][i - 1] + dp[v][0][1][i - 1]);
      dp[u][0][1][i] = min(dp[u][0][0][i - 1] + dp[v][0][1][i - 1],
                           dp[u][0][1][i - 1] + dp[v][1][1][i - 1]);
      dp[u][1][0][i] = min(dp[u][1][1][i - 1] + dp[v][1][0][i - 1],
                           dp[u][1][0][i - 1] + dp[v][0][0][i - 1]);
    }
  }
  for (auto& e : G[u]) {
    if (e.first == fa) continue;
    dfs(e.first, u, e.second);
  }
}
int getLca(int u, int v) {
  if (depth[u] < depth[v]) swap(u, v);
  for (int i = 19; i >= 0; i--)
    if (depth[f[u][i]] >= depth[v]) u = f[u][i];
  if (u == v) return u;
  for (int i = 19; i >= 0; i--)
    if (f[u][i] != f[v][i]) u = f[u][i], v = f[v][i];
  return f[u][0];
}
pair<long long, long long> calc(int u, int op1, int v) {
  int dis = depth[u] - depth[v];
  long long g[2], tmp[2];
  g[op1] = 0;
  g[op1 ^ 1] = d[u];
  for (int i = 19; i >= 0; i--) {
    if (dis >> i & 1) {
      tmp[0] = g[0], tmp[1] = g[1];
      g[0] = min(tmp[0] + dp[u][0][0][i], tmp[1] + dp[u][1][0][i]);
      g[1] = min(tmp[1] + dp[u][1][1][i], tmp[0] + dp[u][0][1][i]);
      u = f[u][i];
    }
  }
  return make_pair(g[0], g[1]);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &d[i]);
  for (int i = 2; i <= n; i++) {
    int u, v;
    long long w1, w2;
    scanf("%d%d%lld%lld", &u, &v, &w1, &w2);
    G[u].push_back(make_pair(v, make_pair(w1, w2)));
    G[v].push_back(make_pair(u, make_pair(w1, w2)));
    E[u].push_back(make_pair(w1 + w2, v));
    E[v].push_back(make_pair(w1 + w2, u));
  }
  priority_queue<pair<long long, int>, vector<pair<long long, int>>,
                 greater<pair<long long, int>>>
      que;
  for (int i = 1; i <= n; i++) {
    gg[i] = d[i];
    que.push(make_pair(d[i], i));
  }
  while (!que.empty()) {
    int u = que.top().second;
    long long val = que.top().first;
    que.pop();
    if (val > gg[u]) continue;
    for (auto& e : E[u]) {
      if (gg[e.second] > val + e.first) {
        gg[e.second] = val + e.first;
        que.push(make_pair(gg[e.second], e.second));
      }
    }
  }
  for (int i = 1; i <= n; i++) d[i] = gg[i];
  dfs(1, 0, make_pair(0, 0));
  scanf("%d", &q);
  while (q--) {
    int u, v;
    scanf("%d%d", &u, &v);
    int op1 = (u & 1) ? 0 : 1;
    int op2 = (v & 1) ? 0 : 1;
    if (u & 1)
      u = (u + 1) >> 1;
    else
      u >>= 1;
    if (v & 1)
      v = (v + 1) >> 1;
    else
      v >>= 1;
    int Lca = getLca(u, v);
    pair<long long, long long> disu = calc(u, op1, Lca);
    pair<long long, long long> disv = calc(v, op2, Lca);
    printf("%lld\n", min(disu.first + disv.first, disu.second + disv.second));
  }
  return 0;
}
