#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
inline void chkmax(A &x, const B y) {
  if (x < y) x = y;
}
template <typename A, typename B>
inline void chkmin(A &x, const B y) {
  if (x > y) x = y;
}
const int N = 1e5 + 5;
int n, m, K;
int fa[N];
struct Graph {
  int tot, to[N << 1], nxt[N << 1], head[N];
  void add(int x, int y) {
    tot++;
    to[tot] = y;
    nxt[tot] = head[x];
    head[x] = tot;
  }
  void clear() {
    memset(head, -1, sizeof head);
    tot = 0;
  }
} G;
struct Fruit {
  int p, d, w;
} A[N];
int D[N], W[N];
map<int, long long> mp[N];
map<int, long long>::iterator it;
void dfs(int x) {
  for (int i = G.head[x]; i != -1; i = G.nxt[i]) {
    int v = G.to[i];
    dfs(v);
    if (mp[x].size() < mp[v].size()) swap(mp[x], mp[v]);
    for (it = mp[v].begin(); it != mp[v].end(); it++)
      mp[x][(*it).first] += (*it).second;
  }
  mp[x][D[x]] += W[x];
  it = mp[x].upper_bound(D[x]);
  long long val = W[x];
  while (it != mp[x].end()) {
    long long w = it->second;
    if (w >= val) {
      it->second -= val;
      break;
    }
    val -= w;
    mp[x].erase(it++);
  }
}
int main() {
  G.clear();
  scanf("%d%d%d", &n, &m, &K);
  for (int i = (2), iR = (n); i <= iR; i++) {
    scanf("%d", &fa[i]);
    G.add(fa[i], i);
  }
  for (int i = (1), iR = (m); i <= iR; i++) {
    scanf("%d%d%d", &A[i].p, &A[i].d, &A[i].w);
    D[A[i].p] = A[i].d;
    W[A[i].p] = A[i].w;
  }
  dfs(1);
  long long ans = 0;
  for (it = mp[1].begin(); it != mp[1].end(); it++) ans += it->second;
  printf("%lld\n", ans);
  return 0;
}
