#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define ll long long
#define pii pair<int, int>
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define MS(a, v) memset(a, v, sizeof a)
#define REP(i, n) for(int i = 0; i < n; ++ i)
#define FOR(i, a, b) for(int i = (a); i <= (b); ++ i)
#define FOD(i, a, b) for(int i = (a); i >= (b); -- i)
#define TSun(TZ) freopen(TZ".inp", "r", stdin), freopen(TZ".out", "w", stdout)
template<class X, class Y>
bool maximize(X & x, const Y & y){
if(x < y){
x = y;
return true;
}
else return false;
}
template<class X, class Y>
bool minimize(X & x, const Y & y){
if(x > y){
x = y;
return true;
}
else return false;
}
const int MAXN = 200005;
const int MOD = 1e9 + 7;
const ll INF = 1e18;
int n, m;
ll v[MAXN];
vector <int> g[MAXN];
int in[MAXN], out[MAXN], Time;
void dfs(int u){
in[u] = ++ Time;
for(int v : g[u]){
dfs(v);
}
out[u] = Time;
}
ll st[MAXN];
ll lz[MAXN << 2];
void up(int id, int l, int r, int u, int v, int val){
if(u > r || v < l) return;
if(u <= l && r <= v){
lz[id] += val;
if(l == r) st[l] += val;
return;
}
int mid = (l + r) >> 1;
FOR(i, id * 2, id * 2 + 1)
lz[i] += lz[id];
if(l == mid) st[l] += lz[id];
if(mid + 1 == r) st[r] += lz[id];
lz[id] = 0;
up(id << 1, l, mid, u, v, val);
up(id << 1 ^ 1, mid + 1, r, u, v, val);
}
ll get(int id, int l, int r, int i){
if(i > r || i < l) return 0;
if(l == r) return st[l];
int mid = (l + r) >> 1;
FOR(i, id * 2, id * 2 + 1)
lz[i] += lz[id];
if(l == mid) st[l] += lz[id];
if(mid + 1 == r) st[r] += lz[id];
lz[id] = 0;
return get(id << 1, l, mid, i) + get(id << 1 ^ 1, mid + 1, r, i);
}
void solve(void){
cin >> n >> m;
cin >> v[1];
FOR(i, 2, n){
cin >> v[i];
int x; cin >> x;
g[x].PB(i);
}
dfs(1);
// FOR(i, 1, n) up(1, 1, n, in[i], in[i], v[i]);
char t;
int u, x;
FOR(i, 1, m){
cin >> t >> u;
if(t == 'p'){
cin >> x;
up(1, 1, n, in[u] + 1, out[u], x);
}
else{
cout << v[u] + get(1, 1, n, in[u]) << "\n";
}
}
}
int main(void){
ios_base :: sync_with_stdio(0);
cin.tie(0); cout.tie(0);
#define TaZinh "salary"
if(fopen(TaZinh".inp", "r"))
TSun(TaZinh);
int Sun = 1;
// cin >> Sun;
REP(love, Sun) solve();
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCiNkZWZpbmUgZmkgZmlyc3QKI2RlZmluZSBzZSBzZWNvbmQKI2RlZmluZSBNUCBtYWtlX3BhaXIKI2RlZmluZSBQQiBwdXNoX2JhY2sKI2RlZmluZSBsbCBsb25nIGxvbmcKI2RlZmluZSBwaWkgcGFpcjxpbnQsIGludD4KI2RlZmluZSBTWihhKSBpbnQoYS5zaXplKCkpCiNkZWZpbmUgQUxMKGEpIGEuYmVnaW4oKSwgYS5lbmQoKQojZGVmaW5lIE1TKGEsIHYpIG1lbXNldChhLCB2LCBzaXplb2YgYSkKI2RlZmluZSBSRVAoaSwgbikgZm9yKGludCBpID0gMDsgaSA8IG47ICsrIGkpCiNkZWZpbmUgRk9SKGksIGEsIGIpIGZvcihpbnQgaSA9IChhKTsgaSA8PSAoYik7ICsrIGkpCiNkZWZpbmUgRk9EKGksIGEsIGIpIGZvcihpbnQgaSA9IChhKTsgaSA+PSAoYik7IC0tIGkpCiNkZWZpbmUgVFN1bihUWikgZnJlb3BlbihUWiIuaW5wIiwgInIiLCBzdGRpbiksIGZyZW9wZW4oVFoiLm91dCIsICJ3Iiwgc3Rkb3V0KQoKdGVtcGxhdGU8Y2xhc3MgWCwgY2xhc3MgWT4KICAgICAgICBib29sIG1heGltaXplKFggJiB4LCBjb25zdCBZICYgeSl7CiAgICAgICAgICAgICAgICBpZih4IDwgeSl7CiAgICAgICAgICAgICAgICAgICAgICAgIHggPSB5OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KCnRlbXBsYXRlPGNsYXNzIFgsIGNsYXNzIFk+CiAgICAgICAgYm9vbCBtaW5pbWl6ZShYICYgeCwgY29uc3QgWSAmIHkpewogICAgICAgICAgICAgICAgaWYoeCA+IHkpewogICAgICAgICAgICAgICAgICAgICAgICB4ID0geTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIHJldHVybiBmYWxzZTsKICAgICAgICB9Cgpjb25zdCBpbnQgTUFYTiA9IDIwMDAwNTsKY29uc3QgaW50IE1PRCA9IDFlOSArIDc7CmNvbnN0IGxsIElORiA9IDFlMTg7CgppbnQgbiwgbTsKbGwgdltNQVhOXTsKdmVjdG9yIDxpbnQ+IGdbTUFYTl07CgppbnQgaW5bTUFYTl0sIG91dFtNQVhOXSwgVGltZTsKCnZvaWQgZGZzKGludCB1KXsKICAgICAgICBpblt1XSA9ICsrIFRpbWU7CiAgICAgICAgZm9yKGludCB2IDogZ1t1XSl7CiAgICAgICAgICAgICAgICBkZnModik7CiAgICAgICAgfQogICAgICAgIG91dFt1XSA9IFRpbWU7Cn0KCmxsIHN0W01BWE5dOwpsbCBseltNQVhOIDw8IDJdOwoKdm9pZCB1cChpbnQgaWQsIGludCBsLCBpbnQgciwgaW50IHUsIGludCB2LCBpbnQgdmFsKXsKICAgICAgICBpZih1ID4gciB8fCB2IDwgbCkgcmV0dXJuOwogICAgICAgIGlmKHUgPD0gbCAmJiByIDw9IHYpewogICAgICAgICAgICAgICAgbHpbaWRdICs9IHZhbDsKICAgICAgICAgICAgICAgIGlmKGwgPT0gcikgc3RbbF0gKz0gdmFsOwogICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgIH0KICAgICAgICBpbnQgbWlkID0gKGwgKyByKSA+PiAxOwogICAgICAgIEZPUihpLCBpZCAqIDIsIGlkICogMiArIDEpCiAgICAgICAgICAgICAgICBseltpXSArPSBseltpZF07CiAgICAgICAgaWYobCA9PSBtaWQpIHN0W2xdICs9IGx6W2lkXTsKICAgICAgICBpZihtaWQgKyAxID09IHIpIHN0W3JdICs9IGx6W2lkXTsKICAgICAgICBseltpZF0gPSAwOwogICAgICAgIHVwKGlkIDw8IDEsIGwsIG1pZCwgdSwgdiwgdmFsKTsKICAgICAgICB1cChpZCA8PCAxIF4gMSwgbWlkICsgMSwgciwgdSwgdiwgdmFsKTsKfQoKbGwgZ2V0KGludCBpZCwgaW50IGwsIGludCByLCBpbnQgaSl7CiAgICAgICAgaWYoaSA+IHIgfHwgaSA8IGwpIHJldHVybiAwOwogICAgICAgIGlmKGwgPT0gcikgcmV0dXJuIHN0W2xdOwogICAgICAgIGludCBtaWQgPSAobCArIHIpID4+IDE7CiAgICAgICAgRk9SKGksIGlkICogMiwgaWQgKiAyICsgMSkKICAgICAgICAgICAgICAgIGx6W2ldICs9IGx6W2lkXTsKICAgICAgICBpZihsID09IG1pZCkgc3RbbF0gKz0gbHpbaWRdOwogICAgICAgIGlmKG1pZCArIDEgPT0gcikgc3Rbcl0gKz0gbHpbaWRdOwogICAgICAgIGx6W2lkXSA9IDA7CiAgICAgICAgcmV0dXJuIGdldChpZCA8PCAxLCBsLCBtaWQsIGkpICsgZ2V0KGlkIDw8IDEgXiAxLCBtaWQgKyAxLCByLCBpKTsKfQoKdm9pZCBzb2x2ZSh2b2lkKXsKICAgICAgICBjaW4gPj4gbiA+PiBtOwogICAgICAgIGNpbiA+PiB2WzFdOwogICAgICAgIEZPUihpLCAyLCBuKXsKICAgICAgICAgICAgICAgIGNpbiA+PiB2W2ldOwogICAgICAgICAgICAgICAgaW50IHg7IGNpbiA+PiB4OwogICAgICAgICAgICAgICAgZ1t4XS5QQihpKTsKICAgICAgICB9CiAgICAgICAgZGZzKDEpOwovLyAgICAgICAgRk9SKGksIDEsIG4pIHVwKDEsIDEsIG4sIGluW2ldLCBpbltpXSwgdltpXSk7CgogICAgICAgIGNoYXIgdDsKICAgICAgICBpbnQgdSwgeDsKICAgICAgICBGT1IoaSwgMSwgbSl7CiAgICAgICAgICAgICAgICBjaW4gPj4gdCA+PiB1OwogICAgICAgICAgICAgICAgaWYodCA9PSAncCcpewogICAgICAgICAgICAgICAgICAgICAgICBjaW4gPj4geDsKICAgICAgICAgICAgICAgICAgICAgICAgdXAoMSwgMSwgbiwgaW5bdV0gKyAxLCBvdXRbdV0sIHgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZWxzZXsKICAgICAgICAgICAgICAgICAgICAgICAgY291dCA8PCB2W3VdICsgZ2V0KDEsIDEsIG4sIGluW3VdKSA8PCAiXG4iOwogICAgICAgICAgICAgICAgfQogICAgICAgIH0KfQoKaW50IG1haW4odm9pZCl7CgogICAgICAgIGlvc19iYXNlIDo6IHN5bmNfd2l0aF9zdGRpbygwKTsKICAgICAgICBjaW4udGllKDApOyBjb3V0LnRpZSgwKTsKCiAgICAgICAgI2RlZmluZSBUYVppbmggInNhbGFyeSIKCiAgICAgICAgaWYoZm9wZW4oVGFaaW5oIi5pbnAiLCAiciIpKQogICAgICAgICAgICAgICAgVFN1bihUYVppbmgpOwoKICAgICAgICBpbnQgU3VuID0gMTsKLy8gICAgICAgIGNpbiA+PiBTdW47CiAgICAgICAgUkVQKGxvdmUsIFN1bikgc29sdmUoKTsKCiAgICAgICAgcmV0dXJuIDA7Cn0K