#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
using ll = long long;
int a[N], id[N], dp[N][20], idx, dep[N], root = 1, n, q, sz[N], mp[N];
vector<int> e[N];
void dfs(int pos, int fa) {
  id[pos] = ++idx;
  dp[pos][0] = fa;
  dep[pos] = dep[fa] + 1;
  mp[idx] = pos;
  sz[pos] = 1;
  for (int i = 1; i < 20; i++) dp[pos][i] = dp[dp[pos][i - 1]][i - 1];
  for (auto &i : e[pos])
    if (i != fa) dfs(i, pos), sz[pos] += sz[i];
}
int lca(int a, int b, bool calcLCA = 1) {
  if (dep[a] < dep[b]) swap(a, b);
  if (!calcLCA) {
    for (int i = 19; i >= 0; --i)
      if (dep[dp[a][i]] > dep[b]) a = dp[a][i];
    return a;
  }
  for (int i = 19; i >= 0; --i)
    if (dep[dp[a][i]] >= dep[b]) a = dp[a][i];
  if (a == b) return a;
  for (int i = 19; i >= 0; --i)
    if (dp[a][i] != dp[b][i]) a = dp[a][i], b = dp[b][i];
  return dp[a][0];
}
int LCA(int a, int b) {
  int ans = lca(a, b), x = lca(a, root), y = lca(b, root);
  if (dep[x] > dep[ans]) ans = x;
  if (dep[y] > dep[ans]) ans = y;
  return ans;
}
namespace SegTree {
struct TNode {
  int l, r;
  ll v;
} t[N << 2];
ll lazy[N << 2];
inline int lc(int pos) { return pos << 1; }
inline int rc(int pos) { return pos << 1 | 1; }
inline void pushup(int pos) { t[pos].v = t[lc(pos)].v + t[rc(pos)].v; }
void build(int pos, int l, int r) {
  t[pos].l = l;
  t[pos].r = r;
  if (l == r) {
    t[pos].v = a[mp[l]];
    return;
  }
  int mid = (l + r) >> 1;
  build(lc(pos), l, mid);
  build(rc(pos), mid + 1, r);
  pushup(pos);
}
inline void pushdown(int pos) {
  if (lazy[pos] == 0) return;
  t[lc(pos)].v += lazy[pos] * (t[lc(pos)].r - t[lc(pos)].l + 1);
  t[rc(pos)].v += lazy[pos] * (t[rc(pos)].r - t[rc(pos)].l + 1);
  lazy[lc(pos)] += lazy[pos];
  lazy[rc(pos)] += lazy[pos];
  lazy[pos] = 0;
}
void modify(int pos, int l, int r, int v) {
  if (t[pos].l == l && t[pos].r == r) {
    lazy[pos] += v;
    t[pos].v += (r - l + 1ll) * v;
    return;
  }
  int mid = (t[pos].l + t[pos].r) >> 1;
  pushdown(pos);
  if (r <= mid)
    modify(lc(pos), l, r, v);
  else if (l > mid)
    modify(rc(pos), l, r, v);
  else
    modify(lc(pos), l, mid, v), modify(rc(pos), mid + 1, r, v);
  pushup(pos);
}
ll query(int pos, int l, int r) {
  if (t[pos].l == l && t[pos].r == r) {
    return t[pos].v;
  }
  int mid = (t[pos].l + t[pos].r) >> 1;
  pushdown(pos);
  if (r <= mid)
    return query(lc(pos), l, r);
  else if (l > mid)
    return query(rc(pos), l, r);
  else
    return query(lc(pos), l, mid) + query(rc(pos), mid + 1, r);
}
}  // namespace SegTree
using SegTree::modify;
using SegTree::query;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> q;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i < n; i++) {
    int t1, t2;
    cin >> t1 >> t2;
    e[t1].push_back(t2);
    e[t2].push_back(t1);
  }
  dfs(1, 0);
  SegTree::build(1, 1, n);
  int op, t1, t2, t3;
  for (int i = 1; i <= q; i++) {
    cin >> op >> t1;
    if (op == 1)
      root = t1;
    else if (op == 2) {
      cin >> t2 >> t3;
      t1 = LCA(t1, t2);
      if (t1 == root)
        modify(1, 1, n, t3);
      else if (lca(root, t1) != t1)
        modify(1, id[t1], id[t1] + sz[t1] - 1, t3);
      else {
        t2 = lca(root, t1, 0);
        assert(dp[t2][0] == t1);
        modify(1, 1, n, t3);
        modify(1, id[t2], id[t2] + sz[t2] - 1, -t3);
      }
    } else {
      if (t1 == root)
        cout << query(1, 1, n) << endl;
      else if (lca(root, t1) != t1)
        cout << query(1, id[t1], id[t1] + sz[t1] - 1) << endl;
      else
        t2 = lca(root, t1, 0), assert(dp[t2][0] == t1),
        cout << query(1, 1, n) - query(1, id[t2], id[t2] + sz[t2] - 1) << endl;
    }
  }
  return 0;
}
