#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200100;
const int MAXLG = 20;
long long st[4 * MAXN];
long long lazy[4 * MAXN];
void build_st(int nod, int l, int r, long long *val) {
  if (l == r) {
    st[nod] = val[l];
    return;
  }
  int ls = nod * 2, rs = ls + 1;
  int mid = (l + r) / 2;
  build_st(ls, l, mid, val);
  build_st(rs, mid + 1, r, val);
  st[nod] = st[ls] + st[rs];
}
void propagate_st(int nod, int l, int r) {
  if (lazy[nod]) {
    st[nod] += (long long)(r - l + 1) * lazy[nod];
    if (l < r) {
      int ls = nod * 2, rs = ls + 1;
      lazy[ls] += lazy[nod];
      lazy[rs] += lazy[nod];
    }
  }
  lazy[nod] = 0;
}
void upd_st(int nod, int l, int r, int lq, int rq, long long upd) {
  propagate_st(nod, l, r);
  if (rq < l || r < lq) {
    return;
  }
  if (lq <= l && r <= rq) {
    lazy[nod] += upd;
    propagate_st(nod, l, r);
    return;
  }
  int ls = nod * 2, rs = ls + 1;
  int mid = (l + r) / 2;
  upd_st(ls, l, mid, lq, rq, upd);
  upd_st(rs, mid + 1, r, lq, rq, upd);
  st[nod] = st[ls] + st[rs];
}
long long query_st(int nod, int l, int r, int lq, int rq) {
  propagate_st(nod, l, r);
  if (rq < l || r < lq) {
    return 0;
  }
  if (lq <= l && r <= rq) {
    return st[nod];
  }
  int ls = nod * 2, rs = ls + 1;
  int mid = (l + r) / 2;
  return query_st(ls, l, mid, lq, rq) + query_st(rs, mid + 1, r, lq, rq);
}
int ancest[MAXN][MAXLG];
long long a[MAXN];
vector<int> g[MAXN];
int lev[MAXN];
int nod[MAXN];
long long val[MAXN];
int ini[MAXN];
int fin[MAXN];
bool mk[MAXN];
int t = 0;
void dfs(int u, int p) {
  t++;
  mk[u] = true;
  lev[u] = lev[p] + 1;
  nod[t] = u;
  ini[u] = t;
  ancest[u][0] = p;
  for (int i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (!mk[v]) {
      dfs(v, u);
    }
  }
  fin[u] = t;
}
int get_lca(int u, int v) {
  if (lev[u] < lev[v]) {
    swap(u, v);
  }
  for (int lg = MAXLG - 1; lg >= 0; lg--) {
    if (ancest[u][lg] && lev[ancest[u][lg]] >= lev[v]) {
      u = ancest[u][lg];
    }
  }
  if (u == v) {
    return u;
  }
  for (int lg = MAXLG - 1; lg >= 0; lg--) {
    if (ancest[u][lg] && ancest[u][lg] != ancest[v][lg]) {
      u = ancest[u][lg];
      v = ancest[v][lg];
    }
  }
  return ancest[u][0];
}
int getSubtree(int u, int v) {
  for (int lg = MAXLG - 1; lg >= 0; lg--) {
    if (ancest[v][lg] && lev[ancest[v][lg]] > lev[u]) {
      v = ancest[v][lg];
    }
  }
  return v;
}
int dist(int u, int v, int lca = 0) {
  if (!lca) {
    lca = get_lca(u, v);
  }
  return lev[u] + lev[v] - 2 * lev[lca];
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  t = 0;
  dfs(1, 0);
  for (int i = 1; i <= n; i++) {
    val[i] = a[nod[i]];
  }
  build_st(1, 1, n, val);
  for (int lg = 1; lg < MAXLG; lg++) {
    for (int u = 1; u <= n; u++) {
      ancest[u][lg] = ancest[ancest[u][lg - 1]][lg - 1];
    }
  }
  int ro = 1;
  while (q--) {
    int op;
    cin >> op;
    if (op == 1) {
      cin >> ro;
    } else if (op == 2) {
      int u, v;
      long long x;
      cin >> u >> v >> x;
      int lca = get_lca(u, v);
      int tmp = 0;
      if (dist(u, v, lca) == dist(u, ro) + dist(ro, v)) {
        upd_st(1, 1, n, 1, n, x);
      } else if (get_lca(lca, ro) != lca) {
        upd_st(1, 1, n, ini[lca], fin[lca], x);
      } else if (lev[u] > lev[v] &&
                 dist(lca, ro) == dist(ro, u) + dist(u, lca)) {
        int s = getSubtree(u, ro);
        upd_st(1, 1, n, 1, n, x);
        upd_st(1, 1, n, ini[s], fin[s], -x);
      } else if (lev[v] > lev[u] &&
                 dist(lca, ro) == dist(ro, v) + dist(v, lca)) {
        int s = getSubtree(v, ro);
        upd_st(1, 1, n, 1, n, x);
        upd_st(1, 1, n, ini[s], fin[s], -x);
      } else if ((tmp = get_lca(ro, u)) != lca ||
                 (tmp = get_lca(ro, v)) != lca) {
        int s = getSubtree(tmp, ro);
        upd_st(1, 1, n, 1, n, x);
        upd_st(1, 1, n, ini[s], fin[s], -x);
      } else {
        int s = getSubtree(lca, ro);
        upd_st(1, 1, n, 1, n, x);
        upd_st(1, 1, n, ini[s], fin[s], -x);
      }
    } else if (op == 3) {
      int u;
      cin >> u;
      if (u == ro) {
        cout << query_st(1, 1, n, 1, n) << '\n';
      } else if (get_lca(u, ro) != u) {
        cout << query_st(1, 1, n, ini[u], fin[u]) << '\n';
      } else {
        int s = getSubtree(u, ro);
        cout << query_st(1, 1, n, 1, n) - query_st(1, 1, n, ini[s], fin[s])
             << '\n';
      }
    }
  }
}
