#include <bits/stdc++.h>
using namespace std;
const int mod = 1000 * 1000 * 1000 + 7;
const int INF = 1000 * 1000 * 1000;
const long long LINF = (long long)INF * INF;
int n, len, W;
vector<pair<int, int> > adj[100100];
int subtree[100100];
int h[100100];
int wh[100100];
bool mark[100100];
vector<pair<int, int> > comp[100100];
int fen[100100];
void fenadd(int i, int x) {
  for (i++; i < 100100; i += i & -i) fen[i] += x;
}
int fensum(int i) {
  int res = 0;
  for (i++; i > 0; i -= i & -i) res += fen[i];
  return res;
}
void dfs(int v, int par, vector<pair<int, int> > &data, bool flag) {
  if (flag) data.push_back(make_pair(wh[v], h[v]));
  subtree[v] = 1;
  for (pair<int, int> p : adj[v]) {
    int u = p.first;
    if (mark[u] || u == par) continue;
    h[u] = h[v] + 1;
    wh[u] = wh[v] + p.second;
    dfs(u, v, data, flag);
    subtree[v] += subtree[u];
  }
}
int findcen(int v, int par, int S) {
  for (pair<int, int> p : adj[v]) {
    int u = p.first;
    if (mark[u] || u == par) continue;
    if (subtree[u] > S / 2) return findcen(u, v, S);
  }
  return v;
}
long long getpairs(const vector<pair<int, int> > &comp) {
  long long res = 0;
  for (pair<int, int> p : comp) {
    fenadd(p.second, 1);
  }
  int l = comp.size() - 1;
  for (int r = (0); r < ((int)comp.size()); r++) {
    while (l >= 0 && comp[l].first > W - comp[r].first) {
      fenadd(comp[l].second, -1);
      l--;
    }
    if (len >= comp[r].second) res += fensum(len - comp[r].second);
  }
  while (l >= 0) {
    fenadd(comp[l].second, -1);
    l--;
  }
  return res;
}
long long solve(int r) {
  dfs(r, -1, comp[r], false);
  int cen = findcen(r, -1, subtree[r]);
  long long res = 0;
  h[cen] = 0;
  wh[cen] = 0;
  mark[cen] = true;
  vector<pair<int, int> > allcomps;
  long long cnt = 0;
  for (pair<int, int> p : adj[cen]) {
    int u = p.first;
    if (mark[u]) continue;
    comp[u].clear();
    wh[u] = p.second;
    h[u] = 1;
    dfs(u, -1, comp[u], true);
    sort((comp[u]).begin(), (comp[u]).end());
    res -= getpairs(comp[u]);
    for (pair<int, int> p : comp[u]) {
      if (p.first <= W && p.second <= len) cnt++;
      allcomps.push_back(p);
    }
  }
  sort((allcomps).begin(), (allcomps).end());
  res += getpairs(allcomps);
  res /= 2;
  res += cnt;
  for (pair<int, int> p : adj[cen]) {
    int u = p.first;
    if (mark[u]) continue;
    res += solve(u);
  }
  return res;
}
int32_t main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> len >> W;
  for (int i = (2); i < (n + 1); i++) {
    int p, w;
    cin >> p >> w;
    adj[i].push_back(make_pair(p, w));
    adj[p].push_back(make_pair(i, w));
  }
  cout << solve(1) << '\n';
  return 0;
}
