#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
struct Edge {
  int next, to, dis;
  Edge(int a = 0, int b = 0, int c = 0) : next(a), to(b), dis(c) {}
} e[maxn << 1];
int head[maxn], tot;
void Add(int u, int v, int w) {
  e[++tot] = Edge(head[u], v, w);
  head[u] = tot;
}
long long ans, op;
int N, L, W, size[maxn];
int F, Size, root, vis[maxn];
struct Node {
  int l, d;
  Node(int l = 0, int d = 0) : l(l), d(d) {}
};
Node q[maxn];
int c[maxn], cnt;
void insert(int p, int va) {
  ++p;
  for (; p - 1 <= N; p += p & -p) c[p] += va;
}
void clear(int p) {
  ++p;
  for (; p - 1 <= N; p += p & -p) c[p] = 0;
}
int query(int p) {
  ++p;
  int ans = 0;
  for (; p; p -= p & -p) ans += c[p];
  return ans;
}
void getdep(int x, int fa, int dep, int dis) {
  if (dep > L || dis > W) return;
  q[++cnt] = Node(dep, dis);
  for (int i = head[x]; i; i = e[i].next) {
    int to = e[i].to;
    if (vis[to] || to == fa) continue;
    getdep(to, x, dep + 1, dis + e[i].dis);
  }
}
bool cmp(const Node& x, const Node& y) { return x.d < y.d; }
void calc(int x, int son, int bas) {
  cnt = 0;
  getdep(x, -1, son, bas);
  sort(q + 1, q + cnt + 1, cmp);
  for (int i = 1; i <= cnt; ++i) insert(q[i].l, 1);
  int l = 1, r = cnt;
  while (l < r) {
    insert(q[l].l, -1);
    while (l < r && q[l].d + q[r].d > W) insert(q[r].l, -1), --r;
    ans += op * query(L - q[l].l);
    ++l;
  }
  for (int i = 1; i <= cnt; ++i) clear(q[i].l);
}
int getroot(int x, int fa) {
  int f = 0;
  size[x] = 1;
  for (int i = head[x]; i; i = e[i].next) {
    int to = e[i].to;
    if (vis[to] || to == fa) continue;
    size[x] += getroot(to, x);
    f = max(f, size[to]);
  }
  f = max(f, Size - size[x]);
  if (f <= F) F = f, root = x;
  return size[x];
}
void solve(int x) {
  vis[x] = 1;
  op = 1, calc(x, 0, 0);
  for (int i = head[x]; i; i = e[i].next) {
    int to = e[i].to;
    if (vis[to]) continue;
    op = -1, calc(to, 1, e[i].dis);
    F = Size = size[to];
    getroot(to, x);
    solve(root);
  }
}
int main() {
  scanf("%d%d%d", &N, &L, &W);
  for (int i = 2, a, b; i <= N; ++i) {
    scanf("%d%d", &a, &b);
    Add(a, i, b);
    Add(i, a, b);
  }
  F = Size = N;
  getroot(1, -1);
  solve(root);
  printf("%I64d\n", ans);
  getchar(), getchar();
  return 0;
}
