#include <bits/stdc++.h>
const int inf = 0x3f3f3f3f;
const int N = 100005;
using namespace std;
vector<pair<int, int> > g[N];
int sz[N], f[N], sum;
bool vis[N];
int root, L, W;
void getroot(int x, int fa) {
  sz[x] = 1;
  f[x] = 0;
  for (int i = 0; i < g[x].size(); ++i) {
    int u = g[x][i].first;
    if (u != fa && !vis[u]) {
      getroot(u, x);
      if (sz[u] > f[x]) f[x] = sz[u];
      sz[x] += sz[u];
    }
  }
  if (sum - sz[x] > f[x]) f[x] = sum - sz[x];
  if (root == -1 || f[x] < f[root]) root = x;
}
vector<pair<int, int> > v;
vector<int> ww;
long long ans = 0;
void gt(int x, int fa, int d, int w) {
  v.push_back(make_pair(d, w));
  ww.push_back(w);
  for (int i = 0; i < g[x].size(); ++i) {
    int u = g[x][i].first;
    if (u != fa && !vis[u]) gt(u, x, d + 1, w + g[x][i].second);
  }
}
int s[N], nn;
void add(int x, int d) {
  for (; x <= nn; x += x & (-x)) s[x] += d;
}
int gtsum(int x) {
  int res = 0;
  for (; x > 0; x -= x & (-x)) res += s[x];
  return res;
}
int low(int x) { return lower_bound(ww.begin(), ww.end(), x) - ww.begin(); }
long long calc(int x, int d, int w) {
  v.clear();
  ww.clear();
  gt(x, -1, d, w);
  sort(v.begin(), v.end());
  sort(ww.begin(), ww.end());
  ww.erase(unique(ww.begin(), ww.end()), ww.end());
  nn = ww.size();
  int j = v.size() - 1;
  long long res = 0;
  for (int i = 0; i < v.size(); ++i) add(low(v[i].second) + 1, 1);
  for (int i = 0; i < v.size() && i <= j; ++i) {
    add(low(v[i].second) + 1, -1);
    while (i < j && v[j].first + v[i].first > L)
      add(low(v[j--].second) + 1, -1);
    if (i >= j) break;
    int t = W - v[i].second;
    res += (long long)gtsum(low(t + 1));
  }
  return res;
}
void dfs(int x) {
  ans += calc(x, 0, 0);
  vis[x] = true;
  for (int i = 0; i < g[x].size(); ++i) {
    int u = g[x][i].first;
    if (!vis[u]) {
      ans -= calc(u, 1, g[x][i].second);
      root = -1;
      sum = sz[u];
      getroot(u, -1);
      dfs(root);
    }
  }
}
int main() {
  int n, i, u, w;
  scanf("%d%d%d", &n, &L, &W);
  for (i = 0; i < n - 1; ++i) {
    scanf("%d%d", &u, &w);
    --u;
    g[i + 1].push_back(make_pair(u, w));
    g[u].push_back(make_pair(i + 1, w));
  }
  root = -1;
  sum = n;
  getroot(0, -1);
  dfs(root);
  printf("%I64d", ans);
  return 0;
}
