#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005, maxm = maxn << 1;
int n, e, cnt, L, w;
int start[maxn], to[maxm], then[maxm], worth[maxm], size[maxn], val[maxn],
    fin[maxn], p[maxn], dis[maxn], dep[maxn], t[maxn];
long long ans;
inline void add(int x, int y, int z) {
  then[++e] = start[x], start[x] = e, to[e] = y, worth[e] = z;
}
inline int cmp(int a, int b) { return dis[a] < dis[b]; }
void update(int x, int v) {
  if (x == 0) return;
  for (int i = x; i <= n + 1; i += i & -i) t[i] += v;
}
int query(int x) {
  if (x < 0) return 0;
  int res = 0;
  for (int i = x; i; i -= i & -i) res += t[i];
  return res;
}
void getrt(int x, int last, int sz, int &res) {
  size[x] = 1, val[x] = 0;
  for (int i = start[x]; i; i = then[i]) {
    int y = to[i];
    if (y == last || fin[y]) continue;
    getrt(y, x, sz, res);
    val[x] = max(val[x], size[y]), size[x] += size[y];
  }
  val[x] = max(val[x], sz - size[x]);
  if (val[x] < val[res]) res = x;
}
void dfs(int x, int last) {
  p[++cnt] = x;
  for (int i = start[x]; i; i = then[i]) {
    int y = to[i];
    if (y == last || fin[y]) continue;
    dis[y] = dis[x] + worth[i];
    dep[y] = dep[x] + 1;
    dfs(y, x);
  }
}
long long calc(int x, int d, int dd) {
  cnt = 0, dis[x] = d, dep[x] = dd, dfs(x, 0);
  sort(p + 1, p + 1 + cnt, cmp);
  for (int i = 1; i <= cnt; i++) update(dep[p[i]] + 1, 1);
  int l = 1, r = cnt;
  long long res = 0;
  while (l <= r) {
    if (dis[p[l]] + dis[p[r]] <= w) {
      update(dep[p[l]] + 1, -1);
      res += query(L - dep[p[l]] + 1);
      l++;
    } else {
      update(dep[p[r]] + 1, -1);
      r--;
    }
  }
  return res;
}
void solve(int x, int sz) {
  int res = 0;
  val[res] = 1000050000, getrt(x, 0, sz, res);
  x = res, fin[x] = 1, ans += calc(x, 0, 0);
  for (int i = start[x]; i; i = then[i]) {
    int y = to[i];
    if (fin[y]) continue;
    ans -= calc(y, worth[i], 1);
    solve(y, size[y]);
  }
}
int main() {
  scanf("%d%d%d", &n, &L, &w);
  for (int i = 2; i <= n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, i, y), add(i, x, y);
  }
  solve(1, n);
  printf("%lld\n", ans);
  return 0;
}
