Problem: You are given a weighted tree (undirected connected graph with no cycles, loops or multiple edges) with n vertices. The edge \\{u_j, v_j\} has weight w_j. Also each vertex i has its own value a_i assigned to it.

Let's call a path starting in vertex u and ending in vertex v, where each edge can appear no more than twice (regardless of direction), a 2-path. Vertices can appear in the 2-path multiple times (even start and end vertices).

For some 2-path p profit Pr(p) = ∑_{v ∈ distinct vertices in  p}{a_v} - ∑_{e ∈ distinct edges in  p}{k_e ⋅ w_e}, where k_e is the number of times edge e appears in p. That is, vertices are counted once, but edges are counted the number of times they appear in p.

You are about to answer m queries. Each query is a pair of vertices (qu, qv). For each query find 2-path p from qu to qv with maximal profit Pr(p).

Input

The first line contains two integers n and q (2 ≤ n ≤ 3 ⋅ 10^5, 1 ≤ q ≤ 4 ⋅ 10^5) — the number of vertices in the tree and the number of queries.

The second line contains n space-separated integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^9) — the values of the vertices.

Next n - 1 lines contain descriptions of edges: each line contains three space separated integers u_i, v_i and w_i (1 ≤ u_i, v_i ≤ n, u_i ≠ v_i, 1 ≤ w_i ≤ 10^9) — there is edge \\{u_i, v_i\} with weight w_i in the tree.

Next q lines contain queries (one per line). Each query contains two integers qu_i and qv_i (1 ≤ qu_i, qv_i ≤ n) — endpoints of the 2-path you need to find.

Output

For each query print one integer per line — maximal profit Pr(p) of the some 2-path p with the corresponding endpoints.

Example

Input

7 6
6 5 5 3 2 1 2
1 2 2
2 3 2
2 4 1
4 5 1
6 4 2
7 3 25
1 1
4 4
5 6
6 4
3 4
3 7


Output

9
9
9
8
12
-14

Note

Explanation of queries: 

  1. (1, 1) — one of the optimal 2-paths is the following: 1 → 2 → 4 → 5 → 4 → 2 → 3 → 2 → 1. Pr(p) = (a_1 + a_2 + a_3 + a_4 + a_5) - (2 ⋅ w(1,2) + 2 ⋅ w(2,3) + 2 ⋅ w(2,4) + 2 ⋅ w(4,5)) = 21 - 2 ⋅ 12 = 9. 
  2. (4, 4): 4 → 2 → 1 → 2 → 3 → 2 → 4. Pr(p) = (a_1 + a_2 + a_3 + a_4) - 2 ⋅ (w(1,2) + w(2,3) + w(2,4)) = 19 - 2 ⋅ 10 = 9. 
  3. (5, 6): 5 → 4 → 2 → 3 → 2 → 1 → 2 → 4 → 6. 
  4. (6, 4): 6 → 4 → 2 → 1 → 2 → 3 → 2 → 4. 
  5. (3, 4): 3 → 2 → 1 → 2 → 4. 
  6. (3, 7): 3 → 2 → 1 → 2 → 4 → 5 → 4 → 2 → 3 → 7. 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int N = 3 * (int)(1e5);
