#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const double pi = acos(-1.0);
int dblcmp(double d) {
  if (fabs(d) < eps) return 0;
  return d > eps ? 1 : -1;
}
using namespace std;
struct EDGE {
  int v, next, w;
} edge[305555];
int head[111111], e;
int n, d1, d2, vis[111111], root, num;
long long ans;
void init() {
  memset(vis, 0, sizeof(vis));
  memset(head, -1, sizeof(head));
  e = 0;
  ans = 0;
}
void add(int u, int v, int w) {
  edge[e].v = v;
  edge[e].w = w;
  edge[e].next = head[u];
  head[u] = e++;
}
int mx[111111], size[111111], mi, dis[111111], dd[111111];
void dfssize(int u, int fa) {
  size[u] = 1;
  mx[u] = 0;
  for (int i = head[u]; i != -1; i = edge[i].next) {
    int v = edge[i].v;
    if (v != fa && !vis[v]) {
      dfssize(v, u);
      size[u] += size[v];
      if (size[v] > mx[u]) mx[u] = size[v];
    }
  }
}
void dfsroot(int r, int u, int fa) {
  if (size[r] - size[u] > mx[u]) mx[u] = size[r] - size[u];
  if (mx[u] < mi) mi = mx[u], root = u;
  for (int i = head[u]; i != -1; i = edge[i].next) {
    int v = edge[i].v;
    if (v != fa && !vis[v]) dfsroot(r, v, u);
  }
}
void dfsdis(int u, int dz, int d, int fa) {
  dis[num] = d;
  dd[num++] = dz;
  for (int i = head[u]; i != -1; i = edge[i].next) {
    int v = edge[i].v;
    if (v != fa && !vis[v]) dfsdis(v, dz + 1, d + edge[i].w, u);
  }
}
pair<int, int> p[305555];
struct query {
  int l, r, ask;
  int t;
  query() {}
  bool operator<(const query &gg) const {
    if (ask != gg.ask) return ask < gg.ask;
    return t < gg.t;
  }
};
const int maxn = 100010;
struct bit {
  long long a[maxn * 2];
  int n;
  bit() {}
  void init(int _n) {
    n = _n;
    for (int i = 0; i < n + 5; i++) a[i] = 0;
  }
  long long quer(int x) {
    long long s = 0;
    for (int i = x; i; i -= i & (-i)) {
      s += a[i];
    }
    return s;
  }
  void add(int q, long long e) {
    int i;
    for (i = q; i <= n; i += i & (-i)) {
      a[i] += e;
    }
  }
} b;
long long calc(int u, int z, int d) {
  long long ret = 0;
  num = 0;
  dfsdis(u, z, d, 0);
  int i, j, k;
  for (i = 0; i < num; i++) {
    p[i] = make_pair(dd[i], dis[i]);
  }
  sort(p, p + num);
  i = 0, j = num - 1;
  vector<query> q;
  for (i = 0; i < num; i++) {
    query tmp;
    tmp.t = 0;
    tmp.l = tmp.r = i + 1;
    tmp.ask = p[i].second;
    q.push_back(tmp);
  }
  i = 0, j = num - 1;
  while (i < j) {
    while (p[i].first + p[j].first > d1 && i < j) j--;
    query tmp;
    tmp.t = 1;
    tmp.ask = d2 - p[i].second;
    tmp.l = i + 2;
    tmp.r = j + 1;
    q.push_back(tmp);
    i++;
  }
  b.init(num + 5);
  sort(q.begin(), q.end());
  for (i = 0; i < (int)((q).size()); i++) {
    if (q[i].t == 0) {
      b.add(q[i].l, 1);
    } else {
      ret += b.quer(q[i].r) - b.quer(q[i].l - 1);
    }
  }
  return ret;
}
void dfs(int u) {
  mi = n;
  dfssize(u, 0);
  dfsroot(u, u, 0);
  ans += calc(root, 0, 0);
  vis[root] = 1;
  for (int i = head[root]; i != -1; i = edge[i].next) {
    int v = edge[i].v;
    if (!vis[v]) {
      ans -= calc(v, 1, edge[i].w);
      dfs(v);
    }
  }
}
int main() {
  while (scanf("%d%d%d", &n, &d1, &d2) != EOF) {
    init();
    int u, v, w;
    for (int i = 2; i <= n; i++) {
      scanf("%d%d", &u, &w);
      add(u, i, w);
      add(i, u, w);
    }
    dfs(1);
    cout << ans << endl;
  }
  return 0;
}
