#include <bits/stdc++.h>
using namespace std;
map<int, long long> mp1[100005], *mp2[100005];
int d[100005], w[100005], p[100005];
int main() {
  int n, m, k, x;
  scanf("%d%d%d", &n, &m, &k);
  int i;
  for (i = 2; i <= n; i++) scanf("%d", &p[i]);
  for (i = 1; i <= m; i++) {
    scanf("%d", &x);
    scanf("%d%d", &d[x], &w[x]);
  }
  for (i = 1; i <= n; i++) mp2[i] = mp1 + i;
  for (i = n; i > 1; i--) {
    if (d[i]) {
      auto it = mp2[i]->insert(make_pair(d[i], 0)).first;
      it->second = it->second + w[i];
      x = w[i];
      for (++it; it != mp2[i]->end() && x >= it->second;
           x = x - it->second, mp2[i]->erase(it++))
        ;
      if (it != mp2[i]->end()) it->second = it->second - x;
    }
    if (mp2[i]->size() > mp2[p[i]]->size()) swap(mp2[i], mp2[p[i]]);
    for (auto it : *mp2[i]) {
      auto num = mp2[p[i]]->insert(make_pair(it.first, 0)).first;
      num->second = num->second + it.second;
    }
  }
  long long rasp = 0;
  for (auto it : *mp2[1]) rasp = rasp + it.second;
  printf("%lld\n", rasp);
  return 0;
}
