#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, q, u, v, x, op, root, a[N];
int t, p[N], L[N], R[N], dep[N], fa[N][20];
long long sum[N << 2], lazy[N << 2];
vector<int> gg[N];
void dfs(int u, int f, int d) {
  dep[u] = d;
  fa[u][0] = f;
  for (int i = 1; i < 20; i++) {
    fa[u][i] = fa[fa[u][i - 1]][i - 1];
  }
  p[++t] = u;
  L[u] = t;
  for (int i = 0; i < gg[u].size(); i++) {
    int v = gg[u][i];
    if (v != f) dfs(v, u, d + 1);
  }
  R[u] = t;
}
void push_up(int k) { sum[k] = sum[k << 1] + sum[k << 1 | 1]; }
void push_down(int k, int l, int r) {
  if (lazy[k] == 0) return;
  int mid = (l + r) / 2;
  lazy[k << 1] += lazy[k];
  sum[k << 1] += lazy[k] * (mid - l + 1);
  lazy[k << 1 | 1] += lazy[k];
  sum[k << 1 | 1] += lazy[k] * (r - mid);
  lazy[k] = 0;
}
void build(int k, int l, int r) {
  lazy[k] = 0;
  if (l == r) {
    sum[k] = a[p[l]];
    return;
  }
  int mid = (l + r) / 2;
  build(k << 1, l, mid);
  build(k << 1 | 1, mid + 1, r);
  push_up(k);
}
void add(int a, int b, int k, int l, int r, long long x) {
  if (a > r || b < l) return;
  if (a <= l && r <= b) {
    lazy[k] += x;
    sum[k] += x * (r - l + 1);
    return;
  }
  push_down(k, l, r);
  int mid = (l + r) / 2;
  add(a, b, k << 1, l, mid, x);
  add(a, b, k << 1 | 1, mid + 1, r, x);
  push_up(k);
}
long long get_sum(int a, int b, int k, int l, int r) {
  if (a > r || b < l) return 0;
  if (a <= l && r <= b) return sum[k];
  push_down(k, l, r);
  int mid = (l + r) / 2;
  long long s = 0;
  s += get_sum(a, b, k << 1, l, mid);
  s += get_sum(a, b, k << 1 | 1, mid + 1, r);
  return s;
}
void process() {
  t = 0;
  dfs(1, 0, 1);
  build(1, 1, n);
  root = 1;
}
int go_up(int u, int tar) {
  for (int i = 19; i >= 0; i--) {
    int v = fa[u][i];
    if (dep[v] >= tar) u = v;
  }
  return u;
}
int get_lca(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  u = go_up(u, dep[v]);
  for (int i = 19; i >= 0; i--) {
    if (fa[u][i] == fa[v][i]) continue;
    u = fa[u][i];
    v = fa[v][i];
  }
  if (u != v) u = fa[u][0];
  return u;
}
bool in_subtree(int u, int rt) { return L[rt] <= L[u] && L[u] <= R[rt]; }
int main() {
  scanf("%d %d", &n, &q);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i < n; i++) {
    scanf("%d %d", &u, &v);
    gg[u].push_back(v);
    gg[v].push_back(u);
  }
  process();
  while (q--) {
    scanf("%d %d", &op, &u);
    if (op == 1) {
      root = u;
    } else if (op == 2) {
      scanf("%d %d", &v, &x);
      int lca = get_lca(u, v);
      if (in_subtree(root, lca)) {
        add(1, n, 1, 1, n, x);
        int p1 = get_lca(root, u);
        int p2 = get_lca(root, v);
        int lca2 = dep[p1] > dep[p2] ? p1 : p2;
        if (lca2 != root) {
          int w = go_up(root, dep[lca2] + 1);
          add(L[w], R[w], 1, 1, n, -x);
        }
      } else {
        add(L[lca], R[lca], 1, 1, n, x);
      }
    } else {
      long long ans;
      if (in_subtree(root, u)) {
        ans = get_sum(1, n, 1, 1, n);
        if (u != root) {
          int w = go_up(root, dep[u] + 1);
          ans -= get_sum(L[w], R[w], 1, 1, n);
        }
      } else {
        ans = get_sum(L[u], R[u], 1, 1, n);
      }
      printf("%lld\n", ans);
    }
  }
}
