#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long x = 0, f = 1;
  char ch;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long n, m, W, L;
long long ans;
long long head[2000010], pos;
struct edge {
  long long to, next, c;
} e[2000010 << 1];
void add(long long a, long long b, long long c) {
  pos++;
  e[pos].to = b, e[pos].c = c, e[pos].next = head[a], head[a] = pos;
}
void insert(long long a, long long b, long long c) {
  add(a, b, c);
  add(b, a, c);
}
long long f[2000010], size[2000010], sum, rt;
bool vis[2000010];
void find_root(long long u, long long fa) {
  size[u] = 1, f[u] = 0;
  for (long long i = head[u]; i; i = e[i].next) {
    long long v = e[i].to;
    if (v == fa || vis[v]) continue;
    find_root(v, u);
    size[u] += size[v];
    f[u] = max(f[u], size[v]);
  }
  f[u] = max(f[u], sum - size[u]);
  if (f[u] < f[rt]) rt = u;
}
long long C[2000010], tot, st;
void add(long long x, long long val) {
  if (x <= 0) return;
  while (x <= n) {
    C[x] += val;
    x += x & (-x);
  }
}
long long ask(long long x) {
  long long ret = 0;
  if (x < 0) return 0;
  while (x) {
    ret += C[x];
    x -= x & (-x);
  }
  return ret;
}
struct node {
  long long w, l;
} d[2000010], p[2000010];
bool operator<(node a, node b) { return a.w < b.w; }
long long sz;
void get_dep(long long u, long long fa) {
  sz++;
  for (long long i = head[u]; i; i = e[i].next) {
    long long v = e[i].to;
    if (v == fa || vis[v]) continue;
    d[v].l = d[u].l + 1, d[v].w = d[u].w + e[i].c;
    p[++tot] = d[v];
    get_dep(v, u);
  }
}
long long cal(long long u, long long now1, long long now2) {
  tot = 0;
  d[u].w = now1, d[u].l = now2;
  sz = 0;
  get_dep(u, 0);
  long long ret = 0;
  sort(p + 1, p + tot + 1);
  long long l = 1, r = tot;
  for (long long i = l; i <= r; i++) {
    add(p[i].l, 1);
    if (p[i].l + now2 <= L && p[i].w + now1 <= W) ret++;
  }
  while (l < r) {
    if (p[l].w + p[r].w > W)
      add(p[r--].l, -1);
    else {
      add(p[l].l, -1);
      ret += ask(L - p[l].l);
      l++;
    }
  }
  while (l <= r) {
    add(p[l].l, -1);
    l++;
  }
  return ret;
}
void work(long long u) {
  vis[u] = 1;
  ans += cal(u, 0, 0);
  for (long long i = head[u]; i; i = e[i].next) {
    long long v = e[i].to;
    if (vis[v]) continue;
    ans -= cal(v, e[i].c, 1);
    sum = size[v], rt = 0;
    find_root(v, 0);
    work(rt);
  }
}
int main() {
  n = read();
  L = read();
  W = read();
  for (long long i = 1; i < n; i++) {
    long long a = i + 1, b = read(), c = read();
    insert(a, b, c);
  }
  f[0] = 1 << 26, sum = n;
  find_root(1, 0);
  work(rt);
  cout << ans << "\n";
}
