#include <bits/stdc++.h>
using namespace std;
constexpr int N = 1e5 + 10;
long long n, u, v, sz[N], s, ans, fen[N], be, en, l, w;
vector<pair<int, int>> node[N], vec;
bool mark[N];
void add(int x, int val) {
  for (; x <= n; x += x & (-x)) fen[x] += val;
}
int sum(int x) {
  if (x < 0) return 0;
  int ret = 0;
  for (; x; x -= x & (-x)) ret += fen[x];
  return ret;
}
void dfs(int v, int p) {
  sz[v] = 1;
  for (auto i : node[v]) {
    if (i.first != p && !mark[i.first]) {
      dfs(i.first, v);
      sz[v] += sz[i.first];
    }
  }
}
int centroid(int v, int p) {
  for (auto i : node[v]) {
    if (i.first != p && !mark[i.first] && sz[i.first] > s / 2)
      return centroid(i.first, v);
  }
  return v;
}
void addtovec(int v, int p, int nowh, int noww, int keep) {
  vec.push_back({noww, nowh});
  add(nowh, 1);
  if (keep && nowh <= l && noww <= w) ans++;
  for (auto i : node[v])
    if (i.first != p && !mark[i.first])
      addtovec(i.first, v, nowh + 1, noww + i.second, keep);
}
long long compute() {
  long long su = sum(l);
  sort(vec.begin(), vec.end());
  be = 0;
  en = (int)vec.size() - 1;
  while (be <= en) {
    int vazn = vec[be].first;
    int tool = vec[be].second;
    add(tool, -1);
    while (vec[en].first + vazn > w && en >= be) {
      add(vec[en].second, -1);
      en--;
    }
    if (en < be) add(tool, 1);
    su += sum(l - tool);
    be++;
  }
  vec.clear();
  return su;
}
void solve(int v) {
  dfs(v, v);
  s = sz[v];
  int x = centroid(v, v);
  mark[x] = true;
  for (auto i : node[x])
    if (!mark[i.first]) addtovec(i.first, x, 1, i.second, 1);
  ans += compute();
  for (auto i : node[x]) {
    if (!mark[i.first]) {
      addtovec(i.first, x, 1, i.second, 0);
      ans -= compute();
    }
  }
  for (auto i : node[x])
    if (!mark[i.first]) solve(i.first);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> l >> w;
  for (int i = 1; i < n; i++) {
    cin >> u >> v;
    node[u].push_back({i + 1, v});
    node[i + 1].push_back({u, v});
  }
  solve(1);
  cout << ans << '\n';
  return 0;
}
