#include <bits/stdc++.h>
using namespace std;
const int maxn = 100100;
int n, l, w;
int head[maxn], nxt[maxn << 1], ver[maxn << 1], val[maxn << 1], tot;
inline void addedge(int a, int b, int c) {
  nxt[++tot] = head[a];
  ver[tot] = b;
  val[tot] = c;
  head[a] = tot;
  nxt[++tot] = head[b];
  ver[tot] = a;
  val[tot] = c;
  head[b] = tot;
}
vector<pair<int, long long> > v;
inline int cmp(const pair<int, long long> &a, const pair<int, long long> &b) {
  return a.second == b.second ? a.first < b.first : a.second < b.second;
}
inline int lowbit(int x) { return x & -x; }
struct Bitarray {
  int c[maxn], N;
  inline void resize(int n) {
    N = n + 1;
    for (int i = 1; i <= n + 1; i++) c[i] = 0;
  }
  inline void add(int x, int v) {
    x++;
    for (; x <= N; x += lowbit(x)) c[x] += v;
  }
  inline int query(int x) {
    x++;
    x = min(x, N);
    int ans = 0;
    for (; x; x -= lowbit(x)) ans += c[x];
    return ans;
  }
} bit;
inline long long getans() {
  long long ans = 0;
  int mxv = 0, nowr = v.size();
  for (int i = 0; i < (int)v.size(); i++) mxv = max(mxv, v[i].first);
  bit.resize(mxv);
  sort(v.begin(), v.end(), cmp);
  for (int i = 0; i < (int)v.size(); i++) bit.add(v[i].first, 1);
  for (int i = 0; i < (int)v.size(); i++) {
    bit.add(v[i].first, -1);
    while (nowr && v[nowr - 1].second + v[i].second > w)
      nowr--, bit.add(v[nowr].first, -1);
    if (i >= nowr) break;
    if (v[i].first <= l) ans += bit.query(l - v[i].first);
  }
  return ans;
}
int size[maxn];
bool vis[maxn];
inline void getroot(int x, int fat, int &rt, int &mnv, int allsize) {
  size[x] = 1;
  int v = 0;
  for (int i = head[x]; i; i = nxt[i]) {
    int y = ver[i];
    if (vis[y] || y == fat) continue;
    getroot(y, x, rt, mnv, allsize);
    size[x] += size[y];
    v = max(v, size[y]);
  }
  v = max(v, allsize - size[x]);
  if (v < mnv) rt = x, mnv = min(mnv, v);
}
inline int dfs(int x, int fat, int nowe, long long nowd) {
  int ans = 1;
  v.push_back(make_pair(nowe, nowd));
  for (int i = head[x]; i; i = nxt[i]) {
    int y = ver[i];
    if (y == fat || vis[y]) continue;
    ans += dfs(y, x, nowe + 1, nowd + val[i]);
  }
  return ans;
}
long long ans = 0;
inline void solve(int x) {
  v.clear();
  dfs(x, 0, 0, 0);
  ans += getans();
  vis[x] = 1;
  for (int i = head[x]; i; i = nxt[i]) {
    int y = ver[i];
    if (vis[y]) continue;
    int rt = y, mnv = 2e9;
    v.clear();
    int allsize = dfs(y, x, 1, val[i]);
    ans -= getans();
    getroot(y, x, rt, mnv, allsize);
    solve(rt);
  }
}
int main() {
  scanf("%d%d%d", &n, &l, &w);
  for (int i = 2, a, b; i <= n; i++) scanf("%d%d", &a, &b), addedge(i, a, b);
  solve(1);
  printf("%lld\n", ans);
  return 0;
}
