#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
int n, m, K, d[N], w[N], h[N], to[N], nx[N];
long long f[N];
struct node {
  long long x, tg;
  node *lc, *rc;
  void add(long long a) { x += a, tg += a; }
  void update() {
    x = 0;
    if (lc) x = max(x, lc->x);
    if (rc) x = max(x, rc->x);
  }
  void down() {
    if (!tg) return;
    if (lc) lc->add(tg);
    if (rc) rc->add(tg);
    tg = 0;
  }
} po[N * 40], *tt = po;
class SegTree {
  node *root;
  void merge(node *&x, node *y, int l, int r, long long u, long long v) {
    if (!x || !y) {
      if (!x && !y) return;
      if (!x)
        x = y, x->add(u);
      else
        x->add(v);
      return;
    }
    if (l == r) {
      x->x = max(max(x->x, u) + y->x, x->x + max(y->x, v));
      return;
    }
    int mid = l + r >> 1;
    x->down(), y->down();
    merge(x->rc, y->rc, mid + 1, r, max(u, x->lc ? x->lc->x : 0),
          max(v, y->lc ? y->lc->x : 0));
    merge(x->lc, y->lc, l, mid, u, v);
    x->update();
  }
  void modify(node *&o, int l, int r, int d, long long w) {
    if (!o) o = ++tt;
    if (l == r) {
      o->x = max(o->x, w);
      return;
    }
    int mid = l + r >> 1;
    o->down();
    if (d <= mid)
      modify(o->lc, l, mid, d, w);
    else
      modify(o->rc, mid + 1, r, d, w);
    o->update();
  }
  long long qry(node *o, int l, int r, int d) {
    if (!o) return 0;
    if (r <= d) return o->x;
    int mid = l + r >> 1;
    o->down();
    long long ret = qry(o->lc, l, mid, d);
    if (d > mid) ret = max(ret, qry(o->rc, mid + 1, r, d));
    return ret;
  }

 public:
  void merge(const SegTree &r) { merge(root, r.root, 1, K, 0, 0); }
  void modify(int d, long long w) {
    if (!d) return;
    modify(root, 1, K, d, w);
  }
  long long qry(int d) {
    if (!d) return 0;
    return qry(root, 1, K, d);
  }
} T[N];
void dfs(int p) {
  for (int i = h[p]; i; i = nx[i]) {
    dfs(to[i]);
    f[p] += T[to[i]].qry(d[p]);
    T[p].merge(T[to[i]]);
  }
  f[p] += w[p];
  T[p].modify(d[p], f[p]);
}
int main() {
  scanf("%d%d%d", &n, &m, &K);
  for (int i = 2, fa, tt = 0; i <= n; ++i) {
    scanf("%d", &fa);
    to[++tt] = i, nx[tt] = h[fa], h[fa] = tt;
  }
  for (int i = 1, u; i <= m; ++i) {
    scanf("%d", &u);
    scanf("%d%d", d + u, w + u);
  }
  dfs(1);
  printf("%I64d", T[1].qry(K));
  return 0;
}
