#include <bits/stdc++.h>
#pragma GCC optimize("O2,unroll-loops")
using namespace std;
const long long Max = 5e5 + 10;
const long long LOG = 20;
long long n, l, w;
bool hide[Max];
vector<pair<long long, long long> > N[Max];
long long H[Max], W[Max];
long long sub[Max];
void pre(long long v, long long p) {
  sub[v] = 1;
  for (pair<long long, long long> u : N[v])
    if (u.first != p && !hide[u.first]) pre(u.first, v), sub[v] += sub[u.first];
}
inline long long find_centroid(long long v, long long sz) {
  long long p = v;
  bool no = true;
  while (no) {
    no = false;
    for (pair<long long, long long> u : N[v])
      if (!hide[u.first] && u.first != p && sub[u.first] * 2 > sz) {
        p = v, v = u.first, no = true;
        break;
      }
  }
  return (v);
}
vector<pair<long long, long long> > A;
long long ANS;
long long bit[Max];
void upd(long long i, long long x) {
  i += 2;
  while (i <= n + 3) bit[i] += x, i += i & -i;
}
long long get(long long i) {
  i += 2;
  long long ans = 0;
  while (i >= 1) ans += bit[i], i -= i & -i;
  return ans;
}
void DFS(long long v, long long p) {
  A.push_back(make_pair(W[v], H[v]));
  for (pair<long long, long long> u : N[v])
    if (!hide[u.first] && u.first != p)
      W[u.first] = W[v] + u.second, H[u.first] = H[v] + 1, DFS(u.first, v);
}
inline long long Query() {
  long long ans = 0;
  sort(A.begin(), A.end());
  long long ptr = A.size() - 1;
  for (long long i = 0; i < A.size(); i++) {
    upd(A[i].second, 1);
    while (ptr >= 0 && A[ptr].first + A[i].first > w) ptr--;
    while (ptr >= 0 &&
           (i == A.size() - 1 || A[ptr].first + A[i + 1].first > w)) {
      if (l - A[ptr].second >= 0) ans += get(l - A[ptr].second);
      ptr--;
    }
  }
  for (long long i = 0; i < A.size(); i++) upd(A[i].second, -1);
  A.clear();
  return ans;
}
void solve(long long v) {
  pre(v, v);
  v = find_centroid(v, sub[v]);
  W[v] = 0;
  H[v] = 0;
  DFS(v, v);
  ANS += Query();
  for (pair<long long, long long> u : N[v])
    if (!hide[u.first])
      H[u.first] = 1, W[u.first] = u.second, DFS(u.first, v), ANS -= Query();
  hide[v] = true;
  for (pair<long long, long long> u : N[v])
    if (!hide[u.first]) solve(u.first);
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> l >> w;
  for (long long i = 2; i <= n; i++) {
    long long p, x;
    cin >> p >> x;
    N[i].push_back(make_pair(p, x));
    N[p].push_back(make_pair(i, x));
  }
  solve(1);
  cout << (ANS - n) / 2 << '\n';
}
