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;
inline long long rd() {
  long long x = 0, w = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-') c = getchar(), w = -1;
  while (isdigit(c)) x = x * 10 + c - 48, c = getchar();
  return x * w;
}
const int N = 150005;
int n, m, K, tt, dep[N], sz[N], hs[N], dl[N], dr[N], fa[N][19], rt[N];
long long ans;
vector<int> e[N], V[N];
vector<pair<int, int> > p[N];
struct BIT {
  int c[N];
  inline void upd(int x, int v) {
    for (; x <= n; x += x & -x) c[x] += v;
  }
  inline void upd(int l, int r, int v) {
    upd(l, v);
    upd(r + 1, -v);
  }
  inline int qry(int x) {
    int s = 0;
    for (; x; x -= x & -x) s += c[x];
    return s;
  }
} B;
struct seg {
  int tt;
  struct st {
    int l, r, s;
  } T[N * 40];
  void ins(int& x, int l, int r, int p) {
    if (!x) {
      x = ++tt;
      T[x] = (st){0, 0, 0};
    }
    T[x].s++;
    if (l == r) return;
    int m = l + r >> 1;
    p <= m ? ins(T[x].l, l, m, p) : ins(T[x].r, m + 1, r, p);
  }
  int merge(int x, int y) {
    if (!x || !y) return x | y;
    T[x].l = merge(T[x].l, T[y].l);
    T[x].r = merge(T[x].r, T[y].r);
    T[x].s += T[y].s;
    return x;
  }
  int qry(int x, int l, int r, int tl, int tr) {
    if (!x) return 0;
    if (tl <= l && r <= tr) return T[x].s;
    int m = l + r >> 1;
    return (tl <= m ? qry(T[x].l, l, m, tl, tr) : 0) +
           (tr > m ? qry(T[x].r, m + 1, r, tl, tr) : 0);
  }
} T;
void dfs1(int x, int p) {
  sz[x] = 1;
  dep[x] = dep[p] + 1;
  fa[x][0] = p;
  for (int i = (1); i <= (18); ++i) fa[x][i] = fa[fa[x][i - 1]][i - 1];
  for (int y : e[x])
    if (y != fa[x][0]) {
      dfs1(y, x);
      sz[x] += sz[y];
      hs[x] = sz[y] > sz[hs[x]] ? y : hs[x];
    }
}
void dfs2(int x) {
  dl[x] = ++tt;
  for (int y : e[x])
    if (y != fa[x][0] && y != hs[x]) dfs2(y);
  if (hs[x]) dfs2(hs[x]);
  dr[x] = tt;
}
inline int anc(int x, int d) {
  for (int i = (18); i >= (0); --i)
    if (d >> i & 1) x = fa[x][i];
  return x;
}
inline int lca(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  u = anc(u, dep[u] - dep[v]);
  if (u == v) return u;
  for (int i = (18); i >= (0); --i)
    if (fa[u][i] != fa[v][i]) u = fa[u][i], v = fa[v][i];
  return fa[u][0];
}
void dfs3(int x, int o) {
  rt[x] = 0;
  int w = max(0, K - (dep[x] - dep[o]));
  for (int y : V[x]) {
    if (dep[y] >= dep[o] + w) {
      int z = anc(y, dep[y] - dep[o] - w);
      ans += T.qry(rt[x], 1, n, dl[z], dr[z]);
    }
    T.ins(rt[x], 1, n, dl[y]);
  }
  for (int y : e[x])
    if (y != fa[x][0] && (y != hs[x] || x != o)) {
      dfs3(y, o);
      if (V[y].size() > V[x].size()) V[x].swap(V[y]), swap(rt[x], rt[y]);
      for (int z : V[y])
        if (dep[z] >= dep[o] + w) {
          int t = anc(z, dep[z] - dep[o] - w);
          ans += T.qry(rt[x], 1, n, dl[t], dr[t]);
        }
      for (int z : V[y]) V[x].push_back(z);
      V[y].clear();
      rt[x] = T.merge(rt[x], rt[y]);
    }
}
void dfs(int x) {
  for (int y : e[x])
    if (y != fa[x][0]) dfs(y);
  for (int i = 0; i < (p[x]).size(); ++i) ans += B.qry(dl[p[x][i].second]);
  for (int i = 0; i < (p[x]).size(); ++i) {
    int y = p[x][i].second;
    if (dep[y] < dep[x] + K) continue;
    int t = anc(y, dep[y] - dep[x] - K);
    B.upd(dl[t], dr[t], 1);
  }
  for (int i = 0; i < (p[x]).size(); ++i) ans += B.qry(dl[p[x][i].first]);
  for (int i = 0; i < (p[x]).size(); ++i) {
    int y = p[x][i].first;
    if (dep[y] < dep[x] + K) continue;
    int t = anc(y, dep[y] - dep[x] - K);
    B.upd(dl[t], dr[t], 1);
  }
  for (int i = 0; i < (p[x]).size(); ++i)
    V[p[x][i].first].push_back(p[x][i].second);
  dfs3(x, x);
  V[x].clear();
  T.tt = 0;
}
int main() {
  n = rd();
  m = rd();
  K = rd();
  for (int i = (1); i < (n); ++i) {
    int u = rd(), v = rd();
    e[u].push_back(v);
    e[v].push_back(u);
  }
  dfs1(1, 0);
  dfs2(1);
  for (int i = (1); i <= (m); ++i) {
    int u = rd(), v = rd(), t = lca(u, v);
    if (dl[u] > dl[v]) swap(u, v);
    p[t].push_back(make_pair(u, v));
  }
  dfs(1);
  printf("%lld\n", ans);
  return 0;
}
