#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 9;
vector<long long> es[N];
long long n, m, k;
long long d[N], w[N];
long long id[N];
map<long long, long long> mp[N];
void dfs(long long x) {
  for (long long to : es[x]) {
    dfs(to);
    if (mp[id[to]].size() > mp[id[x]].size()) swap(id[x], id[to]);
    for (auto u : mp[id[to]]) mp[id[x]][u.first] += u.second;
  }
  mp[id[x]][d[x]] += w[x];
  for (auto it = mp[id[x]].upper_bound(d[x]); it != mp[id[x]].end();
       it = mp[id[x]].erase(it)) {
    w[x] -= it->second;
    if (w[x] < 0) {
      it->second = -w[x];
      break;
    }
  }
}
signed main() {
  cin >> n >> m >> k;
  for (long long i = 2, f; i <= n; ++i) {
    cin >> f;
    es[f].push_back(i);
  }
  for (long long x; m; --m) {
    cin >> x;
    cin >> d[x] >> w[x];
  }
  for (long long i = 1; i <= n; ++i) id[i] = i;
  dfs(1);
  long long ans = 0;
  for (auto u : mp[id[1]]) ans += u.second;
  cout << ans << endl;
  return 0;
}
