#include <bits/stdc++.h>
using namespace std;
int n, L, W, tot, head[100005];
struct name {
  int id, v, nx;
} to[100005 << 1];
void add(int x, int y, int v) {
  to[++tot] = (name){y, v, head[x]};
  head[x] = tot;
}
int rt, all, sz[100005], mx[100005];
struct node {
  int l, w;
  bool operator<(const node &_) const {
    if (w == _.w) return l < _.l;
    return w < _.w;
  }
};
vector<node> a[100005], c;
int cnt;
long long ans;
bool mk[100005];
void getrt(int x, int f) {
  sz[x] = 1, mx[x] = 0;
  for (int i = head[x]; i; i = to[i].nx) {
    int y = to[i].id;
    if (y == f || mk[y]) continue;
    getrt(y, x);
    sz[x] += sz[y];
    if (sz[y] > mx[x]) mx[x] = sz[y];
  }
  mx[x] = max(mx[x], all - sz[x]);
  if (mx[x] < mx[rt]) rt = x;
}
void dfs(int x, int f, int len, int val) {
  a[cnt].push_back((node){len, val});
  c.push_back((node){len, val});
  sz[x] = 1;
  for (int i = head[x]; i; i = to[i].nx) {
    int y = to[i].id;
    if (y == f || mk[y]) continue;
    dfs(y, x, len + 1, val + to[i].v);
    sz[x] += sz[y];
  }
}
int s[100005];
void Add(int l, int x, int maxx) {
  for (int i = l; i <= maxx; i += (i & (-i))) s[i] += x;
}
int ask(int x) {
  int ret = 0;
  for (int i = x; i > 0; i -= (i & (-i))) ret += s[i];
  return ret;
}
long long get(vector<node> &a) {
  long long ans = 0;
  int MAX = 0, j = a.size() - 1;
  for (int i = (0), _en = (a.size() - 1); i <= _en; i++) MAX = max(MAX, a[i].l);
  for (int i = (1), _en = (MAX); i <= _en; i++) s[i] = 0;
  for (int i = (0), _en = (a.size() - 1); i <= _en; i++) Add(a[i].l, 1, MAX);
  for (int i = (0), _en = (a.size() - 1); i <= _en; i++) {
    while (i < j && a[i].w + a[j].w > W) Add(a[j].l, -1, MAX), j--;
    if (i >= j) break;
    Add(a[i].l, -1, MAX);
    ans += ask(min(MAX, L - a[i].l));
  }
  return ans;
}
void solve(int x) {
  mk[x] = 1;
  cnt = 0;
  for (int i = head[x]; i; i = to[i].nx) {
    int y = to[i].id, v = to[i].v;
    if (mk[y]) continue;
    dfs(y, x, 1, v);
    sort(a[cnt].begin(), a[cnt].end());
    cnt++;
  }
  sort(c.begin(), c.end());
  ans += get(c);
  for (int i = (0), _en = (cnt - 1); i <= _en; i++) {
    for (int j = (0), _en = (a[i].size() - 1); j <= _en; j++)
      if (a[i][j].w <= W && a[i][j].l <= L) ans++;
    ans -= get(a[i]);
  }
  c.clear();
  for (int i = (0), _en = (cnt - 1); i <= _en; i++) a[i].clear();
  for (int i = head[x]; i; i = to[i].nx) {
    int y = to[i].id;
    if (mk[y]) continue;
    all = sz[y], rt = 0;
    getrt(y, 0);
    solve(rt);
  }
}
int main() {
  scanf("%d%d%d", &n, &L, &W);
  for (int i = (2), _en = (n); i <= _en; i++) {
    int y, v;
    scanf("%d%d", &y, &v);
    add(i, y, v);
    add(y, i, v);
  }
  all = n, mx[rt] = 1e9;
  getrt(1, 0);
  solve(rt);
  printf("%I64d\n", ans);
  return 0;
}
