#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
vector<int> G[N];
int lowbit(int x) { return x & (-x); }
int L, n, o, k;
long long C[N], ans;
long long sum(int x) {
  long long ret = 0;
  while (x > 0) {
    ret += C[x];
    x -= lowbit(x);
  }
  return ret;
}
void add(int x, int d) {
  if (x == 0) {
    C[0] += d;
    return;
  }
  while (x <= o) {
    C[x] += d;
    x += lowbit(x);
  }
}
struct edge {
  int u, v, w;
  edge(int u = 0, int v = 0, int w = 0) : u(u), v(v), w(w) {}
} e[N << 1];
struct node {
  int d, c;
  bool operator<(const node x) const { return d == x.d ? c < x.c : d < x.d; }
} a[N];
int dic[N], dis[N], son[N], mxs[N], root, cntd;
bool vis[N];
void dfs1(int x, int p = 0) {
  son[x] = 1;
  mxs[x] = 0;
  for (int j = 0; j < G[x].size(); j++) {
    int i = G[x][j];
    if (e[i].v != p && vis[e[i].v] == 0) {
      dfs1(e[i].v, x);
      son[x] += son[e[i].v];
      mxs[x] = max(mxs[x], son[e[i].v]);
    }
  }
  mxs[x] = max(mxs[x], n - son[x]);
  if (mxs[root] > mxs[x]) root = x;
}
void dfs2(int x, int p = 0) {
  son[x] = 1;
  a[cntd].d = dis[x];
  a[cntd++].c = dic[x];
  for (int j = 0; j < G[x].size(); j++) {
    int i = G[x][j];
    if (e[i].v != p && vis[e[i].v] == 0) {
      dis[e[i].v] = dis[x] + e[i].w;
      dic[e[i].v] = dic[x] + 1;
      dfs2(e[i].v, x);
      son[x] += son[e[i].v];
    }
  }
}
long long cal(int x, int w = 0, int wc = 0) {
  long long ret = 0;
  cntd = 0;
  dis[x] = w;
  dic[x] = wc;
  dfs2(x);
  sort(a, a + cntd);
  int l = 0, r = cntd - 1;
  for (int i = 1; i < cntd; i++) add(a[i].c, 1);
  while (l < r) {
    while (a[l].d + a[r].d > k && l < r) {
      add(a[r].c, -1);
      --r;
    }
    if (r <= l) break;
    if (L - a[l].c >= 0) ret += sum(L - a[l].c);
    ++l;
    add(a[l].c, -1);
  }
  return ret;
}
void solve(int x) {
  ans += cal(x);
  vis[x] = 1;
  for (int j = 0; j < G[x].size(); j++) {
    int i = G[x][j];
    if (!vis[e[i].v]) {
      ans -= cal(e[i].v, e[i].w, 1);
      mxs[0] = n = son[e[i].v];
      dfs1(e[i].v, root = 0);
      solve(root);
    }
  }
}
void init() {
  ans = 0;
  for (int i = 1; i <= n; i++) G[i].clear();
  memset(vis, 0, sizeof(vis));
}
int main() {
  while (scanf("%d%d%d", &n, &L, &k) != EOF) {
    o = n;
    init();
    int cnt = 0;
    for (int i = 1; i < n; i++) {
      int u = i + 1, v, w;
      scanf("%d%d", &v, &w);
      e[cnt] = edge(u, v, w);
      G[u].push_back(cnt++);
      e[cnt] = edge(v, u, w);
      G[v].push_back(cnt++);
    }
    mxs[0] = n + 1;
    root = 0;
    dfs1(1);
    solve(root);
    cout << ans << endl;
  }
  return 0;
}
