#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
const int MAXLOG = 20;
long long t[4 * MAXN], c[4 * MAXN], val[4 * MAXN], a[MAXN];
int up[MAXN][MAXLOG];
vector<int> g[MAXN];
int tin[MAXN], tout[MAXN], timer, counter, id[MAXN];
pair<int, int> seg[MAXN];
void dfs(int v, int parent) {
  tin[v] = ++timer;
  up[v][0] = parent;
  id[v] = ++counter;
  seg[v] = {counter, counter};
  for (int i = 1; i < MAXLOG; i++) {
    up[v][i] = up[up[v][i - 1]][i - 1];
  }
  for (auto to : g[v]) {
    if (to == parent) continue;
    dfs(to, v);
    seg[v].second = seg[to].second;
  }
  tout[v] = ++timer;
}
void push(int v, int tl, int tr) {
  if (!c[v]) return;
  int tm = (tl + tr) / 2;
  t[v * 2] += (long long)(tm - tl + 1) * val[v];
  t[v * 2 + 1] += (long long)(tr - tm) * val[v];
  c[v * 2] = c[v * 2 + 1] = true;
  val[v * 2] += val[v];
  val[v * 2 + 1] += val[v];
  c[v] = false;
  val[v] = 0;
}
void update(int v, int tl, int tr, int l, int r, long long z) {
  if (tl == l && tr == r) {
    t[v] += (long long)(tr - tl + 1) * z;
    c[v] = true;
    val[v] += z;
  } else {
    int tm = (tl + tr) / 2;
    push(v, tl, tr);
    if (tm >= r) {
      update(v * 2, tl, tm, l, r, z);
    } else if (tm < l) {
      update(v * 2 + 1, tm + 1, tr, l, r, z);
    } else {
      update(v * 2, tl, tm, l, tm, z);
      update(v * 2 + 1, tm + 1, tr, tm + 1, r, z);
    }
    t[v] = t[v * 2] + t[v * 2 + 1];
  }
}
long long query(int v, int tl, int tr, int l, int r) {
  if (tl == l && tr == r) {
    return t[v];
  } else {
    int tm = (tl + tr) / 2;
    push(v, tl, tr);
    if (tm >= r) {
      return query(v * 2, tl, tm, l, r);
    } else if (tm < l) {
      return query(v * 2 + 1, tm + 1, tr, l, r);
    } else {
      return query(v * 2, tl, tm, l, tm) +
             query(v * 2 + 1, tm + 1, tr, tm + 1, r);
    }
  }
}
bool isAncestor(int a, int b) {
  return (tin[a] <= tin[b] && tout[a] >= tout[b]);
}
int LCA(int a, int b) {
  if (isAncestor(a, b)) return a;
  if (isAncestor(b, a)) return b;
  for (int i = MAXLOG - 1; i >= 0; i--) {
    if (!isAncestor(up[a][i], b)) a = up[a][i];
  }
  return up[a][0];
}
int findFirstChild(int a, int b) {
  for (int i = MAXLOG - 1; i >= 0; i--) {
    if (!isAncestor(up[b][i], a)) b = up[b][i];
  }
  return b;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  timer = 0;
  counter = 0;
  dfs(1, 1);
  for (int i = 1; i <= n; i++) {
    update(1, 1, n, id[i], id[i], a[i]);
  }
  int root = 1;
  for (int i = 0; i < q; i++) {
    int type;
    cin >> type;
    if (type == 1) {
      int x;
      cin >> x;
      root = x;
    } else if (type == 2) {
      int u, v, x;
      cin >> u >> v >> x;
      int lca = LCA(u, v);
      if (lca == root) {
        update(1, 1, n, 1, n, x);
        continue;
      }
      if (((isAncestor(root, u)) && (!isAncestor(root, v))) ||
          ((isAncestor(root, v)) && (!isAncestor(root, u)))) {
        update(1, 1, n, 1, n, x);
        continue;
      }
      if (!isAncestor(lca, root)) {
        update(1, 1, n, seg[lca].first, seg[lca].second, x);
        continue;
      }
      int vert = root;
      for (int i = MAXLOG - 1; i >= 0; i--) {
        if ((!isAncestor(up[vert][i], v)) && (!isAncestor(up[vert][i], u)))
          vert = up[vert][i];
      }
      update(1, 1, n, 1, n, x);
      update(1, 1, n, seg[vert].first, seg[vert].second, -x);
    } else if (type == 3) {
      int x;
      cin >> x;
      long long ans;
      if (x == root) {
        ans = t[1];
      } else if (!isAncestor(x, root)) {
        ans = query(1, 1, n, seg[x].first, seg[x].second);
      } else {
        int fc = findFirstChild(x, root);
        ans = t[1] - query(1, 1, n, seg[fc].first, seg[fc].second);
      }
      cout << ans << "\n";
    }
  }
  return 0;
}
