#include <bits/stdc++.h>
using namespace std;
int n, m, k, tot, t[100100], w[100100], head[100100];
long long ans;
struct point {
  int fr, to, nxt;
} a[100100];
map<int, long long> mp[100100];
void add(int x, int y) {
  a[++tot].fr = x;
  a[tot].to = y;
  a[tot].nxt = head[x];
  head[x] = tot;
}
void dfs(int x) {
  for (int i = head[x]; i; i = a[i].nxt) {
    int y = a[i].to;
    dfs(a[i].to);
    if (mp[x].size() < mp[y].size()) swap(mp[x], mp[y]);
    for (map<int, long long>::iterator it = mp[y].begin(); it != mp[y].end();
         ++it)
      mp[x][(*it).first] += (*it).second;
  }
  mp[x][t[x]] += w[x];
  int now = w[x];
  map<int, long long>::iterator it = mp[x].upper_bound(t[x]), tmp;
  while (it != mp[x].end()) {
    if (now >= (*it).second) {
      now -= (*it).second;
      tmp = it;
      it++;
      mp[x].erase(tmp);
    } else {
      (*it).second -= now;
      break;
    }
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 2, x; i <= n; ++i) scanf("%d", &x), add(x, i);
  for (int i = 1, p, x, y; i <= m; ++i)
    scanf("%d%d%d", &p, &x, &y), t[p] = x, w[p] = y;
  dfs(1);
  for (map<int, long long>::iterator it = mp[1].begin(); it != mp[1].end();
       it++)
    ans += (*it).second;
  printf("%lld\n", ans);
}
