#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
bool del[N];
long long ans;
int n, l, w, root, size, sz[N], f[N], dp[N], d[N], L[N], MAXD, c[N];
struct Edge {
  int v, w;
};
struct Node {
  int val, d;
  bool operator<(const Node &r) const {
    return val < r.val || (val == r.val && d < r.d);
  }
};
vector<Node> dep;
vector<Edge> adj[N];
inline int lowbit(int x) { return x & -x; }
inline void modify(int x) {
  for (; x <= MAXD; x += lowbit(x)) ++c[x];
}
inline int query(int x) {
  if (x > MAXD) x = MAXD;
  int res = 0;
  for (; x > 0; x -= lowbit(x)) res += c[x];
  return res;
}
inline void addedge(int u, int v, int w) {
  adj[u].push_back({v, w});
  adj[v].push_back({u, w});
}
void getroot(int u, int p) {
  sz[u] = 1;
  f[u] = 0;
  for (auto e : adj[u]) {
    int v = e.v;
    if (del[v] || v == p) continue;
    getroot(v, u);
    sz[u] += sz[v];
    f[u] = max(f[u], sz[v]);
  }
  f[u] = max(f[u], size - sz[u]);
  if (f[u] < f[root]) root = u;
}
void getdeep(int u, int p) {
  sz[u] = 1;
  dep.push_back({d[u], dp[u]});
  for (auto e : adj[u]) {
    int v = e.v;
    if (del[v] || v == p) continue;
    d[v] = d[u] + e.w;
    dp[v] = dp[u] + 1;
    getdeep(v, u);
    sz[u] += sz[v];
  }
}
long long cal(int u, int inid, int iniv) {
  int m = 0;
  long long res = 0;
  dp[u] = inid;
  d[u] = iniv;
  dep.clear();
  getdeep(u, 0);
  MAXD = 0;
  sort(dep.begin(), dep.end());
  for (auto v : dep) MAXD = max(MAXD, v.d);
  for (int i = 0; i <= MAXD; ++i) c[i] = 0;
  int cur = 0;
  for (int i = (int)dep.size() - 1; i >= 0; --i) {
    if (dep[i].d == 0) continue;
    for (int &j = cur; j < (int)dep.size() && dep[j].val <= w - dep[i].val; ++j)
      if (dep[j].d) modify(dep[j].d);
    if (l - dep[i].d > 0) res += query(l - dep[i].d);
  }
  for (auto v : dep)
    if (v.d && v.d + v.d <= l && v.val + v.val <= w) --res;
  res /= 2;
  if (inid == 0)
    for (auto v : dep)
      if (v.d && v.d <= l && v.val <= w) ++res;
  return res;
}
void solve(int u) {
  del[u] = true;
  ans += cal(u, 0, 0);
  for (Edge e : adj[u]) {
    int v = e.v;
    if (del[v]) continue;
    ans -= cal(v, 1, e.w);
    f[root = 0] = size = sz[v];
    getroot(v, 0);
    solve(root);
  }
}
int main() {
  scanf("%d%d%d", &n, &l, &w);
  for (int u = 2; u <= n; ++u) {
    int v, w;
    scanf("%d%d", &v, &w);
    addedge(u, v, w);
  }
  f[root = 0] = size = n;
  getroot(1, 0);
  solve(root);
  printf("%I64d\n", ans);
  return 0;
}
