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 double eps = 1e-9;
template <class T>
struct RMQ {
  const int STEP_P = 5;
  const int STEP = 1 << STEP_P;
  vector<T> data;
  const T INF;
  vector<vector<T> > small_powers;
  vector<vector<T> > group_powers;
  int N;
  RMQ(vector<T> data_, T INF_) : data(data_), INF(INF_) { init(); };
  void init() {
    N = int((data).size());
    small_powers = vector<vector<T> >(STEP_P + 1, vector<T>(N));
    small_powers[0] = data;
    for (int p = (0); p < (STEP_P); p++)
      for (int n = (0); n < (N); n++) {
        small_powers[p + 1][n] =
            min(small_powers[p][n], small_powers[p][min(n + (1 << p), N - 1)]);
      }
    int GN = (N + STEP - 1) / STEP;
    int GP = 1;
    while (GN > (1 << GP)) ++GP;
    group_powers = vector<vector<T> >(GP + 1, vector<T>(GN));
    for (int i = (0); i < (GN); i++)
      group_powers[0][i] = small_powers[STEP_P][i << STEP_P];
    for (int p = (0); p < (GP); p++)
      for (int n = (0); n < (GN); n++) {
        group_powers[p + 1][n] =
            min(group_powers[p][n], group_powers[p][min(n + (1 << p), GN - 1)]);
      }
  }
  int largest_bit(int n) { return 31 - __builtin_clz(max(1, n - 1)); }
  T query(int f, int t) {
    assert(f >= 0 && t <= N);
    if (f >= t) return INF;
    int p = min(STEP_P, largest_bit(t - f));
    auto res = min(small_powers[p][f], small_powers[p][t - (1 << p)]);
    if (t - f > STEP + STEP) {
      int g_f = f / STEP + 1, g_t = t / STEP;
      p = largest_bit(g_t - g_f);
      res =
          min(res, min(group_powers[p][g_f], group_powers[p][g_t - (1 << p)]));
    }
    return res;
  }
};
const int MAXN = 5e5;
int A[MAXN];
vector<int> adj[MAXN];
vector<long long> dp_only[MAXN];
vector<long long> dp_not[MAXN];
long long dp_all[MAXN];
int todo[MAXN];
int xo[MAXN];
int cost[MAXN];
int etox[MAXN][2];
int edgeval[MAXN][2];
int N, Q;
long long calc_not(int n, int eid) {
  int xid = etox[eid][0];
  if (adj[n][xid] != eid) xid = etox[eid][1];
  if (dp_not[n][xid] == -1) {
    if (dp_all[n] == -1) {
      dp_all[n] = A[n];
      todo[n] = xid;
      for (int i = (0); i < (int((adj[n]).size())); i++)
        if (i != xid) {
          int neid = adj[n][i];
          dp_only[n][i] =
              max(0ll, calc_not(xo[neid] ^ n, neid) - cost[neid] * 2ll);
          dp_all[n] += dp_only[n][i];
        }
      dp_not[n][xid] = dp_all[n];
    } else if (todo[n] != -1) {
      int neid = adj[n][todo[n]];
      dp_only[n][todo[n]] =
          max(0ll, calc_not(xo[neid] ^ n, neid) - cost[neid] * 2ll);
      dp_all[n] += dp_only[n][todo[n]];
      dp_not[n][xid] = dp_all[n] - dp_only[n][xid];
      todo[n] = -1;
    } else {
      dp_not[n][xid] = dp_all[n] - dp_only[n][xid];
    }
  }
  return dp_not[n][xid];
}
long long calc_only(int n, int eid) {
  int xid = etox[eid][0];
  if (adj[n][xid] != eid) xid = etox[eid][1];
  return dp_only[n][xid];
}
int parent_edge[MAXN];
int depth[MAXN];
long long dp_acc[MAXN];
pair<int, int> tmp_rmqdata[MAXN * 2];
int rmqposition[MAXN];
int TMP_RMQDATA;
void calc_accumulate(int n) {
  rmqposition[n] = TMP_RMQDATA;
  tmp_rmqdata[TMP_RMQDATA++] = make_pair(depth[n], n);
  for (auto eid : adj[n])
    if (eid != parent_edge[n]) {
      int to = xo[eid] ^ n;
      dp_acc[to] =
          dp_acc[n] - calc_only(n, eid) - cost[eid] + calc_not(to, eid);
      depth[to] = depth[n] + 1;
      parent_edge[to] = eid;
      calc_accumulate(to);
      tmp_rmqdata[TMP_RMQDATA++] = make_pair(depth[n], n);
    }
}
int main() {
  if (0 == scanf("%d%d", &N, &Q)) {
    fprintf(stderr, "Could not parse arguments\n");
  };
  for (int i = (1); i < (N + 1); i++)
    if (0 == scanf("%d", A + i)) {
      fprintf(stderr, "Could not parse arguments\n");
    };
  for (int i = (0); i < (N + 1); i++) adj[i].clear();
  for (int i = (1); i < (N); i++) {
    int a, b, c;
    if (0 == scanf("%d%d%d", &a, &b, &c)) {
      fprintf(stderr, "Could not parse arguments\n");
    };
    etox[i][0] = min(int((adj[a]).size()), int((adj[b]).size()));
    etox[i][1] = max(int((adj[a]).size()), int((adj[b]).size()));
    adj[a].push_back(i);
    adj[b].push_back(i);
    xo[i] = a ^ b;
    cost[i] = c;
    edgeval[i][0] = a;
    edgeval[i][1] = b;
  }
  for (int i = (1); i < (N + 1); i++)
    dp_not[i] = dp_only[i] = vector<long long>(int((adj[i]).size()), -1);
  for (int i = (1); i < (N + 1); i++) dp_all[i] = -1;
  for (int i = (1); i < (N + 1); i++)
    for (auto e : adj[i]) calc_not(i, e);
  for (int n = (1); n < (N + 1); n++) {
    if (todo[n] != -1) {
      int neid = adj[n][todo[n]];
      dp_only[n][todo[n]] =
          max(0ll, calc_not(xo[neid] ^ n, neid) - cost[neid] * 2ll);
      dp_all[n] += dp_only[n][todo[n]];
      todo[n] = -1;
    }
  }
  parent_edge[1] = -1;
  dp_acc[1] = dp_all[1];
  depth[1] = 0;
  TMP_RMQDATA = 0;
  calc_accumulate(1);
  vector<pair<int, int> > rmqdata(tmp_rmqdata, tmp_rmqdata + TMP_RMQDATA);
  RMQ<pair<int, int> > rmq(rmqdata, make_pair(N + 1, N + 1));
  for (int q = (0); q < (Q); q++) {
    int a, b;
    if (0 == scanf("%d%d", &a, &b)) {
      fprintf(stderr, "Could not parse arguments\n");
    };
    if (rmqposition[b] < rmqposition[a]) swap(a, b);
    int lc = rmq.query(rmqposition[a], rmqposition[b] + 1).second;
    long long ares = dp_acc[a] + dp_acc[b] - 2 * dp_acc[lc] + dp_all[lc];
    cout << ares << '\n';
  }
  return 0;
}