/// @author Camillus <3
#include "bits/stdc++.h"
using ll = long long;
using namespace std;
int p[100500];
vector<int> g[100500];
int h[100500];
int sz[100500];
void dfs_sz(int u) {
sz[u] = 1;
for (int& v : g[u]) {
dfs_sz(v);
sz[u] += sz[v];
}
}
void dfs_h(int u) {
if (!g[u].empty()) {
for (int v : g[u]) {
h[v] = v;
}
h[g[u].front()] = h[u];
}
for (int v : g[u]) {
dfs_h(v);
}
}
pair<int, int> f[100500];
struct ds {
vector<int> keys = {0};
ds() {}
void add_key(int day) {
keys.push_back(day);
}
vector<ll> tree;
int n;
void build() {
ranges::sort(keys);
keys.erase(unique(keys.begin(), keys.end()), keys.end());
n = (int)keys.size();
tree.resize(n + 1);
}
int lower_bound(int key) {
auto i = ranges::lower_bound(keys, key) - keys.begin();
return i;
}
int upper_bound(int key) {
auto i = ranges::lower_bound(keys, key) - keys.begin();
return i;
}
void add(int l, int r, ll v) {
for (int i = l; i < n; i += i & -i) {
tree[i] += v;
}
for (int i = r + 1; i < n; i += i & -i) {
tree[i] -= v;
}
}
ll get(int i) const {
ll res = 0;
for (; i > 0; i -= i & -i) {
res += tree[i];
}
return res;
}
};
ds DS[100500];
void make_ds(int n) {
for (int u = 1; u <= n; u++) {
if (h[u] == u) {
auto dfs = [&r=u](auto &&dfs, int u) -> void {
if (f[u].first) {
debug(r, u);
DS[r].add_key(f[u].first);
}
for (int v : g[u]) {
dfs(dfs, v);
}
};
dfs(dfs, u);
DS[u].build();
debug(u);
debug(DS[u].keys);
}
}
}
void dfs(int u) {
for (int v : g[u]) {
dfs(v);
if (v != g[u].front()) {
for (int i = 1; i < DS[v].n; i++) {
int L = DS[v].keys[i];
int R = 2'000'000'000;
if (i + 1 != DS[v].n) {
R = DS[v].keys[i + 1];
}
ll D = DS[v].get(i);
L = DS[h[u]].lower_bound(L);
R = DS[h[u]].lower_bound(R);
DS[h[u]].add(L, R - 1, D);
}
}
}
if (f[u].first != 0) {
int i = DS[h[u]].lower_bound(f[u].first);
ll value = DS[h[u]].get(i) + f[u].second;
for (; i < DS[h[u]].n; i++) {
ll cur = DS[h[u]].get(i);
if (cur < value) {
DS[h[u]].add(i, i, value - cur);
} else {
break;
}
}
}
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
h[1] = 1;
int n, m, k;
cin >> n >> m >> k;
for (int u = 2; u <= n; u++) {
cin >> p[u];
g[p[u]].push_back(u);
}
for (int i = 0; i < m; i++) {
int u, d, w;
cin >> u >> d >> w;
f[u] = {d, w};
}
dfs_sz(1);
dfs_h(1);
make_ds(n);
dfs(1);
cout << DS[1].get(DS[1].n - 1) << '\n';
return 0;
}