#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100005;
const int INF = 0x3f3f3f3f;
int N, M, K;
int val[MAX_N], t[MAX_N], pa[MAX_N];
vector<int> G[MAX_N];
multiset<pair<int, int> > s[MAX_N];
int merge(int a, int b) {
  if (s[a].size() > s[b].size()) swap(a, b);
  for (auto p : s[a]) {
    s[b].insert(p);
  }
  return b;
}
int solve(int u) {
  int cur = u;
  for (auto v : G[u]) cur = merge(solve(v), cur);
  int temp = 0;
  auto it = s[cur].upper_bound(pair<int, int>(t[u], INF));
  while (it != s[cur].end() && temp < val[u]) {
    if ((*it).second + temp <= val[u]) {
      temp += (*it).second;
      it = s[cur].erase(it);
    } else {
      pair<int, int> k = (*it);
      s[cur].erase(it);
      k.second -= val[u] - temp;
      s[cur].insert(k);
      temp = val[u];
    }
  }
  s[cur].insert(pair<int, int>(t[u], val[u]));
  return cur;
}
int main() {
  scanf("%d%d%d", &N, &M, &K);
  for (int i = 2; i <= N; i++) scanf("%d", &pa[i]), G[pa[i]].push_back(i);
  for (int i = 1; i <= M; i++) {
    int u, v, d;
    scanf("%d%d%d", &u, &d, &v);
    val[u] = v;
    t[u] = d;
  }
  int res = solve(1);
  long long ans = 0;
  for (auto p : s[res]) ans += p.second;
  printf("%lld\n", ans);
  return 0;
}
