/* Grader for task "cherryplum". Reads the input, calls solve once and prints
   the returned value. p has n-1 elements: p[i] is the parent of vertex i+2.
   v, d, w have m elements each and describe the fruits. */
#include <cstdio>
#include <vector>

long long solve(int n, int m, int k, const std::vector<int>& p,
                const std::vector<int>& v, const std::vector<int>& d,
                const std::vector<long long>& w);

int main() {
    int n, m, k;
    if (scanf("%d %d %d", &n, &m, &k) != 3) return 0;
    std::vector<int> p(n - 1), v(m), d(m);
    std::vector<long long> w(m);
    for (int i = 0; i < n - 1; i++) scanf("%d", &p[i]);
    for (int j = 0; j < m; j++) scanf("%d %d %lld", &v[j], &d[j], &w[j]);
    printf("%lld\n", solve(n, m, k, p, v, d, w));
    return 0;
}
