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 mx = 2e5 + 5;
struct node {
  int v;
  int u;
  long long w;
  int next;
} E[2 * mx];
int tot = 0, dfn = 0;
int head[mx], L[mx], R[mx];
long long lazy[mx << 4], T[mx << 4];
long long v[mx << 2];
long long dis[mx];
bool vis[mx];
void add(int u, int v, long long w) {
  tot++;
  E[tot].v = v;
  E[tot].w = w;
  E[tot].u = u;
  E[tot].next = head[u];
  head[u] = tot;
}
void dfs(int u, long long sum) {
  vis[u] = 1;
  int s = head[u];
  L[u] = ++dfn;
  v[dfn] = sum + dis[u];
  for (int i = head[u]; i; i = E[i].next) {
    long long w = E[i].w;
    if (!vis[E[i].v]) dfs(E[i].v, sum + w);
  }
  R[u] = ++dfn;
  v[dfn] = sum + dis[u];
}
void push_down(int rt) {
  if (lazy[rt]) {
    lazy[2 * rt] += lazy[rt];
    lazy[2 * rt | 1] += lazy[rt];
    T[2 * rt] += lazy[rt];
    T[2 * rt | 1] += lazy[rt];
    lazy[rt] = 0;
  }
}
void built(int rt, int L, int R) {
  if (L == R) {
    T[rt] = v[L];
    return;
  }
  built(2 * rt, L, (L + R) / 2);
  built(2 * rt | 1, (L + R) / 2 + 1, R);
  T[rt] = min(T[2 * rt], T[2 * rt | 1]);
}
void update(int rt, int L, int R, int l, int r, int v) {
  if (L >= l && R <= r) {
    T[rt] += v;
    lazy[rt] += v;
    return;
  }
  push_down(rt);
  if (l > (L + R) / 2)
    update(2 * rt | 1, (L + R) / 2 + 1, R, l, r, v);
  else if (r <= (L + R) / 2)
    update(2 * rt, L, (L + R) / 2, l, r, v);
  else {
    update(2 * rt, L, (L + R) / 2, l, (L + R) / 2, v);
    update(2 * rt | 1, (L + R) / 2 + 1, R, (L + R) / 2 + 1, r, v);
  }
  T[rt] = min(T[2 * rt], T[2 * rt | 1]);
}
long long query(int rt, int L, int R, int l, int r) {
  if (L >= l && R <= r) return T[rt];
  push_down(rt);
  if (l > (L + R) / 2)
    return query(2 * rt | 1, (L + R) / 2 + 1, R, l, r);
  else if (r <= (L + R) / 2)
    return query(2 * rt, L, (L + R) / 2, l, r);
  else
    return min(query(2 * rt, L, (L + R) / 2, l, (L + R) / 2),
               query(2 * rt | 1, (L + R) / 2 + 1, R, (L + R) / 2 + 1, r));
}
bool ischild(int u, int v) { return L[v] >= L[u] && R[v] <= R[u]; }
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  for (int i = 1; i < n; i++) {
    int u, v;
    long long w;
    scanf("%d%d%I64d", &u, &v, &w);
    add(u, v, w);
  }
  dis[1] = 0;
  for (int i = 1; i < n; i++) {
    int u, v;
    long long w;
    scanf("%d%d%I64d", &u, &v, &w);
    dis[u] = w;
    add(u, v, w);
  }
  dfs(1, 0);
  built(1, 1, dfn);
  while (q--) {
    int casei, x, y;
    scanf("%d%d%d", &casei, &x, &y);
    if (casei == 1) {
      if (x < n)
        update(1, 1, dfn, L[E[x].v], R[E[x].v], y - E[x].w);
      else {
        update(1, 1, dfn, L[E[x].u], L[E[x].u], y - E[x].w);
        update(1, 1, dfn, R[E[x].u], R[E[x].u], y - E[x].w);
        dis[E[x].u] = y;
      }
      E[x].w = y;
    } else {
      long long ans = 0;
      if (ischild(x, y))
        ans = query(1, 1, dfn, L[y], L[y]) - dis[y] -
              query(1, 1, dfn, L[x], L[x]) + dis[x];
      else
        ans = query(1, 1, dfn, L[x], R[x]) - query(1, 1, dfn, L[x], L[x]) +
              dis[x] + query(1, 1, dfn, L[y], L[y]) - dis[y];
      printf("%I64d\n", ans);
    }
  }
  return 0;
}
