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;
struct Fenwick {
  vector<long long> A;
  long long n;
  Fenwick(long long n = 1) : n(n) { A = vector<long long>(n + 1, 0); }
  inline long long lsb(long long x) { return ((x) & (-x)); }
  void add(long long i, long long w) {
    for (; i <= n; i += lsb(i)) {
      A[i] += w;
    }
  }
  long long get(long long i) {
    i = min(i, n);
    long long ret = 0;
    for (; i > 0; i -= lsb(i)) {
      ret += A[i];
    }
    return ret;
  }
};
struct ST {
  long long l, r;
  long long mn = 0;
  ST *left;
  ST *right;
  long long lazy = 0;
  ST(long long l, long long r) : l(l), r(r) {
    if (l < r) {
      left = new ST(l, (l + r) / 2);
      right = new ST((l + r) / 2 + 1, r);
    }
  }
  void fix() {
    mn += lazy;
    if (l < r) {
      left->lazy += lazy;
      right->lazy += lazy;
    }
    lazy = 0;
  }
  long long get(long long a, long long b) {
    fix();
    if (a <= l && r <= b) return mn;
    if (r < a || b < l) return 1e17;
    return min(left->get(a, b), right->get(a, b));
  }
  void add(long long a, long long b, long long w) {
    fix();
    if (a <= l && r <= b) {
      lazy += w;
      return fix();
    }
    if (r < a || b < l) return;
    left->add(a, b, w);
    right->add(a, b, w);
    mn = min(left->mn, right->mn);
  }
  void set(long long i, long long w) {
    fix();
    if (l <= i && i <= r) {
      if (l == r) {
        mn = w;
        return;
      }
      left->set(i, w);
      right->set(i, w);
      mn = min(left->mn, right->mn);
    }
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  long long n, q;
  cin >> n >> q;
  long long d1[n + 1];
  d1[1] = 0;
  vector<long long> adj[n + 1];
  long long a[2 * n];
  long long b[2 * n];
  long long c[2 * n];
  long long d[n + 1];
  d[1] = 0;
  for (long long i = 1; i <= 2 * n - 2; i++) {
    cin >> a[i] >> b[i] >> c[i];
    if (b[i] == 1)
      d1[a[i]] = c[i];
    else {
      adj[a[i]].push_back(b[i]);
      d[b[i]] = c[i];
    }
  }
  long long timer = 1;
  long long in[n + 1];
  long long out[n + 1];
  function<void(long long)> dfs = [&](long long i) {
    in[i] = out[i] = timer++;
    for (long long j : adj[i]) {
      dfs(j);
      out[i] = out[j];
    }
  };
  dfs(1);
  Fenwick W(n + 3);
  for (long long i = 1; i <= n; i++) {
    W.add(in[i], d[i]);
    W.add(out[i] + 1, -d[i]);
  }
  ST XXX(in[1], out[1]);
  for (long long i = 1; i <= n; i++) {
    XXX.set(in[i], d1[i] + W.get(in[i]));
  }
  while (q--) {
    long long t;
    cin >> t;
    if (t == 2) {
      long long x, y;
      cin >> x >> y;
      if (in[x] <= in[y] && in[y] <= out[x]) {
        cout << W.get(in[y]) - W.get(in[x]) << "\n";
      } else {
        cout << XXX.get(in[x], out[x]) - W.get(in[x]) + W.get(in[y]) << "\n";
      }
    } else {
      long long i, w;
      cin >> i >> w;
      if (b[i] == 1) {
        d1[a[i]] = w;
        long long c = a[i];
        XXX.set(in[c], d1[c] + W.get(in[c]));
      } else {
        W.add(in[b[i]], w - c[i]);
        W.add(out[b[i]] + 1, -(w - c[i]));
        XXX.add(in[b[i]], out[b[i]], w - c[i]);
        c[i] = w;
      }
    }
  }
}
