#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1, ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) x = (x << 1) + (x << 3) + ch - '0', ch = getchar();
  return x * f;
}
struct edge {
  int to, nxt;
} e[100005 << 1];
int head[100005], K = 0;
void add(int u, int v) {
  e[K] = {v, head[u]};
  head[u] = K++;
}
int n, m, k, fa[100005], D[100005], W[100005];
map<int, long long> mp[100005];
map<int, long long>::iterator it;
void dfs(int u) {
  for (int i = head[u], v; ~i; i = e[i].nxt) {
    v = e[i].to;
    dfs(v);
    if (mp[u].size() < mp[v].size()) swap(mp[u], mp[v]);
    for (it = mp[v].begin(); it != mp[v].end(); it++)
      mp[u][(*it).first] += (*it).second;
  }
  mp[u][D[u]] += W[u];
  it = mp[u].upper_bound(D[u]);
  long long val = W[u];
  for (; it != mp[u].end();) {
    long long w = (*it).second;
    if (val <= w) {
      (*it).second -= val;
      break;
    }
    val -= w, mp[u].erase(it++);
  }
}
signed main() {
  n = read(), m = read(), k = read();
  memset(head, -1, sizeof head);
  for (int u = 2; u <= n; u++) fa[u] = read(), add(fa[u], u);
  for (int i = 1, a, d, w; i <= m; i++)
    a = read(), D[a] = read(), W[a] = read();
  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;
}
