#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f3f3f3f3f3f3fll;
const long long M = 1e9 + 7;
const long long maxn = 1e6 + 7;
const double eps = 0.00000001;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
template <typename T>
inline T abs(T a) {
  return a > 0 ? a : -a;
}
template <typename T>
inline T powMM(T a, T b) {
  T ret = 1;
  for (; b; b >>= 1ll, a = 1ll * a * a % M)
    if (b & 1) ret = 1ll * ret * a % M;
  return ret;
}
long long sum[maxn << 2], lazy[maxn << 2];
void update(int x, int l, int r, long long val, int L, int R) {
  if (l > r) return;
  if (l <= L && R <= r) {
    lazy[x] += val;
    sum[x] += (R - L + 1) * val;
    return;
  }
  int mid = (L + R) / 2;
  if (lazy[x]) {
    lazy[x << 1] += lazy[x];
    lazy[x << 1 | 1] += lazy[x];
    sum[x << 1] += (mid - L + 1) * lazy[x];
    sum[x << 1 | 1] += (R - mid) * lazy[x];
    lazy[x] = 0;
  }
  if (l <= mid) update(x << 1, l, r, val, L, mid);
  if (mid < r) update(x << 1 | 1, l, r, val, mid + 1, R);
  sum[x] = sum[x << 1] + sum[x << 1 | 1];
}
long long query(int x, int l, int r, int L, int R) {
  long long ret = 0;
  if (l > r) return 0;
  if (l <= L && R <= r) return sum[x];
  int mid = (L + R) / 2;
  if (lazy[x]) {
    lazy[x << 1] += lazy[x];
    lazy[x << 1 | 1] += lazy[x];
    sum[x << 1] += (mid - L + 1) * lazy[x];
    sum[x << 1 | 1] += (R - mid) * lazy[x];
    lazy[x] = 0;
  }
  if (l <= mid) ret += query(x << 1, l, r, L, mid);
  if (mid < r) ret += query(x << 1 | 1, l, r, mid + 1, R);
  sum[x] = sum[x << 1] + sum[x << 1 | 1];
  return ret;
}
vector<int> edge[maxn];
int fa[maxn][27];
int in[maxn], out[maxn], tot, dep[maxn];
void dfs(int x, int f, int d) {
  int i;
  fa[x][0] = f;
  in[x] = ++tot;
  dep[x] = d;
  for (i = 1; i < 20; i++) fa[x][i] = fa[fa[x][i - 1]][i - 1];
  for (int v : edge[x])
    if (v != f) dfs(v, x, d + 1);
  out[x] = tot;
}
int lca(int x, int y) {
  int i;
  if (dep[x] < dep[y]) swap(x, y);
  for (i = 20 - 1; i >= 0; i--)
    if (dep[x] - dep[y] >= 1 << i) x = fa[x][i];
  if (x == y) return x;
  for (i = 20 - 1; i >= 0; i--)
    if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];
  return fa[x][0];
}
int getnthfa(int x, int k) {
  int i;
  for (i = 20 - 1; i >= 0; i--)
    if ((k >> i) & 1) x = fa[x][i];
  return x;
}
int root;
int n, m;
int a[maxn];
int main() {
  int i, j;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    edge[u].push_back(v);
    edge[v].push_back(u);
  }
  dfs(1, 0, 0);
  for (i = 1; i <= n; i++) update(1, in[i], in[i], a[i], 1, n);
  root = 1;
  while (m--) {
    int op, u, v, x;
    scanf("%d", &op);
    if (op == 1) {
      scanf("%d", &root);
    } else if (op == 2) {
      scanf("%d%d%d", &u, &v, &x);
      int f = lca(u, v) ^ lca(v, root) ^ lca(u, root);
      if (f == root)
        update(1, 1, n, x, 1, n);
      else if (lca(f, root) == f) {
        int t = getnthfa(root, dep[root] - dep[f] - 1);
        update(1, 1, in[t] - 1, x, 1, n);
        update(1, out[t] + 1, n, x, 1, n);
      } else
        update(1, in[f], out[f], x, 1, n);
    } else if (op == 3) {
      int x;
      long long ans;
      scanf("%d", &x);
      if (x == root)
        ans = query(1, 1, n, 1, n);
      else if (in[x] <= in[root] && in[root] <= out[x]) {
        int t = getnthfa(root, dep[root] - dep[x] - 1);
        ans = query(1, 1, in[t] - 1, 1, n) + query(1, out[t] + 1, n, 1, n);
      } else
        ans = query(1, in[x], out[x], 1, n);
      printf("%I64d\n", ans);
    }
  }
}
