#include <bits/stdc++.h>
using namespace std;
const int IT_MAX = 1 << 18;
const int INF = -1;
int bit[IT_MAX + 10];
void update(int p, int dv) {
  p++;
  for (; p <= IT_MAX; p += p & (-p)) bit[p] += dv;
}
int query(int p) {
  p++;
  int rv = 0;
  for (; p; p -= p & (-p)) rv += bit[p];
  return rv;
}
vector<pair<int, int> > mat[100010], myPaChi, chi;
int lev[100010], pa, cen, sub[100010], tr_sz, dis[100010], wei[100010];
pair<int, int> paInfo[100010];
int W, L;
long long prin;
long long add_pair() {
  long long ret = 0;
  sort(chi.begin(), chi.end());
  reverse(chi.begin(), chi.end());
  int n = chi.size(), i = 0, j = 0;
  for (i = 0, j = n - 1; i < n; i++) {
    for (; j >= 0 && chi[i].first + chi[j].first <= W; j--)
      update(chi[j].second, 1);
    int v = L - chi[i].second;
    if (v >= 0) ret += query(v);
  }
  for (int i = 0; i < n; i++)
    if (chi[i].first + chi[i].first <= W && chi[i].second + chi[i].second <= L)
      ret--;
  for (i = n - 1; i > j; i--) update(chi[i].second, -1);
  chi.clear();
  return ret;
}
void col_info(int p, int baap) {
  if (cen) {
    if (paInfo[p] != make_pair(0, 0)) myPaChi.push_back(paInfo[p]);
    chi.push_back({wei[p], dis[p]});
    paInfo[p] = {wei[p], dis[p]};
  }
  sub[p] = 1;
  for (auto x : mat[p]) {
    if (lev[pa] < lev[x.first]) pa = x.first;
    if (x.first == baap || lev[x.first]) continue;
    dis[x.first] = dis[p] + 1;
    wei[x.first] = wei[p] + x.second;
    col_info(x.first, p);
    sub[p] += sub[x.first];
  }
  if (cen && p == cen) {
    prin += add_pair();
    for (auto x : myPaChi) chi.push_back(x);
    myPaChi.clear();
    prin -= add_pair();
  }
}
int centroid(int p, int baap) {
  if ((sub[p] << 1) <= tr_sz) return baap;
  for (auto x : mat[p])
    if ((sub[x.first] << 1) > tr_sz && !lev[x.first] && x.first != baap)
      return centroid(x.first, p);
  return p;
}
int main() {
  ios::sync_with_stdio(false);
  int n, u, v, c, k;
  cin >> n >> L >> W;
  for (int i = 2; i <= n; i++) {
    u = i;
    cin >> v >> c;
    mat[u].push_back(make_pair(v, c));
    mat[v].push_back(make_pair(u, c));
  }
  for (int l = 1; l <= 18; l++)
    for (int i = 1; i <= n; i++) {
      if (lev[i]) continue;
      pa = 0;
      col_info(i, i);
      tr_sz = sub[i];
      cen = centroid(i, i);
      wei[cen] = dis[cen] = 0;
      col_info(cen, cen);
      lev[cen] = lev[pa] + 1;
      cen = 0;
    }
  cout << ((long long)prin >> 1) << endl;
  return 0;
}
