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 = 2e5;
const long long inf = 1e18;
long long t1[N * 4 + 100], lz[N * 4 + 100], t2[N * 4 + 100], dist[N + 100],
    w[N * 2 + 100];
int in[N + 100], out[N + 100], node[N + 100], fed[N + 100], Time = 0;
pair<int, int> edge[N * 2 + 100];
vector<pair<int, int> > g[N + 100];
void dfs(int v, int p, long long cur) {
  dist[v] = cur;
  in[v] = ++Time;
  node[Time] = v;
  for (auto it : g[v]) {
    if (it.first != p) {
      dfs(it.first, v, cur + it.second);
    }
  }
  out[v] = Time;
}
void build1(int v, int tl, int tr) {
  if (tl == tr) {
    t1[v] = dist[node[tl]];
  } else {
    int tm = (tl + tr) / 2;
    build1(v * 2, tl, tm);
    build1(v * 2 + 1, tm + 1, tr);
  }
}
void update1(int v, int tl, int tr, int l, int r, int val) {
  if (l > r) return;
  if (tl == l && tr == r) {
    t1[v] += val;
  } else {
    int tm = (tl + tr) / 2;
    update1(v * 2, tl, tm, l, min(r, tm), val);
    update1(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r, val);
  }
}
long long get1(int v, int tl, int tr, int pos) {
  if (tl == tr) return t1[v];
  int tm = (tl + tr) / 2;
  if (tm >= pos)
    return t1[v] + get1(v * 2, tl, tm, pos);
  else
    return t1[v] + get1(v * 2 + 1, tm + 1, tr, pos);
}
void push(int v) {
  t2[v * 2] += lz[v];
  t2[v * 2 + 1] += lz[v];
  lz[v * 2] += lz[v];
  lz[v * 2 + 1] += lz[v];
  lz[v] = 0;
}
void build2(int v, int tl, int tr) {
  if (tl == tr) {
    int cur = node[tl];
    t2[v] = dist[cur] + fed[cur];
  } else {
    int tm = (tl + tr) / 2;
    build2(v * 2, tl, tm);
    build2(v * 2 + 1, tm + 1, tr);
    t2[v] = min(t2[v * 2], t2[v * 2 + 1]);
  }
}
void update2(int v, int tl, int tr, int l, int r, long long val) {
  if (l > r) return;
  if (l == tl && r == tr) {
    t2[v] += val;
    lz[v] += val;
  } else {
    push(v);
    int tm = (tl + tr) / 2;
    update2(v * 2, tl, tm, l, min(r, tm), val);
    update2(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r, val);
    t2[v] = min(t2[v * 2], t2[v * 2 + 1]);
  }
}
long long get2(int v, int tl, int tr, int l, int r) {
  if (l > r) return inf;
  if (l == tl && r == tr) {
    return t2[v];
  } else {
    push(v);
    int tm = (tl + tr) / 2;
    return min(get2(v * 2, tl, tm, l, min(r, tm)),
               get2(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r));
  }
}
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  for (int i = 1; i < n; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    g[a].push_back(make_pair(b, c));
    g[b].push_back(make_pair(a, c));
    w[i] = c;
    edge[i] = make_pair(a, b);
  }
  for (int i = n; i < 2 * n - 1; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    w[i] = c;
    fed[a] = c;
    edge[i] = make_pair(a, b);
  }
  dfs(1, 0, 0);
  build1(1, 1, n);
  build2(1, 1, n);
  while (q--) {
    int type;
    scanf("%d", &type);
    if (type == 1) {
      int idx;
      long long val;
      scanf("%d%lld", &idx, &val);
      int T1 = edge[idx].first, T2 = edge[idx].second;
      if (idx > n - 1) {
        update2(1, 1, n, in[T1], in[T1], val - w[idx]);
        w[idx] = val;
      } else {
        int l, r;
        if (in[T1] > in[T2]) {
          l = in[T1];
          r = out[T1];
        } else {
          l = in[T2];
          r = out[T2];
        }
        update1(1, 1, n, l, r, val - w[idx]);
        update2(1, 1, n, l, r, val - w[idx]);
        w[idx] = val;
      }
    } else {
      int u, v;
      scanf("%d%d", &u, &v);
      if (in[v] >= in[u] && in[v] <= out[u]) {
        printf("%lld\n", get1(1, 1, n, in[v]) - get1(1, 1, n, in[u]));
      } else {
        long long ans = get1(1, 1, n, in[v]);
        ans += get2(1, 1, n, in[u], out[u]);
        ans -= get1(1, 1, n, in[u]);
        printf("%lld\n", ans);
      }
    }
  }
}
