You are given a directed weighted graph with n nodes and 2n - 2 edges. The nodes are labeled from 1 to n, while the edges are labeled from 1 to 2n - 2. The graph's edges can be split into two parts.

  * The first n - 1 edges will form a rooted spanning tree, with node 1 as the root. All these edges will point away from the root. 
  * The last n - 1 edges will be from node i to node 1, for all 2 ≤ i ≤ n. 



You are given q queries. There are two types of queries

  * 1 i w: Change the weight of the i-th edge to w
  * 2 u v: Print the length of the shortest path between nodes u to v



Given these queries, print the shortest path lengths.

Input

The first line of input will contain two integers n, q (2 ≤ n, q ≤ 200 000), the number of nodes, and the number of queries, respectively.

The next 2n - 2 integers will contain 3 integers ai, bi, ci, denoting a directed edge from node ai to node bi with weight ci.

The first n - 1 of these lines will describe a rooted spanning tree pointing away from node 1, while the last n - 1 of these lines will have bi = 1.

More specifically, 

  * The edges (a1, b1), (a2, b2), ... (an - 1, bn - 1) will describe a rooted spanning tree pointing away from node 1. 
  * bj = 1 for n ≤ j ≤ 2n - 2. 
  * an, an + 1, ..., a2n - 2 will be distinct and between 2 and n. 



The next q lines will contain 3 integers, describing a query in the format described in the statement.

All edge weights will be between 1 and 106.

Output

For each type 2 query, print the length of the shortest path in its own line.

Example

Input

5 9
1 3 1
3 2 2
1 4 3
3 5 4
5 1 5
3 1 6
2 1 7
4 1 8
2 1 1
2 1 3
2 3 5
2 5 2
1 1 100
2 1 3
1 8 30
2 4 2
2 2 4


Output

0
1
4
8
100
132
10
#include <bits/stdc++.h>
using namespace std;
const int N = 514514;
struct edge {
  int v, nt;
  long long w;
} e[N << 1];
long long t1[N], t2[N], dp[N];
long long tr[N << 1], mn[N << 1], lz[N << 1];
int hd[N], d[N], fa[N], tp[N], s[N], sz[N], in[N], uu[N];
int n, m, tot, pos;
void add(int x, int y, int z) {
  e[++tot] = {y, hd[x], z};
  hd[x] = tot;
}
void down(int i) {
  long long k = lz[i];
  lz[i] = 0;
  lz[(i << 1)] += k, lz[(i << 1 | 1)] += k;
  mn[(i << 1)] += k, mn[(i << 1 | 1)] += k;
}
void upd(int i, int l, int r, int s, int t, long long w1, long long w2) {
  if (s <= l && r <= t) {
    if (w1) tr[i] = w1;
    mn[i] += w2;
    lz[i] += w2;
    return;
  }
  down(i);
  if (s <= ((l + r) >> 1)) upd((i << 1), l, ((l + r) >> 1), s, t, w1, w2);
  if (t > ((l + r) >> 1))
    upd((i << 1 | 1), ((l + r) >> 1) + 1, r, s, t, w1, w2);
  tr[i] = tr[(i << 1)] + tr[(i << 1 | 1)];
  mn[i] = min(mn[(i << 1)], mn[(i << 1 | 1)]);
}
long long ask1(int i, int l, int r, int s, int t) {
  if (s <= l && r <= t) return tr[i];
  long long ans = 0;
  if (s <= ((l + r) >> 1)) ans = ask1((i << 1), l, ((l + r) >> 1), s, t);
  if (t > ((l + r) >> 1))
    ans += ask1((i << 1 | 1), ((l + r) >> 1) + 1, r, s, t);
  return ans;
}
long long ask2(int i, int l, int r, int s, int t) {
  if (s <= l && r <= t) return mn[i];
  long long ans = 1e18;
  down(i);
  if (s <= ((l + r) >> 1)) ans = ask2((i << 1), l, ((l + r) >> 1), s, t);
  if (t > ((l + r) >> 1))
    ans = min(ans, ask2((i << 1 | 1), ((l + r) >> 1) + 1, r, s, t));
  return ans;
}
void dfs1(int x, int f) {
  fa[x] = f, d[x] = d[f] + 1;
  sz[x] = 1;
  for (int i = hd[x], to; i; i = e[i].nt) {
    to = e[i].v;
    dp[to] = dp[x] + e[i].w;
    dfs1(to, x);
    t2[to] = e[i].w;
    sz[x] += sz[to];
    if (sz[to] > sz[s[x]]) s[x] = to;
  }
}
void dfs2(int x, int f) {
  tp[x] = f;
  in[x] = ++pos;
  upd(1, 1, n, in[x], in[x], t2[x], 0);
  upd(1, 1, n, in[x], in[x], 0, dp[x] + t1[x]);
  if (!s[x]) return;
  dfs2(s[x], f);
  for (int i = hd[x], to; i; i = e[i].nt) {
    to = e[i].v;
    if (to == s[x]) continue;
    dfs2(to, to);
  }
}
long long qry(int x) {
  long long ans = 0;
  while (tp[x] != 1) {
    ans += ask1(1, 1, n, in[tp[x]], in[x]);
    x = fa[tp[x]];
  }
  ans += ask1(1, 1, n, 1, in[x]);
  return ans;
}
bool isfa(int x, int y) {
  if (in[y] >= in[x] && in[y] <= in[x] + sz[x] - 1) return 1;
  return 0;
}
long long solve(int x, int y) {
  long long mn = 1e18;
  long long dx = qry(x), dy = qry(y);
  if (isfa(x, y)) return abs(dx - dy);
  mn = ask2(1, 1, n, in[x], in[x] + sz[x] - 1) - dx + dy;
  return mn;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1, x, y, z; i <= n - 1; i++) {
    scanf("%d%d%d", &x, &y, &z);
    add(x, y, z);
  }
  for (int i = 1, x, y, z; i <= n - 1; i++) {
    scanf("%d%d%d", &x, &y, &z);
    t1[x] = z;
    uu[i + n - 1] = x;
  }
  dfs1(1, 0);
  dfs2(1, 1);
  for (int i = 1, ty, x, y; i <= m; i++) {
    scanf("%d%d%d", &ty, &x, &y);
    if (ty == 1) {
      int u = e[x].v;
      if (x > n - 1)
        u = uu[x], upd(1, 1, n, in[u], in[u], 0, y - t1[u]), t1[u] = y;
      else
        upd(1, 1, n, in[u], in[u] + sz[u] - 1, 0, y - t2[u]),
            upd(1, 1, n, in[u], in[u], y, 0), t2[u] = y;
    } else
      printf("%lld\n", solve(x, y));
  }
}
