#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 10, INF = 1e9 + 7;
int n, l, w, sz[N], fen[N];
long long ans;
vector<pair<int, int> > adj[N], dis[N], tmp;
bool vis[N];
void dfscen(int v, int par);
int centroid(int v);
void dfs(int v, int par, int wei, int len, int i);
void add(int x);
void remove(int x);
int sum(int x);
void solve(int v);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> l >> w;
  for (int v = 2; v <= n; v++) {
    int u, wei;
    cin >> u >> wei;
    adj[v].push_back({u, wei}), adj[u].push_back({v, wei});
  }
  solve(1);
  cout << ans << '\n';
  return 0;
}
void dfscen(int v, int par) {
  sz[v] = 1;
  for (auto p : adj[v])
    if (p.first != par && !vis[p.first])
      dfscen(p.first, v), sz[v] += sz[p.first];
}
int centroid(int v) {
  dfscen(v, 0);
  int C = sz[v] / 2, par = 0;
  while (1) {
    bool found = true;
    for (auto p : adj[v])
      if (!vis[p.first] && p.first != par && sz[p.first] > C) {
        found = false, par = v, v = p.first;
        break;
      }
    if (found) return v;
  }
}
void dfs(int v, int par, int wei, int len, int i) {
  dis[i].push_back({wei, len});
  for (auto p : adj[v])
    if (!vis[p.first] && p.first != par)
      dfs(p.first, v, wei + p.second, len + 1, i);
}
void add(int x) {
  for (int i = x; i < N - 5; i += (i & -i)) fen[i]++;
}
void remove(int x) {
  for (int i = x; i < N - 5; i += (i & -i)) fen[i]--;
}
int sum(int x) {
  int ret = 0;
  for (int i = x; i > 0; i -= (i & -i)) ret += fen[i];
  return ret;
}
void solve(int v) {
  v = centroid(v);
  vis[v] = true;
  int i = 0, k;
  long long a = 0;
  tmp.clear();
  for (auto p : adj[v])
    if (!vis[p.first]) {
      dis[i].clear();
      dfs(p.first, v, p.second, 1, i);
      sort(dis[i].begin(), dis[i].end());
      k = dis[i].size() - 1;
      for (auto j : dis[i]) add(j.second);
      for (auto j : dis[i]) {
        tmp.push_back(j);
        if (j.first <= w && j.second <= l) a += 2;
        while (k >= 0 && j.first + dis[i][k].first > w)
          remove(dis[i][k].second), k--;
        a -= sum(max(0, l - j.second));
      }
      while (k >= 0) remove(dis[i][k].second), k--;
      i++;
    }
  k = tmp.size() - 1;
  sort(tmp.begin(), tmp.end());
  for (auto j : tmp) add(j.second);
  for (auto j : tmp) {
    while (k >= 0 && j.first + tmp[k].first > w) remove(tmp[k].second), k--;
    a += sum(max(0, l - j.second));
  }
  while (k >= 0) remove(tmp[k].second), k--;
  ans += a / 2;
  for (auto p : adj[v])
    if (!vis[p.first]) solve(p.first);
}
