#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int n, m, k;
int p[N], d[N], w[N];
map<int, long long> dp[N];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 2; i <= n; ++i) scanf("%d", &p[i]);
  while (m--) {
    int v;
    scanf("%d", &v);
    scanf("%d%d", &d[v], &w[v]);
  }
  for (int i = 1; i <= n; ++i) {
    dp[i].insert(make_pair(k + 1, 1LL << 60));
  }
  for (int i = n; i > 1; --i) {
    if (w[i]) {
      dp[i][d[i]] += w[i];
      auto it = dp[i].upper_bound(d[i]);
      long long v = w[i];
      while (v >= it->second) {
        v -= it->second;
        dp[i].erase(it++);
      }
      it->second -= v;
    }
    if (dp[p[i]].size() < dp[i].size()) swap(dp[p[i]], dp[i]);
    for (const auto& pr : dp[i])
      if (pr.first != k + 1) dp[p[i]][pr.first] += pr.second;
  }
  long long ans = 0;
  for (const auto& pr : dp[1])
    if (pr.first != k + 1) ans += pr.second;
  printf("%lld\n", ans);
  return 0;
}
