#include <bits/stdc++.h>
using namespace std;
int W, L;
const int Maxn = 1e5 + 9;
vector<pair<int, int> > get_sort;
int fen[Maxn], mark[Maxn], sub[Maxn];
vector<pair<int, int> > al[Maxn];
int query(int v) {
  v++;
  if (v < 1) return 0;
  int ret = 0;
  for (v; v; v -= v & -v) ret += fen[v];
  return ret;
}
void update(int v, int x) {
  v++;
  for (v; v < Maxn; v += v & -v) fen[v] += x;
  return;
}
int dfs1(int v, int p = -1) {
  if (mark[v]) return 0;
  sub[v] = 1;
  for (int i = 0; i < al[v].size(); i++) {
    int u = al[v][i].first;
    if (u ^ p) sub[v] += dfs1(u, v);
  }
  return sub[v];
}
int find_cen(int v, int p, int n) {
  if (mark[v]) cout << "what the hell";
  for (int i = 0; i < al[v].size(); i++) {
    int u = al[v][i].first;
    if (u != p && !mark[u] && sub[u] > n / 2) return find_cen(u, v, n);
  }
  return v;
}
void dfs2(int v, int p, int depl = 0, int depw = 0) {
  if (mark[v]) return;
  get_sort.push_back(make_pair(depw, depl));
  for (int i = 0; i < al[v].size(); i++) {
    int u = al[v][i].first;
    if (u ^ p) dfs2(u, v, depl + 1, depw + al[v][i].second);
  }
  return;
}
long long get_cnt(int u, int v, int w, int l) {
  if (w < 0 || l < 0) return 0;
  long long ret = 0;
  get_sort.clear();
  dfs2(u, v);
  sort(get_sort.begin(), get_sort.end());
  int ed = get_sort.size() - 1;
  for (int i = 0; i < get_sort.size(); i++) update(get_sort[i].second, 1);
  for (int i = 0; i < get_sort.size(); i++) {
    int curl = get_sort[i].second, curw = get_sort[i].first;
    while (ed + 1 && get_sort[ed].first + curw > w) {
      update(get_sort[ed--].second, -1);
    }
    if (l >= curl) ret += query(l - curl);
    if (curl * 2 <= l && curw * 2 <= w) ret--;
  }
  while (ed + 1) update(get_sort[ed--].second, -1);
  return (ret) / 2;
}
long long rec(int v) {
  if (mark[v]) return 0;
  dfs1(v);
  v = find_cen(v, -1, sub[v]);
  long long ret = 0;
  ret = get_cnt(v, -1, W, L);
  for (int i = 0; i < al[v].size(); i++) {
    int u = al[v][i].first, w = al[v][i].second;
    ret -= get_cnt(u, v, W - 2 * w, L - 2);
  }
  mark[v] = 1;
  for (int i = 0; i < al[v].size(); i++) {
    int u = al[v][i].first;
    ret += rec(u);
  }
  return ret;
}
int main() {
  int n;
  scanf("%d%d%d", &n, &L, &W);
  for (int i = 0; i < n - 1; i++) {
    int v, w;
    scanf("%d%d", &v, &w);
    al[i + 1].push_back(make_pair(--v, w));
    al[v].push_back(make_pair(i + 1, w));
  }
  printf("%I64d\n", rec(0));
}
