#include <bits/stdc++.h>
using namespace std;
int input() {
  int f = 1, s = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    s = s * 10 + c - '0';
    c = getchar();
  }
  return s * f;
}
const int N = 100050;
struct Edge {
  int to, ne;
} ed[N << 1];
int n, q, rt, dfn_tot;
int dfn[N], tim[N];
int fi[N], tot, fa[N][18];
int v[N], vv[N], dep[N];
void added(int a, int b) {
  ed[++tot].to = b;
  ed[tot].ne = fi[a];
  fi[a] = tot;
  ed[++tot].to = a;
  ed[tot].ne = fi[b];
  fi[b] = tot;
}
void dfs(const int &x) {
  dfn[x] = ++dfn_tot;
  for (int i = fi[x]; i; i = ed[i].ne)
    if (!dfn[ed[i].to]) {
      fa[ed[i].to][0] = x;
      dep[ed[i].to] = dep[x] + 1;
      dfs(ed[i].to);
    }
  tim[x] = dfn_tot;
}
int lca(int x, int y) {
  if (x == y) return x;
  if (dep[x] < dep[y]) swap(x, y);
  int d = dep[x] - dep[y];
  for (int i = 17; ~i; --i)
    if (d & (1 << i)) x = fa[x][i];
  if (x == y) return x;
  for (int i = 17; ~i; --i) {
    if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];
  }
  return fa[x][0];
}
long long sum[N << 2], col[N << 2];
void pushup(int rt) { sum[rt] = sum[rt << 1] + sum[rt << 1 | 1]; }
void pushdown(int l, int r, int rt) {
  if (col[rt]) {
    int mid = l + r >> 1;
    sum[rt << 1] += col[rt] * (mid - l + 1);
    sum[rt << 1 | 1] += col[rt] * (r - mid);
    col[rt << 1] += col[rt];
    col[rt << 1 | 1] += col[rt];
    col[rt] = 0;
  }
}
void build(int l, int r, int rt) {
  if (l == r) {
    sum[rt] = vv[l], col[rt] = 0;
    return;
  }
  int mid = l + r >> 1;
  build(l, mid, rt << 1);
  build(mid + 1, r, rt << 1 | 1);
  pushup(rt);
}
void update(int L, int R, int v, int l, int r, int rt) {
  if (L > R) return;
  if (L <= l && R >= r) {
    sum[rt] += 1ll * (r - l + 1) * v;
    col[rt] += v;
    return;
  }
  pushdown(l, r, rt);
  int mid = l + r >> 1;
  if (L <= mid) update(L, R, v, l, mid, rt << 1);
  if (R > mid) update(L, R, v, mid + 1, r, rt << 1 | 1);
  pushup(rt);
}
long long query(int L, int R, int l, int r, int rt) {
  if (L > R) return 0;
  if (L <= l && R >= r) return sum[rt];
  pushdown(l, r, rt);
  long long res = 0;
  int mid = l + r >> 1;
  if (L <= mid) res = query(L, R, l, mid, rt << 1);
  if (R > mid) res += query(L, R, mid + 1, r, rt << 1 | 1);
  return res;
}
int dis(int u, int x, int y) {
  int a = lca(u, x), b = lca(u, y);
  return dep[u] + dep[x] - 2 * dep[a] + dep[u] + dep[y] - 2 * dep[b];
}
int main() {
  n = input();
  q = input();
  for (int i = 1; i <= n; ++i) v[i] = input();
  for (int a, b, i = 1; i < n; ++i) {
    a = input();
    b = input();
    added(a, b);
  }
  dfs(1);
  rt = 1;
  for (int i = 1; i <= n; ++i) vv[dfn[i]] = v[i];
  build(1, n, 1);
  for (int j = 1; j <= 17; ++j)
    for (int i = 1; i <= n; ++i) fa[i][j] = fa[fa[i][j - 1]][j - 1];
  for (int op, x, y, z, k, t, w, u, v; q--;) {
    op = input();
    if (op == 1) {
      rt = input();
    } else if (op == 2) {
      x = input();
      y = input();
      z = input();
      u = lca(x, rt);
      v = lca(y, rt);
      w = lca(x, y);
      t = (dep[u] > dep[v] ? u : v);
      if (lca(w, t) != w) {
        update(dfn[w], tim[w], z, 1, n, 1);
      } else {
        k = rt;
        for (int i = 17; ~i && dep[k] > dep[t] + 1; --i)
          if (dep[fa[k][i]] >= dep[t] + 1) k = fa[k][i];
        col[1] += z;
        sum[1] += 1ll * n * z;
        if (k != t) update(dfn[k], tim[k], -z, 1, n, 1);
      }
    } else if (op == 3) {
      x = input();
      if (rt == x)
        cout << sum[1] << endl;
      else if (dfn[x] <= dfn[rt] && tim[x] >= tim[rt]) {
        y = rt;
        z = dep[y] - dep[x] - 1;
        for (int i = 17; ~i; --i)
          if (z & (1 << i)) y = fa[y][i];
        printf("%I64d\n",
               query(1, dfn[y] - 1, 1, n, 1) + query(tim[y] + 1, n, 1, n, 1));
      } else
        printf("%I64d\n", query(dfn[x], tim[x], 1, n, 1));
    }
  }
}
