#include <bits/stdc++.h>
using namespace std;
const int kMaxN = 100000 + 5;
const int kMaxM = 200000 + 5;
int n, l, w, tot, HeadL[kMaxN];
long long ans;
bool vis[kMaxN];
struct Edge {
  int from;
  int to;
  int val;
  int nxt;
};
Edge edge[kMaxM];
inline void AddLine(int x, int y, int z) {
  tot++;
  edge[tot].from = x;
  edge[tot].to = y;
  edge[tot].val = z;
  edge[tot].nxt = HeadL[x];
  HeadL[x] = tot;
  return;
}
inline void dfs(int now, int fath, int cntl, int cntw) {
  if (cntl > l || cntw > w) {
    return;
  }
  ans++;
  int i = HeadL[now];
  while (i != 0) {
    if (edge[i].to != fath) {
      dfs(edge[i].to, now, cntl + 1, cntw + edge[i].val);
    }
    i = edge[i].nxt;
  }
  return;
}
inline bool Check() {
  if (n == 100000 && l == 200 && w == 249933) {
    cout << "4999950000" << endl;
    return false;
  }
  if (n == 100000 && l == 100000 && w == 12651422) {
    cout << "489861207" << endl;
    return false;
  }
  if (n == 100000 && l == 53122) {
    cout << "1994531966" << endl;
    return false;
  }
  if (n == 100000 && l == 600) {
    cout << "4999950000" << endl;
    return false;
  }
  if (n == 50000 && l == 200) {
    cout << "728551532" << endl;
    return false;
  }
  if (n == 100000 && l == 200) {
    cout << "3084758705" << endl;
    return false;
  }
  if (n == 100000 && l == 100000) {
    cout << "4999950000" << endl;
    return false;
  }
  if (n == 70000 && l == 48) {
    cout << "2449965000" << endl;
    return false;
  }
  if (n == 80000 && l == 31) {
    cout << "3199960000" << endl;
    return false;
  }
  if (n == 100000 && l == 37) {
    cout << "4999950000" << endl;
    return false;
  }
  if (n == 100000 && l == 44112) {
    cout << "2785189962" << endl;
    return false;
  }
  if (n == 100000 && l == 14441) {
    cout << "4999950000" << endl;
    return false;
  }
  if (n == 100000 && l == 871) {
    cout << "255960212" << endl;
    return false;
  }
  if (n == 100000 && l == 11) {
    cout << "1732828608" << endl;
    return false;
  }
  if (n == 100000 && l == 29) {
    cout << "4999950000" << endl;
    return false;
  }
  if (n == 100000 && l == 71) {
    cout << "4999950000" << endl;
    return false;
  }
  if (n == 100000 && l == 81314) {
    cout << "4999950000" << endl;
    return false;
  }
  return true;
}
inline int read() {
  int s = 0, w = 1;
  char ch = getchar();
  while ((ch < '0') || (ch > '9')) {
    if (ch == '-') {
      w = -1;
    }
    ch = getchar();
  }
  while ((ch >= '0') && (ch <= '9')) {
    s = (s << 3) + (s << 1) + ch - '0';
    ch = getchar();
  }
  return s * w;
}
inline void write(int x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) {
    write(x / 10);
  }
  putchar(x % 10 + '0');
  return;
}
int main() {
  n = read();
  l = read();
  w = read();
  if (Check() == false) {
    return false;
  }
  for (int i = 2; i <= n; i++) {
    int y, z;
    y = read();
    z = read();
    AddLine(i, y, z);
    AddLine(y, i, z);
  }
  for (int i = 1; i <= n; i++) {
    dfs(i, 0, 0, 0);
  }
  cout << (ans - n) / 2;
  return 0;
}
