#include <bits/stdc++.h>
using namespace std;
const long long N = 300010;
struct edge {
  long long nxt, to;
} e[N << 1];
long long rt, n, m, r, tot, cnt, head[N], dep[N], fa[N], siz[N], son[N], dfn[N],
    w[N], a[N], top[N];
struct tree {
  long long sum, lz;
} tr[N << 2];
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
inline void add(long long u, long long v) {
  e[++cnt].to = v;
  e[cnt].nxt = head[u];
  head[u] = cnt;
}
inline void pushup(long long rt) {
  tr[rt].sum = tr[rt << 1].sum + tr[rt << 1 | 1].sum;
}
inline void pushdown(long long rt, long long l, long long r) {
  long long mid = (l + r) >> 1;
  tr[rt << 1].sum += tr[rt].lz * (mid - l + 1);
  tr[rt << 1].lz += tr[rt].lz;
  tr[rt << 1 | 1].sum += tr[rt].lz * (r - mid);
  tr[rt << 1 | 1].lz += tr[rt].lz;
  tr[rt].lz = 0;
}
void build(long long rt, long long l, long long r) {
  if (l == r) {
    tr[rt].sum = w[l];
    return;
  }
  long long mid = (l + r) >> 1;
  build(rt << 1, l, mid);
  build(rt << 1 | 1, mid + 1, r);
  pushup(rt);
}
void update(long long rt, long long l, long long r, long long L, long long R,
            long long v) {
  if (L <= l && r <= R) {
    tr[rt].sum += v * (r - l + 1);
    tr[rt].lz += v;
    return;
  }
  pushdown(rt, l, r);
  long long mid = (l + r) >> 1;
  if (L <= mid) update(rt << 1, l, mid, L, R, v);
  if (R > mid) update(rt << 1 | 1, mid + 1, r, L, R, v);
  pushup(rt);
}
long long query(long long rt, long long l, long long r, long long L,
                long long R) {
  if (L <= l && r <= R) return tr[rt].sum;
  pushdown(rt, l, r);
  long long mid = (l + r) >> 1, ans = 0;
  if (L <= mid) ans += query(rt << 1, l, mid, L, R);
  if (R > mid) ans += query(rt << 1 | 1, mid + 1, r, L, R);
  return ans;
}
void dfs1(long long u, long long f, long long deep) {
  dep[u] = deep;
  fa[u] = f;
  siz[u] = 1;
  for (long long i = head[u]; i; i = e[i].nxt) {
    long long v = e[i].to;
    if (v == f) continue;
    dfs1(v, u, deep + 1);
    siz[u] += siz[v];
    if (siz[v] > siz[son[u]]) son[u] = v;
  }
}
void dfs2(long long u, long long _top) {
  dfn[u] = ++tot;
  w[tot] = a[u];
  top[u] = _top;
  if (!son[u]) return;
  dfs2(son[u], _top);
  for (long long i = head[u]; i; i = e[i].nxt) {
    long long v = e[i].to;
    if (v == fa[u] || v == son[u]) continue;
    dfs2(v, v);
  }
}
inline long long lca(long long x, long long y) {
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) x ^= y ^= x ^= y;
    x = fa[top[x]];
  }
  if (dep[x] > dep[y]) x ^= y ^= x ^= y;
  return x;
}
inline long long find(long long x, long long y) {
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) x ^= y ^= x ^= y;
    if (fa[top[x]] == y) return top[x];
    x = fa[top[x]];
  }
  if (dep[x] > dep[y]) x ^= y ^= x ^= y;
  return son[x];
}
inline long long LCA(long long x, long long y) {
  if (dep[x] > dep[y]) x ^= y ^= x ^= y;
  if (lca(x, y) == x) {
    if (dfn[rt] >= dfn[y] && dfn[rt] <= dfn[y] + siz[y] - 1) return y;
    if (lca(x, rt) == x) return lca(y, rt);
    return x;
  }
  if (dfn[rt] >= dfn[x] && dfn[rt] <= dfn[x] + siz[x] - 1) return x;
  if (dfn[rt] >= dfn[y] && dfn[rt] <= dfn[y] + siz[y] - 1) return y;
  if ((lca(x, rt) == rt && lca(x, y) == lca(y, rt)) ||
      (lca(y, rt) == rt && lca(x, y) == lca(x, rt)))
    return rt;
  if (lca(x, rt) == lca(y, rt)) return lca(x, y);
  if (lca(x, y) != lca(x, rt)) return lca(x, rt);
  return lca(y, rt);
}
inline void modify(long long x, long long v) {
  if (rt == x) {
    update(1, 1, n, 1, n, v);
    return;
  }
  if (lca(rt, x) != x)
    update(1, 1, n, dfn[x], dfn[x] + siz[x] - 1, v);
  else {
    long long p = find(rt, x);
    update(1, 1, n, 1, n, v);
    update(1, 1, n, dfn[p], dfn[p] + siz[p] - 1, -v);
  }
}
inline long long ask(long long x) {
  if (x == rt) return query(1, 1, n, 1, n);
  if (lca(rt, x) != x) return query(1, 1, n, dfn[x], dfn[x] + siz[x] - 1);
  long long p = find(rt, x);
  return query(1, 1, n, 1, n) - query(1, 1, n, dfn[p], dfn[p] + siz[p] - 1);
}
signed main() {
  n = read();
  m = read();
  rt = 1;
  for (long long i = 1; i <= n; i++) a[i] = read();
  for (long long i = 1, u, v; i < n; i++) {
    u = read(), v = read();
    add(u, v);
    add(v, u);
  }
  dfs1(1, 0, 1);
  dfs2(1, 1);
  build(1, 1, n);
  while (m--) {
    long long opt = read();
    if (opt == 1) rt = read();
    if (opt == 2) {
      long long u = read(), v = read(), w = read();
      modify(LCA(u, v), w);
    }
    if (opt == 3) {
      long long k = read();
      printf("%lld\n", ask(k));
    }
  }
  return 0;
}
