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 RLEN = 1 << 20 | 1;
inline char gc() {
  static char ibuf[RLEN], *ib, *ob;
  (ib == ob) && (ob = (ib = ibuf) + fread(ibuf, 1, RLEN, stdin));
  return (ib == ob) ? EOF : *ib++;
}
inline int read() {
  char ch = gc();
  int res = 0;
  bool f = 1;
  while (!isdigit(ch)) f ^= ch == '-', ch = gc();
  while (isdigit(ch)) res = (res + (res << 2) << 1) + (ch ^ 48), ch = gc();
  return f ? res : -res;
}
inline long long readll() {
  char ch = gc();
  long long res = 0;
  bool f = 1;
  while (!isdigit(ch)) f ^= ch == '-', ch = gc();
  while (isdigit(ch)) res = (res + (res << 2) << 1) + (ch ^ 48), ch = gc();
  return f ? res : -res;
}
inline int readstring(char *s) {
  int top = 0;
  char ch = gc();
  while (isspace(ch)) ch = gc();
  while (!isspace(ch) && ch != EOF) s[++top] = ch, ch = gc();
  s[top + 1] = '\0';
  return top;
}
template <typename tp>
inline void chemx(tp &a, tp b) {
  a = max(a, b);
}
template <typename tp>
inline void chemn(tp &a, tp b) {
  a = min(a, b);
}
const int N = 150005;
int n, m, K;
namespace bit {
int tr[N];
void upd(int p, int k) {
  for (; p <= n; p += (p & (-p))) tr[p] += k;
}
void update(int l, int r, int k) { upd(l, k), upd(r + 1, -k); }
int query(int p, int res = 0) {
  for (; p > 0; p -= (p & (-p))) res += tr[p];
  return res;
}
}  // namespace bit
int rt[N];
namespace Seg {
const int N = ::N * 40;
int lc[N], rc[N], sz[N], tot;
inline int newnode() {
  int u = ++tot;
  lc[u] = rc[u] = sz[u] = 0;
  return u;
}
void insert(int &u, int l, int r, int p) {
  if (!u) u = newnode();
  sz[u]++;
  if (l == r) return;
  if (p <= ((l + r) >> 1))
    insert(lc[u], l, ((l + r) >> 1), p);
  else
    insert(rc[u], ((l + r) >> 1) + 1, r, p);
}
void merge(int &u, int r1, int r2) {
  if (!r1 || !r2) {
    u = r1 + r2;
    return;
  }
  u = r1, sz[u] += sz[r2];
  merge(lc[u], lc[r1], lc[r2]);
  merge(rc[u], rc[r1], rc[r2]);
  return;
}
int query(int u, int l, int r, int st, int des) {
  if (!u) return 0;
  if (st <= l && r <= des) return sz[u];
  int res = 0;
  if (st <= ((l + r) >> 1)) res += query(lc[u], l, ((l + r) >> 1), st, des);
  if (((l + r) >> 1) < des) res += query(rc[u], ((l + r) >> 1) + 1, r, st, des);
  return res;
}
}  // namespace Seg
int fa[N][19], dep[N], siz[N], son[N], in[N], out[N], dfn;
vector<int> e[N];
void dfs1(int u) {
  siz[u] = 1;
  for (int i = 1; i <= 18; i++) fa[u][i] = fa[fa[u][i - 1]][i - 1];
  for (int &v : e[u])
    if (v != fa[u][0]) {
      dep[v] = dep[u] + 1, fa[v][0] = u;
      dfs1(v), siz[u] += siz[v];
      if (siz[v] > siz[son[u]]) son[u] = v;
    }
}
void dfs2(int u) {
  in[u] = ++dfn;
  for (int &v : e[u])
    if (v != fa[u][0] && v != son[u]) {
      dfs2(v);
    }
  if (son[u]) dfs2(son[u]);
  out[u] = dfn;
}
inline int Lca(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  for (int i = 18; ~i; i--)
    if (dep[fa[u][i]] >= dep[v]) u = fa[u][i];
  if (u == v) return u;
  for (int i = 18; ~i; i--)
    if (fa[u][i] != fa[v][i]) u = fa[u][i], v = fa[v][i];
  return fa[v][0];
}
inline int jump(int u, int k) {
  for (int i = 18; ~i; i--)
    if ((k >> i) & 1) {
      u = fa[u][i];
    }
  return u;
}
vector<pair<int, int> > p[N];
vector<int> nd[N];
long long ans;
void dfs4(int u, int top) {
  rt[u] = 0;
  int del = max(0, K - dep[u] + dep[top]);
  for (int &x : nd[u]) {
    if (dep[x] >= dep[top] + del) {
      int tp = jump(x, dep[x] - dep[top] - del);
      ans += Seg::query(rt[u], 1, n, in[tp], out[tp]);
    }
    Seg::insert(rt[u], 1, n, in[x]);
  }
  for (int &v : e[u])
    if (v != fa[u][0] && (v != son[u] || u != top)) {
      dfs4(v, top);
      if (nd[v].size() > nd[u].size()) {
        nd[u].swap(nd[v]), swap(rt[u], rt[v]);
      }
      for (int &x : nd[v]) {
        if (dep[x] >= dep[top] + del) {
          int tp = jump(x, dep[x] - dep[top] - del);
          ans += Seg::query(rt[u], 1, n, in[tp], out[tp]);
        }
        nd[u].push_back(x);
      }
      nd[v].clear();
      Seg::merge(rt[u], rt[u], rt[v]);
    }
}
void dfs3(int u) {
  for (int &v : e[u])
    if (v != fa[u][0]) dfs3(v);
  for (pair<int, int> &x : p[u]) ans += bit::query(in[x.second]);
  for (pair<int, int> &x : p[u])
    if (dep[x.second] >= dep[u] + K) {
      int tp = jump(x.second, dep[x.second] - dep[u] - K);
      bit::update(in[tp], out[tp], 1);
    }
  for (pair<int, int> &x : p[u]) {
    ans += bit::query(in[x.first]);
  }
  for (pair<int, int> &x : p[u])
    if (dep[x.first] >= dep[u] + K) {
      int tp = jump(x.first, dep[x.first] - dep[u] - K);
      bit::update(in[tp], out[tp], 1);
    }
  for (pair<int, int> &x : p[u]) {
    nd[x.first].push_back(x.second);
  }
  dfs4(u, u);
  nd[u].clear(), Seg::tot = 0;
}
int main() {
  n = read(), m = read(), K = read();
  for (int i = 1; i < n; i++) {
    int u = read(), v = read();
    e[u].push_back(v), e[v].push_back(u);
  }
  dep[1] = 1, dfs1(1), dfs2(1);
  for (int i = 1; i <= m; i++) {
    int u = read(), v = read();
    if (in[u] > in[v]) swap(u, v);
    p[Lca(u, v)].push_back(pair<int, int>(u, v));
  }
  dfs3(1);
  cout << ans << '\n';
  return 0;
}
