#include <bits/stdc++.h>
using namespace std;
const int mx = 1e5 + 10;
int l, mark[mx], fen[mx], sub[mx];
long long ans, r;
vector<pair<int, long long> > adj[mx];
vector<pair<long long, int> > now;
int get(int id) {
  int ret = 0;
  if (id < 0) return 0;
  for (id++; id; id -= id & -id) ret += fen[id];
  return ret;
}
void add(int p, int val) {
  for (p++; p < mx; p += p & -p) fen[p] += val;
}
void dfs_size(int v, int par) {
  sub[v] = 1;
  for (auto no : adj[v]) {
    int u = no.first;
    if (!mark[u] && u != par) dfs_size(u, v), sub[v] += sub[u];
  }
}
void dfs_set(int v, int par, long long w, int l) {
  now.push_back(make_pair(w, l));
  for (auto no : adj[v]) {
    int u = no.first;
    long long ww = no.second;
    if (!mark[u] && u != par) dfs_set(u, v, w + ww, l + 1);
  }
}
void solve(int v, long long ty, long long k) {
  now.clear();
  dfs_set(v, 0, 0, 0);
  sort(now.begin(), now.end());
  int r = 0, id = now.size() - 1;
  long long sum = 0, nu = 0;
  while (id >= 0) {
    sum = k - now[id].first;
    while (r < now.size() && r < id && now[r].first <= sum)
      add(now[r].second, 1), r++;
    while (r > id) r--, add(now[r].second, -1);
    nu += get(l - now[id].second);
    id--;
  }
  for (int i = 0; i < r; i++) add(now[i].second, -1);
  ans += ty * (nu);
}
void cende(int v) {
  dfs_size(v, 0);
  int med = v, par = 0;
  while (1) {
    int fou = 1;
    for (auto no : adj[med]) {
      int u = no.first;
      if (!mark[u] && u != par && sub[u] > sub[v] / 2) {
        par = med, med = u, fou = 0;
        break;
      }
    }
    if (fou) break;
  }
  solve(med, 1, r);
  mark[med] = 1;
  l -= 2;
  if (l >= 0)
    for (auto u : adj[med])
      if (!mark[u.first] && r - 2 * u.second >= 0)
        solve(u.first, -1, r - 2 * u.second);
  l += 2;
  for (auto u : adj[med])
    if (!mark[u.first]) cende(u.first);
}
int main() {
  int n, p;
  long long w;
  scanf("%d%d%64Id", &n, &l, &r);
  for (int i = 2; i <= n; i++) {
    scanf("%d%I64d", &p, &w);
    adj[p].push_back(make_pair(i, w));
    adj[i].push_back(make_pair(p, w));
  }
  cende(1);
  printf("%I64d", ans);
  return 0;
}
