#include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)1e18;
const long long mod = (long long)1e9 + 7;
const double eps = (double)1e-9;
const double pi = acos(-1.0);
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};
const int N = 100500;
long long t[N << 2], k[N << 2];
int n, q, m, a[N], eu[N];
vector<int> g[N], gn[N];
int timer, tin[N], tout[N], up[N][17];
void dfs(int v, int pr = -1) {
  tin[v] = ++timer;
  eu[++m] = a[v];
  for (auto to : g[v]) {
    if (to == pr) continue;
    gn[v].push_back(to);
    up[to][0] = v;
    dfs(to, v);
  }
  tout[v] = timer;
}
inline bool p(int x, int y) { return (tin[x] <= tin[y] && tout[y] <= tout[x]); }
inline int lca(int x, int y) {
  if (p(x, y)) return x;
  if (p(y, x)) return y;
  for (int i = 16; i >= 0; i--)
    if (up[x][i] && !p(up[x][i], y)) x = up[x][i];
  return up[x][0];
}
void build(int v, int l, int r) {
  if (l == r) {
    t[v] = eu[r];
    return;
  }
  int mid = (l + r) >> 1;
  build(v << 1, l, mid);
  build(v << 1 | 1, mid + 1, r);
  t[v] = t[v << 1] + t[v << 1 | 1];
}
inline void push(int v, int l, int r) {
  int mid = (l + r) >> 1;
  t[v << 1] += (mid - l + 1) * 1ll * k[v];
  k[v << 1] += k[v];
  t[v << 1 | 1] += (r - mid) * 1ll * k[v];
  k[v << 1 | 1] += k[v];
  k[v] = 0;
}
void upd(int v, int l, int r, int lx, int rx, int x) {
  if (rx < l || r < lx) return;
  if (lx <= l && r <= rx) {
    t[v] += (r - l + 1) * 1ll * x;
    k[v] += x;
    return;
  }
  push(v, l, r);
  int mid = (l + r) >> 1;
  upd(v << 1, l, mid, lx, rx, x);
  upd(v << 1 | 1, mid + 1, r, lx, rx, x);
  t[v] = t[v << 1] + t[v << 1 | 1];
}
long long get(int v, int l, int r, int lx, int rx) {
  if (rx < l || r < lx) return 0;
  if (lx <= l && r <= rx) return t[v];
  push(v, l, r);
  int mid = (l + r) >> 1;
  return get(v << 1, l, mid, lx, rx) + get(v << 1 | 1, mid + 1, r, lx, rx);
}
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::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 x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  dfs(1);
  for (int j = 1; j <= 16; j++)
    for (int i = 1; i <= n; i++) up[i][j] = up[up[i][j - 1]][j - 1];
  build(1, 1, n);
  int root = 1;
  for (int i = 1; i <= q; i++) {
    int tp;
    cin >> tp;
    if (tp == 1)
      cin >> root;
    else if (tp == 2) {
      int u, v, x;
      cin >> u >> v >> x;
      if (p(root, u) && p(root, v)) {
        int LCA = lca(u, v);
        if (LCA == root)
          upd(1, 1, n, 1, n, x);
        else
          upd(1, 1, n, tin[LCA], tout[LCA], x);
      } else if (!p(root, u) && !p(root, v)) {
        int LCA = lca(u, v);
        if (!p(LCA, root))
          upd(1, 1, n, tin[LCA], tout[LCA], x);
        else {
          u = lca(u, root);
          v = lca(v, root);
          if (!p(u, v)) swap(u, v);
          int l = 0, r = (int)gn[v].size() - 1, res = -1;
          while (l <= r) {
            int mid = (l + r) >> 1;
            if (tin[gn[v][mid]] <= tin[root]) {
              res = mid;
              l = mid + 1;
            } else
              r = mid - 1;
          }
          assert(res != -1);
          res = gn[v][res];
          upd(1, 1, n, 1, n, x);
          upd(1, 1, n, tin[res], tout[res], -x);
        }
      } else
        upd(1, 1, n, 1, n, x);
    } else {
      int v;
      cin >> v;
      if (v == root)
        cout << get(1, 1, n, 1, n) << endl;
      else if (p(root, v))
        cout << get(1, 1, n, tin[v], tout[v]) << endl;
      else if (p(v, root)) {
        int l = 0, r = (int)gn[v].size() - 1, res = -1;
        while (l <= r) {
          int mid = (l + r) >> 1;
          if (tin[gn[v][mid]] <= tin[root]) {
            res = mid;
            l = mid + 1;
          } else
            r = mid - 1;
        }
        assert(res != -1);
        res = gn[v][res];
        cout << get(1, 1, n, 1, n) - get(1, 1, n, tin[res], tout[res]) << endl;
      } else
        cout << get(1, 1, n, tin[v], tout[v]) << endl;
    }
  }
  return 0;
}
