Problem: 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

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
string itos(int x) {
  stringstream ss;
  ss << x;
  return ss.str();
}
struct node {
  long long x, d;
  node() { x = d = 0; }
} T[800010];
int vist;
int n, q, len[200010], st[200010], en[200010], back[200010];
int to[200010], from[200010];
vector<int> e[200010];
void push(int pos) {
  T[pos << 1].d += T[pos].d, T[pos << 1 | 1].d += T[pos].d;
  T[pos << 1].x += T[pos].d, T[pos << 1 | 1].x += T[pos].d;
  T[pos].d = 0;
}
long long ask(int x, int y, int id = 1, int l = 0, int r = n) {
  if (l >= y || x >= r) return (1LL << 60);
  if (x <= l && r <= y) return T[id].x;
  push(id);
  return min(ask(x, y, id << 1, l, l + r >> 1),
             ask(x, y, id << 1 | 1, l + r >> 1, r));
}
void upd(int x, int y, int dx, int id = 1, int l = 0, int r = n) {
  if (l >= y || x >= r) return;
  assert(id < 800010);
  if (x <= l && r <= y) {
    T[id].d += dx;
    T[id].x += dx;
    return;
  }
  push(id);
  upd(x, y, dx, id << 1, l, l + r >> 1);
  upd(x, y, dx, id << 1 | 1, l + r >> 1, r);
  T[id].x = min(T[id << 1].x, T[id << 1 | 1].x);
  return;
}
void dfs(int now) {
  st[now] = vist++;
  for (auto x : e[now]) dfs(x);
  en[now] = vist;
  return;
}
bool isin(int u, int v) { return (st[u] <= st[v]) && (en[u] >= en[v]); }
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> q;
  for (int i = 1, u, v, w; i < n; i++)
    cin >> u >> v >> w, e[u].push_back((v)), len[v] = w, to[i] = v;
  for (int i = 1, u, v, w; i < n; i++)
    cin >> u >> v >> w, back[u] = w, from[i] = u;
  dfs(1);
  for (int i = 2; i <= n; i++) upd(st[i], en[i], len[i]);
  for (int i = 2; i <= n; i++) upd(st[i], st[i] + 1, back[i]);
  while (q--) {
    int type;
    cin >> type;
    if (type == 1) {
      int i, w;
      cin >> i >> w;
      if (i < n) {
        w -= len[to[i]];
        upd(st[to[i]], en[to[i]], w);
        len[to[i]] += w;
      } else {
        i -= n - 1;
        w -= back[from[i]];
        upd(st[from[i]], st[from[i]] + 1, w);
        back[from[i]] += w;
      }
    } else {
      int u, v, ret = 0;
      cin >> u >> v;
      if (isin(u, v)) {
        ret += ask(st[v], st[v] + 1) - back[v];
        ret -= ask(st[u], st[u] + 1) - back[u];
      } else {
        ret += ask(st[u], en[u]) - (ask(st[u], st[u] + 1) - back[u]);
        ret += ask(st[v], st[v] + 1) - back[v];
      }
      cout << ret << endl;
    }
  }
  return 0;
}