#include <bits/stdc++.h>
using namespace std;
template <class T1>
void deb(T1 e1) {
  cout << e1 << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << endl;
}
int on(int n, int pos) { return n = n | (1 << pos); }
int dx[] = {0, 0, 1, -1};
int dy[] = {-1, 1, 0, 0};
struct node {
  long long int cst, lev;
  node() {}
  node(long long int _cst, long long int _lev) {
    cst = _cst;
    lev = _lev;
  }
  bool operator<(const node &P) const {
    if (cst == P.cst) return lev < P.lev;
    return cst < P.cst;
  }
};
int tree[200000], sz[200000], darr[200000], N, L, C;
vector<int> vc[200000], cost[200000];
long long int tot;
vector<node> ac;
int query(int idx) {
  int sum = 0;
  while (idx > 0) {
    sum += tree[idx];
    idx -= idx & (-idx);
  }
  return sum;
}
void update(int idx, int x, int n) {
  while (idx <= n) {
    tree[idx] += x;
    idx += idx & (-idx);
  }
}
void dfs(int v, int par) {
  sz[v] = 1;
  for (int i = 0; i < vc[v].size(); i++) {
    int w = vc[v][i];
    if (w == par || darr[w]) continue;
    dfs(w, v);
    sz[v] += sz[w];
  }
}
int getdc(int v, int par, int n) {
  for (int i = 0; i < vc[v].size(); i++) {
    int w = vc[v][i];
    if (w == par || darr[w]) continue;
    if (sz[w] > (n / 2)) return getdc(w, v, n);
  }
  return v;
}
void makepath(int v, int par, long long int dist, long long int lev) {
  if (dist > C or lev > L) return;
  ac.push_back(node(dist, lev));
  for (int i = 0; i < vc[v].size(); i++) {
    int w = vc[v][i];
    if (w == par || darr[w]) continue;
    makepath(w, v, dist + cost[v][i], lev + 1);
  }
}
long long int fun() {
  sort(ac.begin(), ac.end());
  int j = 0, i = ac.size() - 1;
  long long int ans = 0;
  for (; i >= 0; i--) {
    for (; j < i && ac[i].cst + ac[j].cst <= C; j++) {
      update(ac[j].lev + 1, 1, N);
    }
    if (j > i) {
      update(ac[j - 1].lev + 1, -1, N);
      j--;
    }
    ans += query(L - ac[i].lev + 1);
  }
  return ans;
}
void decompo(int v, int n) {
  ac.clear();
  dfs(v, v);
  n = sz[v];
  int dc = getdc(v, v, n);
  darr[dc] = 1;
  makepath(dc, dc, 0, 0);
  long long int ret = fun();
  for (int i = 0; i < vc[dc].size(); i++) {
    int w = vc[dc][i];
    if (darr[w]) continue;
    ac.clear();
    makepath(w, dc, cost[dc][i], 1);
    ret -= fun();
  }
  tot += ret;
  for (int i = 0; i < vc[dc].size(); i++) {
    int w = vc[dc][i];
    if (darr[w]) continue;
    decompo(w, n);
  }
}
int main() {
  int i, j, k, l, m, n;
  scanf("%d%d%d", &N, &L, &C);
  for (i = 2; i <= N; i++) {
    scanf("%d%d", &l, &j);
    vc[l].push_back(i);
    vc[i].push_back(l);
    cost[l].push_back(j);
    cost[i].push_back(j);
  }
  decompo(1, N);
  cout << tot << endl;
}