const int Q = 4 * (int)(1e5);
const int L = 20;
long long val[N];
vector<int> conns[N];
vector<int> costs[N];
int ind[N];
int parent[N][L];
int depth[N];
long long dp[N];
long long pew[N];
long long base[2 * Q];
int int_start[2 * Q];
int int_end[2 * Q];
long long adjust[Q];
vector<pair<int, pair<int, int>>> que;
long long seg[4 * N];
int h;
long long getSum(int a, int b, int ia = 0, int ib = h - 1, int i = 1) {
  if (ib < a || b < ia) return 0;
  if (a <= ia && ib <= b) return seg[i];
  int mid = (ia + ib) >> 1;
  return getSum(a, b, ia, mid, 2 * i) + getSum(a, b, mid + 1, ib, 2 * i + 1);
}
void setVal(int i, long long v) {
  i += h;
  seg[i] = v;
  while (i > 1) {
    seg[i >> 1] = seg[i] + seg[i ^ 1];
    i >>= 1;
  }
}
long long dfs1(int i, int p, int d, int& j) {
  ind[i] = j;
  ++j;
  parent[i][0] = p;
  dp[i] = val[i];
  depth[i] = d;
  for (int ti = 0; ti < conns[i].size(); ++ti) {
    int t = conns[i][ti];
    int w = costs[i][ti];
    if (t == p) continue;
    pew[t] = w;
    long long off = dfs1(t, i, d + 1, j) - 2 * w;
    dp[i] += max((long long)0, off);
  }
  return dp[i];
}
void dfs2(int i, int p, int& que_ind, long long curr_total, long long up_off) {
  long long sum_off = 0;
  for (int ti = 0; ti < conns[i].size(); ++ti) {
    int t = conns[i][ti];
    int w = costs[i][ti];
    if (t == p) continue;
    long long off = dp[t] - 2 * w;
    if (off > 0) sum_off += off;
  }
  setVal(depth[i], sum_off);
  for (; (que_ind < que.size()) && (que[que_ind].first == ind[i]); ++que_ind) {
    int ty = que[que_ind].second.first;
    int in = que[que_ind].second.second;
    if (ty == -1) {
      base[in] += up_off + sum_off - 2 * curr_total;
    } else {
      base[in] += 2 * (curr_total + val[i]);
      base[in] += 2 * getSum(depth[int_start[in]] + 1, depth[int_end[in]]);
    }
  }
  for (int ti = 0; ti < conns[i].size(); ++ti) {
    int t = conns[i][ti];
    long long w = costs[i][ti];
    if (t == p) continue;
    long long off = dp[t] - 2 * w;
    long long sub_sum_off = sum_off - max((long long)0, off);
    setVal(depth[i], sub_sum_off);
    long long next_total = curr_total + val[i] - w;
    long long next_up_off =
        max((long long)0, up_off + sub_sum_off + val[i] - 2 * w);
    dfs2(t, i, que_ind, next_total, next_up_off);
  }
}
int lca(int& a, int& b) {
  if (depth[a] < depth[b]) swap(a, b);
  int diff = depth[a] - depth[b] - 1;
  if (diff >= 0) {
    for (int j = L - 1; j >= 0; --j) {
      if (diff & (1 << j)) a = parent[a][j];
    }
    if (parent[a][0] != b) {
      a = parent[a][0];
    } else {
      return b;
    }
  }
  for (int j = L - 1; j >= 0; --j) {
    if (parent[a][j] != parent[b][j]) {
      a = parent[a][j];
      b = parent[b][j];
    }
  }
  if (a != b) return parent[a][0];
  return a;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  h = 1;
  while (h < n) h <<= 1;
  for (int i = 0; i < n; ++i) {
    cin >> val[i];
  }
  for (int i = 0; i < n - 1; ++i) {
    int a, b, w;
    std::cin >> a >> b >> w;
    --a;
    --b;
    conns[a].push_back(b);
    conns[b].push_back(a);
    costs[a].push_back(w);
    costs[b].push_back(w);
  }
  int tmp = 0;
  dfs1(0, 0, 0, tmp);
  for (int j = 1; j < L; ++j) {
    for (int i = 0; i < n; ++i) {
      parent[i][j] = parent[parent[i][j - 1]][j - 1];
    }
  }
  for (int i = 0; i < q; ++i) {
    int ca, cb;
    cin >> ca >> cb;
    --ca;
    --cb;
    int a = ca;
    int b = cb;
    int c = lca(ca, cb);
    int_start[2 * i] = c;
    int_end[2 * i] = a;
    que.push_back({ind[c], {-1, 2 * i}});
    que.push_back({ind[a], {1, 2 * i}});
    int_start[2 * i + 1] = c;
    int_end[2 * i + 1] = b;
    que.push_back({ind[c], {-1, 2 * i + 1}});
    que.push_back({ind[b], {1, 2 * i + 1}});
    adjust[i] += 2 * val[c];
    if (ca != c) {
      long long off = dp[ca] - 2 * pew[ca];
      adjust[i] += 2 * max((long long)0, off);
    }
    if (cb != c) {
      long long off = dp[cb] - 2 * pew[cb];
      adjust[i] += 2 * max((long long)0, off);
    }
  }
  sort(que.begin(), que.end());
  tmp = 0;
  dfs2(0, 0, tmp, 0, 0);
  for (int i = 0; i < q; ++i) {
    cout << (base[2 * i] + base[2 * i + 1] - adjust[i]) / 2 << ' ';
  }
  cout << '\n';
}