#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")
const long long maxn = 1e5 + 10, maxm = 1e7 + 10, lg = 16, mod = 1e9 + 7,
                inf = 1e18;
long long n, q, ww[maxn], root = 1;
vector<long long> g[maxn];
long long st[maxn], ft[maxn], tt, h[maxn], par[maxn][lg + 1];
void pfs(long long v = 1, long long p = 0) {
  st[v] = tt++;
  h[v] = h[p] + 1;
  par[v][0] = p;
  for (int i = 1; i <= lg; i++) par[v][i] = par[par[v][i - 1]][i - 1];
  for (auto u : g[v])
    if (u != p) pfs(u, v);
  ft[v] = tt;
}
long long gup(long long v, long long x) {
  for (int i = 0; i <= lg; i++)
    if (x >> i & 1) v = par[v][i];
  return v;
}
long long lca(long long v, long long u) {
  if (h[v] > h[u]) swap(v, u);
  u = gup(u, h[u] - h[v]);
  if (v == u) return v;
  for (int i = lg; i >= 0; i--)
    if (par[v][i] != par[u][i]) v = par[v][i], u = par[u][i];
  return par[v][0];
}
bool ispar(long long v, long long u) {
  return st[v] <= st[u] && ft[v] >= ft[u];
}
long long sum[maxn << 2], laz[maxn << 2];
void app(long long s, long long t, long long v, long long x) {
  sum[v] += (t - s) * x;
  laz[v] += x;
}
void shift(long long s, long long t, long long v) {
  if (laz[v] == 0) return;
  app(s, ((s + t) >> 1), (v << 1), laz[v]);
  app(((s + t) >> 1), t, ((v << 1) ^ 1), laz[v]);
  laz[v] = 0;
}
void add(long long l, long long r, long long x, long long s = 0,
         long long t = tt, long long v = 1) {
  if (l >= t || r <= s) return;
  if (l <= s && r >= t) return app(s, t, v, x);
  shift(s, t, v);
  add(l, r, x, s, ((s + t) >> 1), (v << 1));
  add(l, r, x, ((s + t) >> 1), t, ((v << 1) ^ 1));
  sum[v] = sum[(v << 1)] + sum[((v << 1) ^ 1)];
}
long long get(long long l, long long r, long long s = 0, long long t = tt,
              long long v = 1) {
  if (l >= t || r <= s) return 0;
  if (l <= s && r >= t) return sum[v];
  shift(s, t, v);
  return get(l, r, s, ((s + t) >> 1), (v << 1)) +
         get(l, r, ((s + t) >> 1), t, ((v << 1) ^ 1));
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> q;
  for (int i = 1; i <= n; i++) cin >> ww[i];
  for (int i = 1; i < n; i++) {
    long long v, u;
    cin >> v >> u;
    g[v].push_back(u), g[u].push_back(v);
  }
  pfs();
  for (int i = 1; i <= n; i++) add(st[i], st[i] + 1, ww[i]);
  while (q--) {
    long long ty;
    cin >> ty;
    if (ty == 1) cin >> root;
    if (ty == 2) {
      long long v, u, x;
      cin >> v >> u >> x;
      long long w = lca(v, u), w1 = lca(v, root), w2 = lca(u, root);
      if (ispar(w, root)) {
        w = (h[w1] > h[w2] ? w1 : w2);
        long long br = gup(root, h[root] - h[w] - 1);
        add(st[1], ft[1], x);
        add(st[br], ft[br], -x);
      } else
        add(st[w], ft[w], x);
    }
    if (ty == 3) {
      long long v;
      cin >> v;
      if (v == root)
        cout << get(st[1], ft[1]) << '\n';
      else if (ispar(v, root)) {
        long long br = gup(root, h[root] - h[v] - 1);
        cout << get(st[1], ft[1]) - get(st[br], ft[br]) << '\n';
      } else
        cout << get(st[v], ft[v]) << '\n';
    }
  }
  return 0;
}
