#include <bits/stdc++.h>
using namespace std;
const int Mx = 1 << 17;
int n, L, W;
long long R, Fen[Mx << 2];
vector<int> V1, VA;
struct node {
  vector<pair<int, int> > N;
  bool ctred = false;
  int sz, dw, dl;
} G[Mx];
int DFS1(int v, int u = -1) {
  G[v].sz = true;
  for (pair<int, int> e : G[v].N)
    if (!G[e.second].ctred && e.second != u) G[v].sz += DFS1(e.second, v);
  return G[v].sz;
}
void DFS2(int v, int u = -1, int w = 0) {
  if (u != -1) {
    G[v].dw = G[u].dw + w;
    G[v].dl = G[u].dl + 1;
  }
  V1.push_back(v);
  VA.push_back(v);
  for (pair<int, int> e : G[v].N) {
    if (!G[e.second].ctred && e.second != u) DFS2(e.second, v, e.first);
  }
}
bool wCompare(int u, int v) { return G[u].dw < G[v].dw; }
void add(int id, int d = +1) {
  for (id++; id < Mx; id += id & -id) Fen[id] += d;
}
void rmv(int id) { add(id, -1); }
int get(int id) {
  if (id < 0) return 0;
  int s = 0;
  for (id++; id; id -= id & -id) s += Fen[id];
  return s;
}
long long sweepLine(vector<int>& V) {
  long long A = 0;
  sort(V.begin(), V.end(), wCompare);
  for (int x : V) add(G[x].dl);
  int e = V.size() - 1;
  for (int i = 0; i < V.size(); i++) {
    for (; e >= 0 && G[V[i]].dw + G[V[e]].dw > W; e--) rmv(G[V[e]].dl);
    A += get(L - G[V[i]].dl);
  }
  for (; e >= 0; e--) rmv(G[V[e]].dl);
  V.resize(0);
  return A;
}
void centroid(int r = 1) {
  DFS1(r);
  int v = r, t = 1;
  bool ctr = false;
  while (!ctr) {
    ctr = true;
    for (pair<int, int> e : G[v].N) {
      int u = e.second;
      if (u != t && !G[u].ctred && 2 * G[u].sz > G[r].sz) {
        ctr = false;
        t = v;
        v = u;
        break;
      }
    }
  }
  G[v].ctred = true;
  G[v].dw = G[v].dl = 0;
  VA.push_back(v);
  for (pair<int, int> u : G[v].N)
    if (!G[u.second].ctred) {
      DFS2(u.second, v, u.first);
      R -= sweepLine(V1);
    }
  R += sweepLine(VA);
  for (pair<int, int> u : G[v].N)
    if (!G[u.second].ctred) centroid(u.second);
}
int main() {
  cin >> n >> L >> W;
  for (int i = 1; i < n; i++) {
    int p, w;
    cin >> p >> w;
    G[p].N.push_back({w, i + 1});
    G[i + 1].N.push_back({w, p});
  }
  centroid();
  cout << (R - n) / 2;
}
