#include <bits/stdc++.h>
using namespace std;
int euler[100005];
int intime[100005];
int outtime[100005];
int height[100005];
long long segtree[100005 * 4];
long long lazy[100005 * 4];
void update(int pos, int l, int r, int a, int b, long long val) {
  if (lazy[pos]) {
    segtree[pos] += (r - l + 1) * lazy[pos];
    if (l != r) {
      lazy[pos * 2 + 1] += lazy[pos];
      lazy[pos * 2 + 2] += lazy[pos];
    }
    lazy[pos] = 0;
  }
  if (a <= l and r <= b) {
    segtree[pos] += (r - l + 1) * val;
    if (l != r) {
      lazy[pos * 2 + 1] += val;
      lazy[pos * 2 + 2] += val;
    }
    return;
  }
  if (a > r or b < l) return;
  int mid = (l + r) >> 1;
  update(pos * 2 + 1, l, mid, a, b, val);
  update(pos * 2 + 2, mid + 1, r, a, b, val);
  segtree[pos] = segtree[pos * 2 + 1] + segtree[pos * 2 + 2];
}
long long query(int pos, int l, int r, int a, int b) {
  if (lazy[pos]) {
    segtree[pos] += (r - l + 1) * lazy[pos];
    if (l != r) {
      lazy[pos * 2 + 1] += lazy[pos];
      lazy[pos * 2 + 2] += lazy[pos];
    }
    lazy[pos] = 0;
  }
  if (a <= l and r <= b) {
    return segtree[pos];
  }
  if (a > r or b < l) return 0;
  int mid = (l + r) >> 1;
  return query(pos * 2 + 1, l, mid, a, b) +
         query(pos * 2 + 2, mid + 1, r, a, b);
}
int clck = 1;
vector<int> adj[100005];
int par[20][100005];
void dfs(int u, int p) {
  euler[clck] = u;
  intime[u] = clck++;
  height[u] = height[p] + 1;
  par[0][u] = p;
  for (auto i : adj[u]) {
    if (i != p) dfs(i, u);
  }
  outtime[u] = clck - 1;
}
int LCA(int u, int v) {
  if (height[u] < height[v]) swap(u, v);
  for (int i = 19; i >= 0; i--) {
    if (height[u] - (1 << i) >= height[v]) u = par[i][u];
  }
  if (u == v) return u;
  for (int i = 19; i >= 0; i--) {
    if (par[i][u] != par[i][v]) u = par[i][u], v = par[i][v];
  }
  return par[0][u];
}
bool insubtree(int r, int u) {
  return intime[r] <= intime[u] and outtime[r] >= outtime[u];
}
void solve() {
  int n, q;
  cin >> n >> q;
  vector<int> x(n + 1);
  for (int i = 1; i < n + 1; i++) cin >> x[i];
  for (int i = 1; i < n; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  dfs(1, 0);
  for (int i = 1; i < 20; i++) {
    for (int j = 1; j <= n; j++) {
      par[i][j] = par[i - 1][par[i - 1][j]];
    }
  }
  for (int i = 1; i < n + 1; i++) {
    update(0, 1, n, intime[i], intime[i], x[i]);
  }
  int root = 1;
  while (q--) {
    int ch;
    cin >> ch;
    if (ch == 1) {
      cin >> root;
    } else if (ch == 3) {
      int node;
      cin >> node;
      if (!insubtree(node, root))
        cout << query(0, 1, n, intime[node], outtime[node]) << '\n';
      else if (node == root)
        cout << query(0, 1, n, 1, n) << '\n';
      else {
        int moveup = height[root] - height[node] - 1;
        int cur = root;
        for (int i = 19; i >= 0; i--) {
          if (moveup & (1 << i)) cur = par[i][cur];
        }
        cout << query(0, 1, n, 1, n) - query(0, 1, n, intime[cur], outtime[cur])
             << '\n';
      }
    } else {
      int a, b, val;
      cin >> a >> b >> val;
      int ar = LCA(a, root);
      int br = LCA(b, root);
      int ab = LCA(a, b);
      int node = ar ^ br ^ ab;
      if (!insubtree(node, root)) {
        update(0, 1, n, intime[node], outtime[node], val);
      } else if (node == root) {
        update(0, 1, n, 1, n, val);
      } else {
        update(0, 1, n, 1, n, val);
        int moveup = height[root] - height[node] - 1;
        int cur = root;
        for (int i = 19; i >= 0; i--) {
          if (moveup & (1 << i)) cur = par[i][cur];
        }
        update(0, 1, n, intime[cur], outtime[cur], -val);
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
