#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
const int N = 1e5 + 7;
int n, Q, l, w;
vector<int> g[N], gg[N];
int sz[N], mark[N], dis[N], wi[N];
long long ans;
inline int SZ(int x, int par) {
  sz[x] = 1;
  for (auto i : g[x])
    if (i != par && !mark[i]) sz[x] += SZ(i, x);
  return sz[x];
}
inline void DIS(int x, int par) {
  for (int i = 0; i < ((int)g[x].size()); i++)
    if (g[x][i] != par && !mark[g[x][i]]) {
      dis[g[x][i]] = dis[x] + 1;
      wi[g[x][i]] = wi[x] + gg[x][i];
      DIS(g[x][i], x);
    }
}
int fen[N];
inline void add(int x, int y) {
  x++;
  for (int i = x; i < N; i += i & -i) fen[i] += y;
}
inline int get(int x) {
  x++;
  if (x < 1) return 0;
  int res = 0;
  for (int i = x; i; i -= i & -i) res += fen[i];
  return res;
}
vector<pair<int, int> > v;
inline void calc(int sgn) {
  sort(v.begin(), v.end());
  for (auto i : v) add(i.second, 1);
  int pos = ((int)v.size()) - 1;
  for (int i = 0; i < ((int)v.size()); i++) {
    while (v[i].first + v[pos].first > w && pos >= 0) add(v[pos--].second, -1);
    ans += (sgn * 1LL * get(l - v[i].second));
  }
  while (pos >= 0) add(v[pos--].second, -1);
}
inline void dfs(int x, int par) {
  v.push_back({wi[x], dis[x]});
  for (auto i : g[x])
    if (i != par && !mark[i]) dfs(i, x);
}
inline void solve(int x, int par) {
  SZ(x, par);
  int cen = x, pr = par, found = 0;
  while (!found) {
    found = 1;
    for (auto i : g[cen])
      if (!mark[i] && i != pr && sz[i] >= sz[x] / 2) {
        pr = cen;
        cen = i;
        found = 0;
        break;
      }
  }
  mark[cen] = 1;
  dis[cen] = 0;
  wi[cen] = 0;
  DIS(cen, -1);
  vector<pair<int, int> > o;
  for (auto i : g[cen])
    if (!mark[i]) {
      dfs(i, cen);
      calc(-1);
      while (v.size()) {
        o.push_back(v.back());
        v.pop_back();
      }
    }
  o.push_back({0, 0});
  v = o;
  calc(1);
  v.clear();
  for (auto i : g[cen])
    if (!mark[i]) solve(i, cen);
}
int32_t main() {
  n = in(), l = in(), w = in();
  for (int i = 2; i <= n; i++) {
    int x = in(), y = in();
    g[i].push_back(x);
    g[x].push_back(i);
    gg[i].push_back(y);
    gg[x].push_back(y);
  }
  solve(1, -1);
  printf("%I64d\n", (ans - n) / 2);
}
