#include <bits/stdc++.h>
using namespace std;
long long ans = 0;
map<int, long long> mp[100010];
int n, m, k, t, d[100010], w[100010], p[100010];
void upd(int x) {
  for (auto it = mp[x].upper_bound(d[x]); it != mp[x].end();
       mp[x].erase(it++)) {
    if (w[x] >= it->second) {
      w[x] -= it->second;
    } else {
      it->second -= w[x];
      return;
    }
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &p[i]);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d", &t);
    scanf("%d%d", &d[t], &w[t]);
  }
  for (int i = n; i >= 2; i--) {
    mp[i][d[i]] += w[i], upd(i);
    if (mp[i].size() > mp[p[i]].size()) {
      mp[p[i]].swap(mp[i]);
    }
    for (auto x : mp[i]) {
      mp[p[i]][x.first] += x.second;
    }
  }
  for (auto x : mp[1]) {
    ans += x.second;
  }
  cout << ans;
  return 0;
}
