#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, M = 2 * N;
int n, nn, nl, nw, i;
long long ans;
int read() {
  char c = getchar();
  int k = 0;
  for (; c < 48 || c > 57; c = getchar())
    ;
  for (; c > 47 && c < 58; c = getchar()) k = (k << 3) + (k << 1) + c - 48;
  return k;
}
int v, et, he[N];
struct edge {
  int l, to, v;
} e[M];
void line(int x, int y) {
  e[++et].l = he[x];
  he[x] = et;
  e[et].to = y;
  e[et].v = v;
}
int size[N], p, mp, ap, t1, t2;
struct arr {
  int v, l;
} q1[N], q2[N];
bool operator<(arr A, arr B) { return A.v < B.v; }
bool f[N];
void find(int x, int fa) {
  size[x] = 1;
  int i, y, k = 0;
  for (i = he[x]; i; i = e[i].l) {
    y = e[i].to;
    if (y == fa || f[y]) continue;
    find(y, x);
    size[x] += size[y];
    k = max(k, size[y]);
  }
  k = max(k, p - size[x]);
  if (k < mp) mp = k, ap = x;
}
void dfs(int x, int fa, int w, int l) {
  q1[++t1] = q2[++t2] = (arr){w, l};
  for (int i = he[x]; i; i = e[i].l) {
    int y = e[i].to;
    if (y == fa || f[y]) continue;
    dfs(y, x, w + e[i].v, l + 1);
  }
}
int g[N];
void add(int x) {
  for (; x <= nn; x += x & -x) g[x]++;
}
int ask(int x) {
  int k = 0;
  for (; x; x -= x & -x) k += g[x];
  return k;
}
void clear(int x) {
  for (; x <= nn && g[x]; x += x & -x) g[x] = 0;
}
long long cal(arr *a, int n) {
  long long sum = 0;
  int i, j = 1;
  sort(a + 1, a + n + 1);
  for (i = n; i; i--) {
    for (; j <= n && a[i].v + a[j].v <= nw; j++) add(a[j].l + 1);
    if (a[i].l <= nl) sum += ask(nl - a[i].l + 1);
  }
  for (i = 1; i < j; i++) clear(a[i].l + 1);
  return sum;
}
void divide(int x) {
  f[x] = 1;
  int i, y;
  q2[t2 = 1] = (arr){0, 0};
  for (i = he[x]; i; i = e[i].l)
    if (!f[y = e[i].to]) {
      t1 = 0;
      dfs(y, 0, e[i].v, 1);
      ans -= cal(q1, t1);
    }
  ans += cal(q2, t2) - 1;
  for (i = he[x]; i; i = e[i].l)
    if (!f[y = e[i].to]) {
      p = size[y];
      mp = p + 1;
      find(y, 0);
      divide(ap);
    }
}
int main() {
  n = read();
  nn = n + 1;
  nl = read();
  nw = read();
  for (i = 2; i <= n; i++) {
    int x = read();
    v = read();
    line(i, x);
    line(x, i);
  }
  p = n;
  mp = p + 1;
  find(1, 0);
  divide(ap);
  printf("%I64d", ans / 2);
}
