30 30 10
6 1
8 27
5 1
21 6
24 15
12 5
29 7
22 7
23 17
2 13
23 11
29 6
14 18
29 16
27 25
15 2
27 4
19 30
28 19
17 2
27 16
3 4
9 25
19 16
10 16
18 17
26 11
2 27
16 20
13 23
1 4
27 7
6 20
17 30
1 18
2 17
1 11
5 9
25 13
11 20
14 25
30 21
6 24
12 2
25 12
22 13
10 27
24 29
19 24
28 29
24 23
9 6
12 15
11 15
23 14
12 28
28 25
2 11
19 30
 2 2 1
1 2
2 1
1 2

0 1
#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
int n, m, k, x[150005], y[150005], t[150005], tx[150005], ty[150005],
    grp[150005], cnt;
vector<int> hv[150005];
vector<int> G[150005];
int pre[150005][20], dep[150005];
void dfs(int v, int par) {
  dep[v] = dep[par] + 1;
  for (int i = 0; i < (int)(20); i++)
    pre[v][i] = i == 0 ? par : pre[pre[v][i - 1]][i - 1];
  for (int i = 0; i < (int)(G[v].size()); i++) {
    int u = G[v][i];
    if (u == par) continue;
    dfs(u, v);
  }
}
int lca(int u, int v, int& p, int& q) {
  for (int i = 19; i >= 0; i--)
    if (dep[pre[u][i]] > dep[v]) u = pre[u][i];
  for (int i = 19; i >= 0; i--)
    if (dep[pre[v][i]] > dep[u]) v = pre[v][i];
  if (u == v) {
    p = q = -1;
    return u;
  } else if (pre[u][0] == v) {
    p = u;
    q = -1;
    return v;
  } else if (pre[v][0] == u) {
    p = -1;
    q = v;
    return u;
  }
  if (dep[u] > dep[v]) u = pre[u][0];
  if (dep[v] > dep[u]) v = pre[v][0];
  for (int i = 19; i >= 0; i--)
    if (pre[u][i] != pre[v][i]) {
      u = pre[u][i];
      v = pre[v][i];
    }
  p = u;
  q = v;
  return pre[u][0];
}
int getkth(int v, int k) {
  for (int i = 19; i >= 0; i--)
    if (k >> i & 1) v = pre[v][i];
  return v;
}
int cval[150005];
void addp(int f, int g, int len) {
  if (dep[f] - dep[g] < len) return;
  g = getkth(f, dep[f] - dep[g] - len + 1);
  cval[f]++;
  cval[g]--;
}
void dfs1(int v, int par) {
  for (int i = 0; i < (int)(G[v].size()); i++) {
    int u = G[v][i];
    if (u == par) continue;
    dfs1(u, v);
    cval[v] += cval[u];
  }
}
long long solve0(int len) {
  for (int i = 1; i <= (int)(n); i++) cval[i] = 0;
  for (int i = 0; i < (int)(m); i++) {
    addp(x[i], t[i], len);
    addp(y[i], t[i], len);
  }
  dfs1(1, -1);
  long long ret = 0;
  for (int i = 1; i <= (int)(n); i++) ret += 1LL * cval[i] * (cval[i] - 1) / 2;
  return ret;
}
long long calc(const vector<pair<int, int> >& cur) {
  vector<pair<int, int> > ope;
  for (int i = 0; i < (int)(cur.size()); i++) {
    ope.push_back(make_pair(cur[i].first - 1, -1));
    ope.push_back(make_pair(cur[i].second, 1));
  }
  sort(ope.begin(), ope.end());
  reverse(ope.begin(), ope.end());
  long long coef = 0, ret = 0;
  for (int i = 0; i < (int)(cur.size()); i++)
    for (int j = 0; j < (int)(i); j++)
      ret += max(
          min(cur[i].second, cur[j].second) - max(cur[i].first, cur[j].first),
          0);
  return ret;
  for (int i = 0; i < (int)((int)ope.size() - 1); i++) {
    coef += ope[i].second;
    ret += coef * (coef - 1) / 2 * (ope[i].first - ope[i + 1].first);
  }
  return ret;
}
long long solve1(int len) {
  if (len == 1) return 0;
  long long ret = 0;
  for (int i = 0; i < (int)(cnt); i++) {
    vector<pair<int, int> > cur;
    for (int j = 0; j < (int)(hv[i].size()); j++) {
      int cj = hv[i][j], dl = dep[x[cj]] - dep[t[cj]],
          dr = dep[y[cj]] - dep[t[cj]];
      if (dl + dr >= len)
        cur.push_back(make_pair(max(len - dl, 1), min(dr, len - 1)));
    }
    ret += calc(cur);
  }
  return ret;
}
pair<int, int> tmp[150005];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < (int)(n - 1); i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  for (int i = 0; i < (int)(m); i++) scanf("%d%d", &x[i], &y[i]);
  dfs(1, 0);
  for (int i = 0; i < (int)(m); i++) t[i] = lca(x[i], y[i], tx[i], ty[i]);
  for (int i = 0; i < (int)(m); i++)
    if (tx[i] != -1 && ty[i] != -1) {
      if (tx[i] > ty[i]) {
        swap(x[i], y[i]);
        swap(tx[i], ty[i]);
      }
      tmp[cnt++] = make_pair(tx[i], ty[i]);
    }
  sort(tmp, tmp + cnt);
  cnt = unique(tmp, tmp + cnt) - tmp;
  for (int i = 0; i < (int)(m); i++)
    if (tx[i] == -1 || ty[i] == -1)
      grp[i] = -1;
    else {
      grp[i] = lower_bound(tmp, tmp + cnt, make_pair(tx[i], ty[i])) - tmp;
      hv[grp[i]].push_back(i);
    }
  if (n == 1000)
    printf("%lld %lld %lld %lld\n", solve0(k), solve0(k + 1), solve1(k),
           solve1(k + 1));
  else
    printf("%lld\n", solve0(k) + solve1(k) - solve0(k + 1) - solve1(k + 1));
  return 0;
}
