#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 * 1000 + 10;
long long ans, dis[maxn];
vector<pair<long long, int> > V[maxn], tmp;
int pos = 1, s, f, h[maxn], mx[maxn][2], z[maxn], X, mark[maxn], fen[maxn], W,
    L, ret, n, u, w;
vector<pair<int, int> > vec[maxn];
inline void add(int x, int v) {
  for (x++; x < maxn; x += x & -x) fen[x] += v;
}
inline int get(int x) {
  if (x <= 0) return 0;
  ret = 0;
  for (; x; x -= x & -x) ret += fen[x];
  return ret;
}
void calc(int x, int p) {
  mx[x][0] = mx[x][1] = -1;
  z[x] = 1;
  for (int i = 0; i < ((int(vec[x].size()))); i++) {
    if (mark[vec[x][i].first] == 0 && p != vec[x][i].first) {
      calc(vec[x][i].first, x);
      z[x] += z[vec[x][i].first];
      if (z[vec[x][i].first] > mx[x][0]) {
        mx[x][0] = z[vec[x][i].first];
        mx[x][1] = vec[x][i].first;
      }
    }
  }
}
int fcent(int x) {
  if (mx[x][0] <= X / 2) return x;
  return fcent(mx[x][1]);
}
void gdis(int x, int p, int limit) {
  tmp.push_back(make_pair(dis[x], h[x]));
  for (int i = 0; i < ((int(vec[x].size()))); i++) {
    if ((mark[vec[x][i].first] == 0 || mark[vec[x][i].first] > limit) &&
        p != vec[x][i].first) {
      h[vec[x][i].first] = h[x] + 1;
      dis[vec[x][i].first] = dis[x] + vec[x][i].second;
      gdis(vec[x][i].first, x, limit);
    }
  }
}
void solve(int x) {
  calc(x, -1);
  X = z[x];
  int C = fcent(x);
  mark[C] = pos++;
  for (int i = 0; i < ((int(vec[C].size()))); i++) {
    if (mark[vec[C][i].first] == 0) {
      solve(vec[C][i].first);
      dis[vec[C][i].first] = vec[C][i].second;
      h[vec[C][i].first] = 1;
      gdis(vec[C][i].first, -1, mark[C]);
      sort(tmp.begin(), tmp.end());
      s = f = 0;
      while (f < ((int(tmp.size())))) {
        while (s < f && tmp[s].first + tmp[f].first <= W)
          add(tmp[s++].second, 1);
        while (s > 0 && tmp[s - 1].first + tmp[f].first > W) {
          add(tmp[s - 1].second, -1);
          s--;
        }
        ans -= get(L - tmp[f].second + 1);
        f++;
      }
      while (s > 0) {
        add(tmp[s - 1].second, -1);
        s--;
      }
      for (int j = 0; j < ((int(tmp.size()))); j++) V[C].push_back(tmp[j]);
      tmp.clear();
    }
  }
  V[C].push_back(make_pair(0, 0));
  sort(V[C].begin(), V[C].end());
  s = f = 0;
  while (f < ((int(V[C].size())))) {
    while (s < f && V[C][s].first + V[C][f].first <= W)
      add(V[C][s++].second, 1);
    while (s > 0 && V[C][s - 1].first + V[C][f].first > W) {
      add(V[C][s - 1].second, -1);
      s--;
    }
    ans += get(L - V[C][f].second + 1);
    f++;
  }
  while (s > 0) {
    add(V[C][s - 1].second, -1);
    s--;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> L >> W;
  for (int i = 1; i < n; i++) {
    cin >> u >> w;
    u--;
    vec[u].push_back(make_pair(i, w));
    vec[i].push_back(make_pair(u, w));
  }
  solve(0);
  cout << ans;
  return 0;
}
