#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<bitset>
#include<math.h>
#include<vector>
#include<string>
#include<stdio.h>
#include<cstring>
#include<iostream>
#include<algorithm>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int N=100010;
const int mod=100000000;
const int MOD1=1000000007;
const int MOD2=1000000009;
const double EPS=0.00000001;
typedef long long ll;
const ll MOD=1000000007;
const int INF=1000000010;
const ll MAX=1000000000;
const double pi=acos(-1.0);
typedef double db;
typedef unsigned long long ull;
int tot,u[N],v[N],pre[N];
void add(int a,int b) {
v[tot]=b;pre[tot]=u[a];u[a]=tot++;
}
int n,fa[N],dep[N],siz[N],son[N];
int in[N],out[N],top[N],w[N];
void dfs1(int a) {
dep[a]=dep[fa[a]]+1;siz[a]=1;
int i,w=0,mx=0;
for (i=u[a];i!=-1;i=pre[i]) {
dfs1(v[i]);siz[a]+=siz[v[i]];
if (siz[v[i]]>mx) w=v[i],mx=siz[v[i]];
}
son[a]=w;
}
void dfs2(int a) {
if (son[fa[a]]==a) top[a]=top[fa[a]];
else top[a]=a;w[a]=++tot;in[a]=tot;
if (son[a]) dfs2(son[a]);
for (int i=u[a];i!=-1;i=pre[i])
if (v[i]!=son[a]) dfs2(v[i]);
out[a]=tot;
}
char s[6];
ll c,sum[4*N],sig[4*N];
void push_down(int x,int l,int r) {
int mid=(l+r)>>1;
sum[x<<1]+=(mid-l+1)*sig[x];sig[x<<1]+=sig[x];
sum[x<<1|1]+=(r-mid)*sig[x];sig[x<<1|1]+=sig[x];
sig[x]=0;
}
void updata(int x,int l,int r,int L,int R,ll y) {
if (l==L&&r==R) { sum[x]+=y*(r-l+1);sig[x]+=y;return ; }
int mid=(l+r)>>1;
if (sig[x]) push_down(x,l,r);
if (R<=mid) updata(x<<1,l,mid,L,R,y);
else if (L>mid) updata(x<<1|1,mid+1,r,L,R,y);
else updata(x<<1,l,mid,L,mid,y),updata(x<<1|1,mid+1,r,mid+1,R,y);
sum[x]=sum[x<<1]+sum[x<<1|1];
}
void modify(int a,int b,ll c) {
int f1=top[a],f2=top[b];
while (f1!=f2) {
if (dep[f1]<dep[f2]) swap(a,b),swap(f1,f2);
updata(1,1,n,w[f1],w[a],c);
a=fa[f1];f1=top[a];
}
if (dep[a]<dep[b]) swap(a,b);
updata(1,1,n,w[b],w[a],c);
}
ll query(int x,int l,int r,int L,int R) {
if (l==L&&r==R) return sum[x];
int mid=(l+r)>>1;
if (sig[x]) push_down(x,l,r);
if (R<=mid) return query(x<<1,l,mid,L,R);
else if (L>mid) return query(x<<1|1,mid+1,r,L,R);
else return query(x<<1,l,mid,L,mid)+query(x<<1|1,mid+1,r,mid+1,R);
}
int main()
{
int a,b,i,m;
scanf("%d", &n);
tot=0;memset(u,-1,sizeof(u));
for (i=1;i<n;i++) {
scanf("%d%d", &a, &b);
a++;b++;add(a,b);fa[b]=a;
}
dfs1(1);tot=0;dfs2(1);
scanf("%d", &m);
while (m--) {
scanf("%s", s);
if (s[0]=='A') {
scanf("%d%d%lld", &a, &b, &c);
a++;b++;modify(a,b,c);
} else {
scanf("%d", &a);a++;
printf("%lld\n", query(1,1,n,in[a],out[a]));
}
}
return 0;
}