#include <bits/stdc++.h>
using namespace std;
const int N = 200'447;
const int LOG = 20;
vector<int> g[N];
int tin[N];
int tout[N];
int up[N][LOG];
int T;
int d[N];
void dfs(int v, int p, int depth)
{
tin[v] = T++;
up[v][0] = p;
for(int i = 1; i < LOG; i++)
up[v][i] = up[up[v][i - 1]][i - 1];
d[v] = depth;
for (int to : g[v])
if (to != p)
dfs(to, v, depth + 1);
tout[v] = T++;
}
bool is_ancestor(int p, int v)
{
return tin[p] <= tin[v] && tout[v] <= tout[p];
}
int lca(int u, int v)
{
if (is_ancestor(v, u)) return v;
for(int i = LOG - 1; i >= 0; i--)
{
if (!is_ancestor(up[v][i], u))
v = up[v][i];
}
return up[v][0];
}
struct Fenwick
{
vector<long long> t;
int n;
void init(int _n)
{
n = _n;
t.resize(n);
}
void upd(int i, long long val)
{
for(; i < n; i |= i + 1)
t[i] += val;
}
long long sum(int i)
{
long long res = 0;
for(; i >= 0; i = (i & (i + 1)) - 1)
res += t[i];
return res;
}
long long sum(int l, int r)
{
return sum(r) - sum(l - 1);
}
}K, B;
void upd(int v, long long val)
{
//(d[v] - d[x] + 1) * val;
B.upd(tin[v], (d[v] + 1) * val);
K.upd(tin[v], -val);
}
int main()
{
int n, q;
cin >> n;
vector<int> val(n);
for(int i = 0; i < n; i++)
cin >> val[i];
for(int i = 0; i < n - 1; i++)
{
int u, v;
cin >> u >> v;
u--, v--;
g[u].push_back(v);
g[v].push_back(u);
}
dfs(0, 0, 0);
K.init(T);
B.init(T);
for(int v = 0; v < n; v++)
B.upd(tin[v], val[v]);
cin >> q;
for(int i = 1; i <= q; i++)
{
int t;
cin >> t;
if(t == 2)
{
int v;
cin >> v;
v--;
long long k = K.sum(tin[v], tout[v]);
long long b = B.sum(tin[v], tout[v]);
cout << k * d[v] + b << "\n";
}
else
{
int a, b;
long long diff;
cin >> a >> b >> diff;
a--, b--;
int c = lca(a, b);
upd(a, diff);
upd(b, diff);
upd(c, -2 * diff);
B.upd(tin[c], diff);
}
}
return 0;
}