#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 100;
const int maxk = 20 + 10;
int N, M, K, p[maxn], d[maxn], w[maxn];
vector<int> sons[maxn];
int r[maxn], cnt[maxn];
map<int, long long> f[maxn];
void solve(int p) {
  r[p] = p;
  for (int i = 0; i < sons[p].size(); i++) {
    int j = sons[p][i];
    if (cnt[j] > cnt[r[p]]) {
      r[p] = r[j];
    }
  }
  cnt[p] = 1;
  for (int i = 0; i < sons[p].size(); i++) {
    int j = sons[p][i];
    cnt[p] += cnt[j];
    if (r[j] == r[p]) continue;
    for (map<int, long long>::iterator itr = f[r[j]].begin();
         itr != f[r[j]].end(); itr++) {
      f[r[p]][itr->first] += itr->second;
    }
  }
  if (d[p] > 0) {
    f[r[p]][d[p]] += w[p];
    map<int, long long>::iterator itr = f[r[p]].upper_bound(d[p]);
    long long temp = w[p];
    while (itr != f[r[p]].end() && temp >= itr->second) {
      temp -= itr->second;
      f[r[p]].erase(itr++);
    }
    if (itr != f[r[p]].end()) {
      itr->second -= temp;
    }
  }
}
void work() {
  scanf("%d%d%d", &N, &M, &K);
  for (int i = 2; i <= N; i++) {
    scanf("%d", &p[i]);
    sons[p[i]].push_back(i);
  }
  for (int i = 0, j; i < M; i++) {
    scanf("%d", &j);
    scanf("%d%d", &d[j], &w[j]);
  }
  for (int i = N; i >= 1; i--) {
    solve(i);
  }
  long long ans = 0;
  for (int j = 0; j <= K; j++) {
    ans += f[r[1]][j];
  }
  printf("%I64d\n", ans);
}
int main() {
  int TestCase = 1;
  while (TestCase--) {
    work();
  }
  return 0;
}
