#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 2;
long long inline in() {
  long long x = 0, flag = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
  return x * flag;
}
int n, llim, wlim;
long long ans;
int head[MAXN], nume;
struct Adj {
  int nex, to, w;
} adj[MAXN << 1];
void addedge(int from, int to, int w) {
  adj[++nume] = (Adj){head[from], to, w};
  head[from] = nume;
}
void link(int u, int v, int w) {
  addedge(u, v, w);
  addedge(v, u, w);
}
long long val[MAXN];
int lowbit(int x) { return x & (-x); }
void add(int x, int v) {
  for (int i = x; i <= llim + 1; i += lowbit(i)) val[i] += v;
}
long long query(int x) {
  int ret = 0;
  for (int i = x; i >= 1; i -= lowbit(i)) ret += val[i];
  return ret;
}
bool vis[MAXN];
int siz[MAXN], cen;
void getcen(int u, int fa, int tot) {
  siz[u] = 1;
  int mx = 0;
  for (int i = head[u]; i; i = adj[i].nex) {
    int v = adj[i].to;
    if (v == fa || vis[v]) continue;
    getcen(v, u, tot);
    siz[u] += siz[v];
    mx = max(mx, siz[v]);
  }
  mx = max(mx, tot - siz[u]);
  if (mx <= (tot + 1) / 2) cen = u;
}
int top;
pair<int, int> rec[MAXN];
void calc(int u, int fa, int dis, int sum) {
  if (dis <= llim && sum <= wlim) rec[++top] = make_pair(sum, dis);
  siz[u] = 1;
  for (int i = head[u]; i; i = adj[i].nex) {
    int v = adj[i].to, w = adj[i].w;
    if (v == fa || vis[v]) continue;
    calc(v, u, dis + 1, sum + w);
    siz[u] += siz[v];
  }
}
long long getans(int u, int fa, int dis, int sum) {
  long long ret = 0;
  top = 0;
  calc(u, fa, dis, sum);
  sort(rec + 1, rec + top + 1);
  int l = 1, r = top;
  for (int i = 1; i <= top; ++i) add(rec[i].second + 1, 1);
  for (; l <= top && r >= 1; ++l) {
    while (rec[l].first + rec[r].first > wlim && r >= 1)
      add(rec[r].second + 1, -1), --r;
    if (!r) break;
    ret += query(llim + 2 - rec[l].second - 1);
    if (rec[l].first * 2 <= wlim && rec[l].second * 2 <= llim) ret--;
  }
  for (int i = 1; i <= r; ++i) add(rec[i].second + 1, -1);
  return ret >> 1;
}
void solve(int u, int tot) {
  cen = 0;
  getcen(u, 0, tot);
  vis[cen] = true;
  ans += getans(cen, 0, 0, 0);
  for (int i = head[cen]; i; i = adj[i].nex) {
    int v = adj[i].to, w = adj[i].w;
    if (vis[v]) continue;
    ans -= getans(v, cen, 1, w);
  }
  top = 0;
  for (int i = head[cen]; i; i = adj[i].nex) {
    int v = adj[i].to;
    if (vis[v]) continue;
    solve(v, siz[v]);
  }
}
int main() {
  n = in();
  llim = in();
  wlim = in();
  for (int i = 2; i <= n; ++i) {
    int v = in(), w = in();
    link(i, v, w);
  }
  solve(1, n);
  printf("%lld\n", ans);
  return 0;
}
