#include <bits/stdc++.h>
using namespace std;
struct node {
  int nxt, to;
  long long v1, v2;
} o[300010 << 1];
int n, q, F[300010][20], vis[300010], deep[300010], head[300010], I,
    fz[4] = {0, 2, 1, 3};
long long dp[300010], g[20][300010][4], X[4], Y[4];
vector<int> v[300010];
void add(int u, int v, long long w1, long long w2) {
  o[++I] = (node){head[u], v, w1, w2};
  head[u] = I;
}
void dfs1(int now, int fa) {
  F[now][0] = fa, deep[now] = deep[fa] + 1;
  for (int i = 1; i <= 19; i++) F[now][i] = F[F[now][i - 1]][i - 1];
  for (int i = head[now]; i; i = o[i].nxt) {
    int t = o[i].to;
    if (t ^ fa) dfs1(t, now), dp[now] = min(dp[now], dp[t] + o[i].v1 + o[i].v2);
  }
}
void dfs2(int now, int fa) {
  for (int i = head[now]; i; i = o[i].nxt) {
    int t = o[i].to;
    if (t ^ fa) dp[t] = min(dp[t], dp[now] + o[i].v1 + o[i].v2), dfs2(t, now);
  }
}
void dfs3(int now, int fa) {
  for (int i = head[now]; i; i = o[i].nxt) {
    int t = o[i].to;
    if (t == fa) continue;
    g[0][t][0] = min(o[i].v1, dp[t] + dp[now] + o[i].v2);
    g[0][t][1] = min(dp[t] + o[i].v2, dp[now] + o[i].v1);
    g[0][t][2] = min(dp[now] + o[i].v2, dp[t] + o[i].v1);
    g[0][t][3] = min(o[i].v2, dp[t] + dp[now] + o[i].v1);
    dfs3(t, now);
  }
}
void merge(long long* x, long long* y, long long* z) {
  if (!x[0] && !x[1] && !x[2] && !x[3]) {
    memcpy(z, y, 32);
    return;
  }
  g[0][0][0] = min(x[0] + y[0], x[1] + y[2]);
  g[0][0][1] = min(x[0] + y[1], x[1] + y[3]);
  g[0][0][2] = min(x[2] + y[0], x[3] + y[2]);
  g[0][0][3] = min(x[2] + y[1], x[3] + y[3]);
  memcpy(z, g[0][0], 32);
}
long long LCA(int x, int y, int st) {
  memset(X, 0, sizeof(X)), memset(Y, 0, sizeof(Y));
  if (deep[x] < deep[y]) swap(x, y), st = fz[st];
  for (int i = 19; i >= 0; i--) {
    if (deep[F[x][i]] < deep[y]) continue;
    merge(X, g[i][x], X);
    x = F[x][i];
  }
  if (x == y) return X[st];
  for (int i = 19; i >= 0; i--) {
    if (F[x][i] ^ F[y][i]) {
      merge(X, g[i][x], X), merge(Y, g[i][y], Y);
      x = F[x][i], y = F[y][i];
    }
  }
  merge(X, g[0][x], X), merge(Y, g[0][y], Y);
  swap(Y[1], Y[2]);
  merge(X, Y, X);
  return X[st];
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &dp[i]);
  for (int i = 1; i < n; i++) {
    int a, b;
    long long w1, w2;
    scanf("%d%d%lld%lld", &a, &b, &w1, &w2);
    add(a, b, w1, w2), add(b, a, w1, w2);
  }
  dfs1(1, 0), dfs2(1, 0);
  dfs3(1, 0);
  for (int j = 1; j <= 19; j++) {
    for (int i = 1; i <= n; i++) {
      int x = i, y = F[i][j - 1];
      if (!y || !F[x][j]) continue;
      merge(g[j - 1][x], g[j - 1][y], g[j][x]);
    }
  }
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    if ((a + 1) / 2 == (b + 1) / 2) {
      printf("%lld\n", dp[a + 1 >> 1]);
      continue;
    }
    int st = (a & 1) << 1 | (b & 1);
    a = a + 1 >> 1, b = b + 1 >> 1;
    printf("%lld\n", LCA(a, b, st ^ 3));
  }
  return 0;
}
