#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int maxn = 1e5 + 10;
int len, num, n, l, w;
long long ans;
int head[maxn], sum[maxn << 2];
int m[maxn], Size[maxn], mi, Root, vis[maxn];
struct Node {
  int l;
  int w;
} dis[maxn];
struct Edge {
  int to;
  int next;
  int val;
} e[maxn << 1];
void add(int from, int to, int val) {
  e[len].to = to;
  e[len].val = val;
  e[len].next = head[from];
  head[from] = len++;
}
void up(int rt) { sum[rt] = sum[rt << 1] + sum[rt << 1 | 1]; }
void build(int l, int r, int rt) {
  sum[rt] = 0;
  if (l == r) return;
  int mid = (l + r) >> 1;
  build(l, mid, rt << 1);
  build(mid + 1, r, rt << 1 | 1);
}
void update(int key, int add, int l, int r, int rt) {
  if (l == r) {
    sum[rt] += add;
    return;
  }
  int mid = (l + r) >> 1;
  if (key <= mid)
    update(key, add, l, mid, rt << 1);
  else
    update(key, add, mid + 1, r, rt << 1 | 1);
  up(rt);
}
int ask(int L, int R, int l, int r, int rt) {
  if (L <= l && r <= R) return sum[rt];
  int mid = (l + r) >> 1;
  int ans = 0;
  if (L <= mid) ans += ask(L, R, l, mid, rt << 1);
  if (R > mid) ans += ask(L, R, mid + 1, r, rt << 1 | 1);
  return ans;
}
void clear(int key, int l, int r, int rt) {
  sum[rt] = 0;
  if (l == r) return;
  int mid = (l + r) >> 1;
  if (key <= mid)
    clear(key, l, mid, rt << 1);
  else
    clear(key, mid + 1, r, rt << 1 | 1);
}
void gaosize(int x, int fa) {
  Size[x] = 1;
  m[x] = 0;
  for (int i = head[x]; i != -1; i = e[i].next) {
    int cc = e[i].to;
    if (cc == fa || vis[cc]) continue;
    gaosize(cc, x);
    Size[x] += Size[cc];
    if (Size[cc] > m[x]) m[x] = Size[cc];
  }
}
void gaoroot(int root, int x, int fa) {
  m[x] = max(m[x], Size[root] - Size[x]);
  if (mi > m[x]) {
    mi = m[x];
    Root = x;
  }
  for (int i = head[x]; i != -1; i = e[i].next) {
    int cc = e[i].to;
    if (vis[cc] || cc == fa) continue;
    gaoroot(root, cc, x);
  }
}
void gaodis(int x, int fa, Node val) {
  dis[num++] = val;
  for (int i = head[x]; i != -1; i = e[i].next) {
    int cc = e[i].to;
    if (vis[cc] || cc == fa) continue;
    Node t = val;
    t.l++;
    t.w += e[i].val;
    gaodis(cc, x, t);
  }
}
int cmp(const Node &a, const Node &b) { return a.w < b.w; }
long long calc(int x, Node val) {
  long long ret = 0;
  num = 0;
  gaodis(x, 0, val);
  sort(dis, dis + num, cmp);
  for (int i = 0; i < num; i++) {
    update(dis[i].l, 1, 0, n, 1);
  }
  int i = 0;
  int j = num - 1;
  while (i < j) {
    while (dis[i].w + dis[j].w > w && i < j) {
      update(dis[j].l, -1, 0, n, 1);
      j--;
    }
    update(dis[i].l, -1, 0, n, 1);
    if (l >= dis[i].l) ret += ask(0, min(n, l - dis[i].l), 0, n, 1);
    i++;
  }
  if (i == j) update(dis[i].l, -1, 0, n, 1);
  return ret;
}
void gao(int x) {
  mi = n;
  gaosize(x, 0);
  gaoroot(x, x, 0);
  Node t;
  t.l = 0;
  t.w = 0;
  ans += calc(Root, t);
  vis[Root] = 1;
  for (int i = head[Root]; i != -1; i = e[i].next) {
    int cc = e[i].to;
    if (vis[cc]) continue;
    Node t;
    t.l = 1;
    t.w = e[i].val;
    ans -= calc(cc, t);
    gao(cc);
  }
}
void init() {
  ans = 0;
  len = 0;
  memset(head, -1, sizeof(head));
  memset(vis, 0, sizeof(vis));
}
int main() {
  int a, b;
  cin >> n >> l >> w;
  init();
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &a, &b);
    add(i + 1, a, b);
    add(a, i + 1, b);
  }
  gao(1);
  cout << ans << endl;
  return 0;
}
