#include <bits/stdc++.h>
const int N = 1e5 + 7;
using namespace std;
int n, l, w, t[N], dp[N], d[N], a[N], level[N];
vector<pair<int, int> > g[N];
long long ans;
void dfs(int v, int pr = -1) {
  dp[v] = 1;
  for (auto to : g[v])
    if (to.first != pr) {
      dfs(to.first, v);
      dp[v] += dp[to.first];
    }
}
int find_center(int v) {
  for (auto to : g[v])
    if (level[to.first] == -1 && dp[to.first] * 2 > dp[v]) {
      dp[v] -= dp[to.first];
      dp[to.first] += dp[v];
      return find_center(to.first);
    }
  return v;
}
void dfs2(int v, int pr, vector<int> &p) {
  p.push_back(v);
  for (auto to : g[v])
    if (level[to.first] == -1 && to.first != pr) {
      d[to.first] = d[v] + 1;
      a[to.first] = a[v] + to.second;
      dfs2(to.first, v, p);
    }
}
void upd(int pos, int val) {
  for (; pos <= n; pos |= (pos + 1)) t[pos] += val;
}
int get(int pos) {
  int result = 0;
  for (; pos >= 0; pos = (pos & (pos + 1)) - 1) result += t[pos];
  return result;
}
bool cmp(pair<int, pair<int, int> > x, pair<int, pair<int, int> > y) {
  if (x.second.second != y.second.second)
    return x.second.second < y.second.second;
  return x.first < y.first;
}
long long cntAns(vector<int> p) {
  vector<pair<int, pair<int, int> > > v;
  for (int i : p) {
    v.push_back(make_pair(1, make_pair(d[i], a[i])));
    v.push_back(make_pair(2, make_pair(l - d[i], w - a[i])));
  }
  sort(v.begin(), v.end(), &cmp);
  long long result = 0;
  for (int i = 0; i < v.size(); ++i)
    if (v[i].first == 1) {
      upd(v[i].second.first, 1);
    } else {
      result += get(v[i].second.first);
    }
  for (int i = 0; i < (int)v.size(); ++i)
    if (v[i].first == 1) upd(v[i].second.first, -1);
  return result;
}
void build(int v, int depth) {
  v = find_center(v);
  level[v] = depth;
  vector<int> p;
  d[v] = 0;
  a[v] = 0;
  p.push_back(v);
  for (auto to : g[v])
    if (level[to.first] == -1) {
      d[to.first] = d[v] + 1;
      a[to.first] = a[v] + to.second;
      dfs2(to.first, v, p);
    }
  ans += cntAns(p);
  for (auto to : g[v])
    if (level[to.first] == -1) {
      p.clear();
      dfs2(to.first, v, p);
      ans -= cntAns(p);
    }
  ans--;
  for (auto to : g[v])
    if (level[to.first] == -1) build(to.first, depth + 1);
}
int main() {
  ios_base ::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> l >> w;
  for (int i = 1; i < n; ++i) {
    int pi, wi;
    cin >> pi >> wi;
    g[i + 1].push_back(make_pair(pi, wi));
    g[pi].push_back(make_pair(i + 1, wi));
  }
  for (int i = 1; i <= n; ++i) level[i] = -1;
  dfs(1);
  build(1, 0);
  cout << ans / 2 << endl;
  exit(0);
}
