#include <bits/stdc++.h>
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long maxn = 1e5 + 123;
const long long inf = 1e9 + 123;
const long long linf = 1e18 + 123;
const long long mod = 1e9 + 7;
const double eps = 1e-9;
const double pi = acos(-1);
int dx[8] = {0, 1, -1, 0, 1, -1, 1, -1};
int dy[8] = {1, 0, 0, -1, 1, 1, -1, -1};
long long n, l, w, level[maxn], parent[maxn], d[maxn], ans, L[maxn], W[maxn],
    t[maxn];
vector<pair<int, int> > g[maxn];
void update(int pos, int val) {
  for (; pos <= n; pos |= (pos + 1)) {
    t[pos] += val;
  }
}
long long get(int pos) {
  int res = 0;
  for (; pos >= 0; pos = (pos & (pos + 1)) - 1) {
    res += t[pos];
  }
  return res;
}
void dfs(int v, int p) {
  d[v] = 1;
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i].first;
    if (to == p) {
      continue;
    }
    dfs(to, v);
    d[v] += d[to];
  }
}
int find_center(int v) {
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i].first;
    if (level[to] == -1 && d[to] > d[v] / 2) {
      d[v] -= d[to];
      d[to] += d[v];
      return find_center(to);
    }
  }
  return v;
}
void dfs2(int v, int pr, vector<int> &p) {
  p.push_back(v);
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i].first;
    if (level[to] != -1 || to == pr) {
      continue;
    }
    L[to] = L[v] + 1;
    W[to] = W[v] + g[v][i].second;
    dfs2(to, v, p);
  }
}
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 ANS(vector<int> p) {
  vector<pair<int, pair<int, int> > > v;
  for (int i = 0; i < p.size(); i++) {
    v.push_back({1, {L[p[i]], W[p[i]]}});
    v.push_back({2, {l - L[p[i]], w - W[p[i]]}});
  }
  long long res = 0;
  sort(v.begin(), v.end(), &cmp);
  for (int i = 0; i < v.size(); i++) {
    if (v[i].first == 1) {
      update(v[i].second.first, 1);
    } else {
      res += get(v[i].second.first);
    }
  }
  for (int i = 0; i < v.size(); i++) {
    if (v[i].first == 1) {
      update(v[i].second.first, -1);
    }
  }
  return res;
}
void build(int v, int depth, int p) {
  v = find_center(v);
  parent[v] = p;
  level[v] = depth;
  L[v] = 0;
  W[v] = 0;
  vector<int> P;
  P.push_back(v);
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i].first;
    if (level[to] != -1) {
      continue;
    }
    L[to] = L[v] + 1;
    W[to] = W[v] + g[v][i].second;
    dfs2(to, v, P);
  }
  ans += ANS(P);
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i].first;
    if (level[to] != -1) {
      continue;
    }
    P.clear();
    dfs2(to, v, P);
    ans -= ANS(P);
  }
  ans--;
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i].first;
    if (level[to] != -1) {
      continue;
    }
    build(to, depth + 1, v);
  }
}
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 x, y;
    cin >> x >> y;
    g[i + 1].push_back({x, y});
    g[x].push_back({i + 1, y});
    level[i] = -1;
  }
  level[n] = -1;
  dfs(1, -1);
  build(1, 0, -1);
  cout << ans / 2;
  exit(0);
}
