#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
struct edge {
  int to, next, v;
} e[maxn << 2];
struct path {
  int l, w;
} g[maxn << 2];
int n, num, cnt, mnl, root, x, y, w, l, va, maxl;
long long ans;
long long f[maxn];
int sz[maxn], head[maxn], mx[maxn], dis[maxn], dep[maxn];
bool vis[maxn];
bool cmp(path a, path b) { return a.w < b.w; }
void addedge(int x, int y, int va) {
  num++;
  e[num].to = y;
  e[num].next = head[x];
  e[num].v = va;
  head[x] = num;
}
void dfs1(int k, int pre) {
  int u;
  sz[k] = 1;
  mx[k] = 0;
  for (int j = head[k]; j; j = e[j].next) {
    u = e[j].to;
    if (vis[u] || u == pre) continue;
    dfs1(u, k);
    sz[k] += sz[u];
    mx[k] = max(mx[k], sz[u]);
  }
}
void dfs2(int k, int pre, int sum) {
  int u;
  mx[k] = max(mx[k], sum - sz[k]);
  if (mx[k] < mnl) mnl = mx[k], root = k;
  for (int j = head[k]; j; j = e[j].next) {
    u = e[j].to;
    if (vis[u] || u == pre) continue;
    dfs2(u, k, sum);
  }
}
void dfs3(int k, int pre) {
  int u;
  for (int j = head[k]; j; j = e[j].next) {
    u = e[j].to;
    if (vis[u] || u == pre) continue;
    dep[u] = dep[k] + 1;
    dis[u] = dis[k] + e[j].v;
    g[++cnt].l = dep[u];
    g[cnt].w = dis[u];
    dfs3(u, k);
  }
}
int lowbit(int c) { return c & -c; }
void add(int z, long long v) {
  for (; z <= maxl; z += lowbit(z)) f[z] += v;
}
long long query(int z) {
  long long sum = 0;
  for (; z; z -= lowbit(z)) sum += f[z];
  return sum;
}
long long calc(int x, int tag, int dist, int deep) {
  long long res = 0;
  int t;
  cnt = maxl = 0;
  dep[x] = deep;
  dis[x] = dist;
  if (tag == -1) {
    g[++cnt].l = dep[x];
    g[cnt].w = dis[x];
  }
  dfs3(x, 0);
  sort(g + 1, g + 1 + cnt, cmp);
  for (int i = 1; i <= cnt; i++) maxl = max(maxl, g[i].l);
  for (int i = 0; i <= maxl; i++) f[i] = 0;
  for (int i = 1; i <= cnt; i++) add(g[i].l, 1);
  t = cnt;
  if (tag == 1)
    for (int i = 1; i <= cnt; i++)
      if (g[i].l <= l && g[i].w <= w) ans++;
  for (int i = 1; i <= cnt; i++) {
    if (g[i].l > l) continue;
    if (g[i].w > w) break;
    while (i < t && g[i].w + g[t].w > w) {
      add(g[t].l, -1);
      t--;
    }
    if (t <= i) break;
    add(g[i].l, -1);
    res += query(min(maxl, l - g[i].l));
  }
  return res;
}
void solve(int x) {
  root = 0;
  mnl = n + 1;
  dfs1(x, 0);
  dfs2(x, 0, sz[x]);
  vis[root] = true;
  ans += calc(root, 1, 0, 0);
  for (int j = head[root]; j; j = e[j].next)
    if (!vis[e[j].to]) ans -= calc(e[j].to, -1, e[j].v, 1);
  for (int j = head[root]; j; j = e[j].next)
    if (!vis[e[j].to]) solve(e[j].to);
}
int main() {
  scanf("%d%d%d", &n, &l, &w);
  for (int i = 2; i <= n; i++) {
    scanf("%d%d", &x, &va);
    y = i;
    addedge(x, y, va);
    addedge(y, x, va);
  }
  ans = 0;
  solve(1);
  printf("%I64d\n", ans);
  return 0;
}
