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 maxn = 200200;
int rd() {
  int x = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x;
}
struct Node {
  int lt, rt;
  long long int n, m, laz;
} tr[maxn * 4];
int eg[maxn][3], egh[maxn], ect, eid[maxn * 2];
int N, M, root, pct;
long long int up[maxn], dw[maxn];
int in[maxn], out[maxn], id[maxn], dfn;
void adeg(int a, int b, int c) {
  eg[ect][0] = b;
  eg[ect][1] = egh[a];
  eg[ect][2] = c;
  egh[a] = ect++;
}
void dfs(int x, int f) {
  in[x] = ++dfn;
  id[dfn] = x;
  for (int i = egh[x]; i != -1; i = eg[i][1]) {
    if (eg[i][0] == f) continue;
    dw[eg[i][0]] = dw[x] + eg[i][2];
    dfs(eg[i][0], x);
  }
  out[x] = dfn;
}
inline void update(int p) { tr[p].m = min(tr[tr[p].lt].m, tr[tr[p].rt].m); }
int build(int l, int r) {
  int p = ++pct;
  if (l == r) {
    tr[p].n = dw[id[l]];
    tr[p].m = dw[id[l]] + up[id[l]];
  } else {
    int m = l + r >> 1;
    tr[p].lt = build(l, m);
    tr[p].rt = build(m + 1, r);
    update(p);
  }
  return p;
}
inline void pushdown(int p) {
  if (!tr[p].lt || !tr[p].rt || !tr[p].laz) return;
  tr[tr[p].lt].n += tr[p].laz;
  tr[tr[p].lt].m += tr[p].laz;
  tr[tr[p].lt].laz += tr[p].laz;
  tr[tr[p].rt].n += tr[p].laz;
  tr[tr[p].rt].m += tr[p].laz;
  tr[tr[p].rt].laz += tr[p].laz;
  tr[p].laz = 0;
  update(p);
}
void add(int p, int l, int r, int x, int y, int z) {
  if (x <= l && r <= y) {
    tr[p].n += z;
    tr[p].m += z;
    tr[p].laz += z;
    pushdown(p);
  } else {
    pushdown(p);
    int m = l + r >> 1;
    if (x <= m) add(tr[p].lt, l, m, x, y, z);
    if (y >= m + 1) add(tr[p].rt, m + 1, r, x, y, z);
    update(p);
  }
}
void change(int p, int l, int r, int x, int y) {
  pushdown(p);
  if (l == r) {
    tr[p].m = tr[p].n + y;
  } else {
    int m = l + r >> 1;
    if (x <= m)
      change(tr[p].lt, l, m, x, y);
    else
      change(tr[p].rt, m + 1, r, x, y);
    update(p);
  }
}
long long int query1(int p, int l, int r, int x) {
  pushdown(p);
  if (l == r) return tr[p].n;
  int m = l + r >> 1;
  if (x <= m)
    return query1(tr[p].lt, l, m, x);
  else
    return query1(tr[p].rt, m + 1, r, x);
}
long long int query2(int p, int l, int r, int x, int y) {
  pushdown(p);
  if (x <= l && r <= y) return tr[p].m;
  int m = l + r >> 1;
  long long int re = 1e12;
  if (x <= m) re = min(re, query2(tr[p].lt, l, m, x, y));
  if (y >= m + 1) re = min(re, query2(tr[p].rt, m + 1, r, x, y));
  return re;
}
int main() {
  int i, j, k;
  N = rd(), M = rd();
  memset(egh, -1, sizeof(egh));
  ect = 1;
  for (i = 1; i < N; i++) {
    int a = rd(), b = rd(), c = rd();
    adeg(a, b, c);
  }
  for (i = 1; i < N; i++) {
    int a = rd();
    rd();
    up[a] = rd();
    eid[i + N - 1] = a;
  }
  dfs(1, 0);
  root = build(1, N);
  for (i = 1; i <= M; i++) {
    int a = rd();
    if (a == 1) {
      int b = rd(), c = rd();
      if (b < N) {
        add(root, 1, N, in[eg[b][0]], out[eg[b][0]], c - eg[b][2]);
        eg[b][2] = c;
      } else
        change(root, 1, N, in[eid[b]], c);
    } else {
      int b = rd(), c = rd();
      long long int re;
      if (b == c)
        re = 0;
      else if (in[c] <= out[b] && in[c] >= in[b]) {
        re = query1(root, 1, N, in[c]) - query1(root, 1, N, in[b]);
      } else {
        re = query2(root, 1, N, in[b], out[b]) - query1(root, 1, N, in[b]) +
             query1(root, 1, N, in[c]);
      }
      printf("%I64d\n", re);
    }
  }
}
