#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0;
  bool op = false;
  char c = getchar();
  while (!isdigit(c)) op |= (c == '-'), c = getchar();
  while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  return op ? -x : x;
}
const int N = 100010;
const int INF = 1e9;
int n, L, W, tot, rt;
long long ans;
int cnt, Siz;
int head[N], nxt[N << 1], edge[N << 1], to[N << 1], dis[N], maxi[N], siz[N],
    len[N], tree[N];
bool vis[N];
void addedge(int u, int v, int w) {
  to[++tot] = v;
  edge[tot] = w;
  nxt[tot] = head[u];
  head[u] = tot;
  return;
}
struct Node {
  int dis, len;
  Node(int dis = 0, int len = 0) : dis(dis), len(len) {}
  bool operator<(const Node &tmp) const { return dis < tmp.dis; }
} d[N];
void find(int u, int fa) {
  siz[u] = 1;
  maxi[u] = 0;
  for (int i = head[u]; i; i = nxt[i]) {
    if (to[i] == fa || vis[to[i]]) continue;
    find(to[i], u);
    maxi[u] = max(maxi[u], siz[to[i]]);
    siz[u] += siz[to[i]];
  }
  maxi[u] = max(maxi[u], Siz - siz[u]);
  if (maxi[u] < maxi[rt]) rt = u;
  return;
}
void getdis(int u, int fa, int dist, int Len) {
  if (dist > W || Len > L) return;
  d[++cnt] = Node(dist, Len);
  for (int i = head[u]; i; i = nxt[i]) {
    if (to[i] == fa || vis[to[i]]) continue;
    getdis(to[i], u, dist + edge[i], Len + 1);
  }
  return;
}
int lowbit(int x) { return x & -x; }
void update(int x, int val) {
  while (x <= n + 1) {
    tree[x] += val;
    x += lowbit(x);
  }
  return;
}
int query(int x) {
  int res = 0;
  while (x > 0) {
    res += tree[x];
    x -= lowbit(x);
  }
  return res;
}
long long calc(int u, int dist, int Len) {
  cnt = 0;
  getdis(u, 0, dist, Len);
  sort(d + 1, d + 1 + cnt);
  int l = 1, r = cnt;
  long long res = 0;
  memset(tree, 0, sizeof(tree));
  for (int i = 2; i <= cnt; i++) update(d[i].len + 1, 1);
  while (l < r) {
    while (l < r && d[l].dis + d[r].dis > W) update(d[r--].len + 1, -1);
    res += r - l - (query(n + 1) - query(min(n + 1, L - d[l].len + 1)));
    update(d[++l].len + 1, -1);
  }
  return res;
}
void dfz(int u) {
  vis[u] = true;
  ans += calc(u, 0, 0);
  for (int i = head[u]; i; i = nxt[i]) {
    if (vis[to[i]]) continue;
    ans -= calc(to[i], edge[i], 1);
    Siz = siz[to[i]];
    rt = 0;
    maxi[0] = INF;
    find(to[i], 0);
    dfz(rt);
  }
  return;
}
signed main() {
  n = read();
  L = read();
  W = read();
  for (int i = 1; i < n; i++) {
    int p = read(), w = read();
    addedge(i + 1, p, w);
    addedge(p, i + 1, w);
  }
  maxi[0] = INF;
  rt = 0;
  Siz = n;
  find(1, 0);
  dfz(rt);
  printf("%lld", ans);
  return 0;
}
