description: Chanek Jones is back, helping his long-lost relative Indiana Jones, to find a secret treasure in a maze buried below a desert full of illusions.
  
  The map of the labyrinth forms a tree with n rooms numbered from 1 to n and n - 1 tunnels connecting them such that it is possible to travel between each pair of rooms through several tunnels.
  
  The i-th room (1 ≤ i ≤ n) has a_i illusion rate. To go from the x-th room to the y-th room, there must exist a tunnel between x and y, and it takes max(|a_x + a_y|, |a_x - a_y|) energy. |z| denotes the absolute value of z.
  
  To prevent grave robbers, the maze can change the illusion rate of any room in it. Chanek and Indiana would ask q queries.
  
  There are two types of queries to be done:
  
    * 1\ u\ c — The illusion rate of the x-th room is changed to c (1 ≤ u ≤ n, 0 ≤ |c| ≤ 10^9). 
    * 2\ u\ v — Chanek and Indiana ask you the minimum sum of energy needed to take the secret treasure at room v if they are initially at room u (1 ≤ u, v ≤ n). 
  
  
  
  Help them, so you can get a portion of the treasure!
  
  Input
  
  The first line contains two integers n and q (2 ≤ n ≤ 10^5, 1 ≤ q ≤ 10^5) — the number of rooms in the maze and the number of queries.
  
  The second line contains n integers a_1, a_2, …, a_n (0 ≤ |a_i| ≤ 10^9) — inital illusion rate of each room.
  
  The i-th of the next n-1 lines contains two integers s_i and t_i (1 ≤ s_i, t_i ≤ n), meaning there is a tunnel connecting s_i-th room and t_i-th room. The given edges form a tree.
  
  The next q lines contain the query as described. The given queries are valid.
  
  Output
  
  For each type 2 query, output a line containing an integer — the minimum sum of energy needed for Chanek and Indiana to take the secret treasure.
  
  Example
  
  Input
  
  
  6 4
  10 -9 2 -1 4 -6
  1 5
  5 4
  5 6
  6 2
  6 3
  2 1 2
  1 1 -3
  2 1 2
  2 3 3
  
  
  Output
  
  
  39
  32
  0
  
  Note
  
  <image>
  
  In the first query, their movement from the 1-st to the 2-nd room is as follows.
  
    * 1 → 5 — takes max(|10 + 4|, |10 - 4|) = 14 energy. 
    * 5 → 6 — takes max(|4 + (-6)|, |4 - (-6)|) = 10 energy. 
    * 6 → 2 — takes max(|-6 + (-9)|, |-6 - (-9)|) = 15 energy. 
  
  In total, it takes 39 energy.
  
  In the second query, the illusion rate of the 1-st room changes from 10 to -3.
  
  In the third query, their movement from the 1-st to the 2-nd room is as follows.
  
    * 1 → 5 — takes max(|-3 + 4|, |-3 - 4|) = 7 energy. 
    * 5 → 6 — takes max(|4 + (-6)|, |4 - (-6)|) = 10 energy. 
    * 6 → 2 — takes max(|-6 + (-9)|, |-6 - (-9)|) = 15 energy. 
  
  
  
  Now, it takes 32 energy.
