#include <bits/stdc++.h>
using namespace std;
int in[200005], out[200005], tim, seg[4 * 200005], lazy[4 * 200005], n,
    a[200005], q;
vector<int> adj[200005];
void dfs(int node) {
  in[node] = ++tim;
  for (int i = 0; i < adj[node].size(); i++) {
    int ch = adj[node][i];
    dfs(ch);
  }
  out[node] = tim;
}
void probagate(int node, int st, int en) {
  if (lazy[node] != 0) {
    if (lazy[node] % 2) seg[node] = (en - st + 1) - seg[node];
    if (st != en) {
      lazy[2 * node] += lazy[node];
      lazy[2 * node + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
}
void update(int node, int st, int en, int l, int r) {
  probagate(node, st, en);
  if (st > en || st > r || en < l) return;
  if (st >= l && en <= r) {
    lazy[node]++;
    return probagate(node, st, en);
  }
  int mid = (st + en) / 2;
  update(2 * node, st, mid, l, r);
  update(2 * node + 1, mid + 1, en, l, r);
  seg[node] = seg[2 * node] + seg[2 * node + 1];
}
int query(int node, int st, int en, int l, int r) {
  if (st > en || st > r || en < l) return 0;
  probagate(node, st, en);
  if (st >= l && en <= r) {
    return seg[node];
  }
  int mid = (st + en) / 2;
  return query(2 * node, st, mid, l, r) +
         query(2 * node + 1, mid + 1, en, l, r);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int par;
    cin >> par;
    adj[par].push_back(i);
  }
  dfs(1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i]) update(1, 1, n, in[i], in[i]);
  }
  cin >> q;
  while (q--) {
    string second;
    int v;
    cin >> second >> v;
    if (second == "pow")
      update(1, 1, n, in[v], out[v]);
    else
      cout << query(1, 1, n, in[v], out[v]) << "\n";
  }
  return 0;
}
