#include <bits/stdc++.h>
using namespace std;
struct tree {
  vector<int> g;
  int n;
  void init(int _n) {
    n = _n + 2;
    g.clear();
    g.resize(n + 2);
    for (int i = 0; i < n; ++i) g[i] = 0;
  }
  void add(int x, int v) {
    while (x <= n) g[x] += v, x += x & -x;
  }
  long long sum(int x) {
    long long ret = 0;
    while (x > 0) ret += g[x], x -= x & -x;
    return ret;
  }
} go;
int fst[100010], vv[200020], nxt[200020], cost[200020], e;
void init() { memset(fst, -1, sizeof fst), e = 0; }
void add(int u, int v, int c) {
  vv[e] = v, nxt[e] = fst[u], cost[e] = c, fst[u] = e++;
}
int sz[100010], mx[100010], root, tot;
bool vis[100010];
void dfsS(int u, int p) {
  sz[u] = 1;
  for (int i = fst[u]; ~i; i = nxt[i]) {
    int v = vv[i];
    if (vis[v] || v == p) continue;
    dfsS(v, u);
    sz[u] += sz[v];
  }
}
void dfsR(int u, int p) {
  mx[u] = 0;
  for (int i = fst[u]; ~i; i = nxt[i]) {
    int v = vv[i];
    if (vis[v] || v == p) continue;
    dfsR(v, u);
    mx[u] = max(mx[u], sz[v]);
  }
  mx[u] = max(mx[u], tot - sz[u]);
  if (root == -1 || mx[u] < mx[root]) root = u;
}
int find_root(int u) {
  dfsS(u, -1);
  root = -1, tot = sz[u];
  dfsR(u, -1);
  return root;
}
int cnt;
vector<pair<int, int> > g[100010], all;
void dfs(int u, int p, int w, int num) {
  g[cnt].push_back(make_pair(w, num));
  all.push_back(make_pair(w, num));
  for (int i = fst[u]; ~i; i = nxt[i]) {
    int v = vv[i], c = cost[i];
    if (vis[v] || v == p) continue;
    dfs(v, u, w + c, num + 1);
  }
}
int L, K;
long long ans;
long long gao(vector<pair<int, int> > &g) {
  long long ret = 0;
  int up = 0, n = g.size();
  for (int i = 0; i < n; ++i) up = max(up, g[i].second);
  go.init(up);
  for (int i = 0; i < n; ++i) go.add(g[i].second, 1);
  for (int i = 0, j = n - 1; i < j; ++i) {
    go.add(g[i].second, -1);
    while (j > i && g[i].first + g[j].first > K) {
      go.add(g[j].second, -1);
      j--;
    }
    ret += go.sum(min(up, L - g[i].second));
  }
  return ret;
}
void solve(int u) {
  u = find_root(u);
  vis[u] = 1;
  cnt = 0;
  all.clear();
  for (int i = fst[u]; ~i; i = nxt[i]) {
    int v = vv[i], c = cost[i];
    if (vis[v]) continue;
    g[cnt].clear();
    dfs(v, u, c, 1);
    sort(g[cnt].begin(), g[cnt].end());
    cnt++;
  }
  sort(all.begin(), all.end());
  ans += gao(all);
  for (int i = 0; i < cnt; ++i) {
    for (int j = 0; j < g[i].size(); ++j) {
      if (g[i][j].first <= K && g[i][j].second <= L) ans++;
    }
    ans -= gao(g[i]);
  }
  for (int i = fst[u]; ~i; i = nxt[i]) {
    int v = vv[i];
    if (!vis[v]) solve(v);
  }
}
int main() {
  int n;
  scanf("%d%d%d", &n, &L, &K);
  init();
  for (int i = 1; i < n; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    add(i + 1, u, v);
    add(u, i + 1, v);
  }
  memset(vis, 0, sizeof vis);
  ans = 0;
  solve(1);
  cout << ans << endl;
  return 0;
}