solution: #include <bits/stdc++.h>
  #pragma GCC optimize("Ofast")
  #pragma GCC optimize("unroll-loops")
  using namespace std;
  const long long mod = 1e9 + 7;
  const double PI = acos(-1.0);
  const double eps = 1e-8;
  long long powmod(long long a, long long b) {
    long long res = 1;
    a %= mod;
    assert(b >= 0);
    for (; b; b >>= 1) {
      if (b & 1) res = res * a % mod;
      a = a * a % mod;
    }
    return res;
  }
  const int maxn = 200005;
  int cnt;
  long long l[maxn], r[maxn], a[maxn], dfn[maxn], d[maxn];
  int deep[maxn], lg[maxn], fa[maxn][22];
  vector<int> e[maxn];
  void dfs(int cur, int par, long long dis) {
    l[cur] = ++cnt;
    deep[cur] = deep[par] + 1;
    fa[cur][0] = par;
    d[cur] = dis + a[cur];
    for (int i = 1; i <= lg[deep[cur]]; ++i) {
      fa[cur][i] = fa[fa[cur][i - 1]][i - 1];
    }
    for (auto it : e[cur]) {
      if (it == par) continue;
      dfs(it, cur, d[cur]);
    }
    r[cur] = ++cnt;
    dfn[l[cur]] = dfn[r[cur]] = d[cur];
  }
  struct node {
    int l, r;
    long long val, addv;
  } tree[maxn << 2];
  void build(int o, int l, int r) {
    tree[o].l = l;
    tree[o].r = r;
    if (l == r) {
      tree[o].val = dfn[l];
      return;
    }
    int mid = (l + r) >> 1;
    build(o * 2, l, mid);
    build(o * 2 + 1, mid + 1, r);
  }
  void pushdown(int o) {
    if (tree[o].addv) {
      tree[o * 2].val += tree[o].addv * (tree[o * 2].r - tree[o * 2].l + 1);
      tree[o * 2 + 1].val +=
          tree[o].addv * (tree[o * 2 + 1].r - tree[o * 2 + 1].l + 1);
      tree[o * 2].addv += tree[o].addv;
      tree[o * 2 + 1].addv += tree[o].addv;
      tree[o].addv = 0;
    }
  }
  void change(int o, int l, int r, int k) {
    if (tree[o].l >= l && tree[o].r <= r) {
      tree[o].val += k * (tree[o].r - tree[o].l + 1);
      tree[o].addv += k;
      return;
    }
    pushdown(o);
    int mid = (tree[o].l + tree[o].r) >> 1;
    if (mid >= l) change(o * 2, l, r, k);
    if (mid < r) change(o * 2 + 1, l, r, k);
    tree[o].val = tree[o * 2].val + tree[o * 2 + 1].val;
  }
  long long ask(int o, int l, int r) {
    if (tree[o].l >= l && tree[o].r <= r) {
      return tree[o].val;
    }
    pushdown(o);
    int mid = (tree[o].l + tree[o].r) >> 1;
    long long ans = 0;
    if (mid >= l) ans += ask(o * 2, l, r);
    if (mid < r) ans += ask(o * 2 + 1, l, r);
    return ans;
  }
  int lca(int x, int y) {
    if (deep[x] < deep[y]) {
      swap(x, y);
    }
    while (deep[x] > deep[y]) {
      x = fa[x][lg[deep[x] - deep[y]] - 1];
    }
    if (x == y) return x;
    for (int k = lg[deep[x]] - 1; k >= (0); --k) {
      if (fa[x][k] != fa[y][k]) {
        x = fa[x][k], y = fa[y][k];
      }
    }
    return fa[x][0];
  }
  int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, q;
    cin >> n >> q;
    for (int i = 1; i <= n; ++i) {
      lg[i] = lg[i - 1] + (1 << lg[i - 1] == i);
    }
    for (int i = 1; i <= n; ++i) {
      cin >> a[i];
      a[i] = abs(a[i]);
    }
    for (int i = 1; i < n; ++i) {
      int u, v;
      cin >> u >> v;
      e[u].push_back(v);
      e[v].push_back(u);
    }
    dfs(1, 0, 0);
    build(1, 1, 2 * n);
    while (q--) {
      long long op, u, v;
      cin >> op >> u >> v;
      if (op == 1) {
        v = abs(v);
        change(1, l[u], r[u], v - a[u]);
        a[u] = v;
      } else {
        int x = lca(u, v);
        long long ans = ask(1, l[u], l[u]) + ask(1, l[v], l[v]) -
                        2 * ask(1, l[x], l[x]) + a[x];
        ans = ans * 2 - a[u] - a[v];
        cout << ans << endl;
      }
    }
    return 0;
  }
  