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 int read() {
  char c = getchar();
  int x = 0;
  bool f = 0;
  for (; !isdigit(c); c = getchar()) f ^= !(c ^ 45);
  for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
  if (f) x = -x;
  return x;
}
int n, m, k;
vector<int> e[150005];
int fa[150005][18], dep[150005];
int dfn[150005], idx, out[150005];
void dfs(int u, int pa) {
  fa[u][0] = pa, dep[u] = dep[pa] + 1;
  dfn[u] = ++idx;
  for (register int i = (1); i <= (17); ++i) fa[u][i] = fa[fa[u][i - 1]][i - 1];
  for (auto v : e[u])
    if (v != pa) dfs(v, u);
  out[u] = idx;
}
inline int lca(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  for (register int i = (17); i >= (0); --i)
    if (dep[fa[u][i]] >= dep[v]) u = fa[u][i];
  if (u == v) return u;
  for (register int i = (17); i >= (0); --i)
    if (fa[u][i] != fa[v][i]) u = fa[u][i], v = fa[v][i];
  return fa[u][0];
}
inline int dist(int u, int v) { return dep[u] + dep[v] - 2 * dep[lca(u, v)]; }
inline int jump(int u, int k) {
  for (register int i = (0); i <= (17); ++i)
    if (k >> i & 1) u = fa[u][i];
  return u;
}
inline int go(int u, int v, int k) {
  int d = dep[lca(u, v)];
  return k <= dep[u] - d ? jump(u, k) : jump(v, dep[v] + dep[u] - 2 * d - k);
}
int ls[150005 * 40], rs[150005 * 40], sum[150005 * 40], cnt;
int rt[150005];
void merge(int& u, int v) {
  if (!u || !v) return u |= v, void();
  sum[u] += sum[v], merge(ls[u], ls[v]), merge(rs[u], rs[v]);
}
void add(int& p, int l, int r, int x) {
  if (!p) p = ++cnt;
  sum[p]++;
  if (l == r) return;
  int mid = l + r >> 1;
  if (x <= mid)
    add(ls[p], l, mid, x);
  else
    add(rs[p], mid + 1, r, x);
}
int ask(int p, int l, int r, int ql, int qr) {
  if (!p) return 0;
  if (l >= ql && r <= qr) return sum[p];
  int mid = l + r >> 1, res = 0;
  if (ql <= mid) res += ask(ls[p], l, mid, ql, qr);
  if (qr > mid) res += ask(rs[p], mid + 1, r, ql, qr);
  return res;
}
long long res;
int qu[150005], qv[150005], qlca[150005];
vector<int> id[150005];
void calc(int u, int x, int rt) {
  int lc = qlca[x];
  if (dep[u] <= dep[lc]) return;
  if (dep[u] - dep[lc] >= k) {
    int t = jump(u, k - 1);
    res += sum[rt] - ask(rt, 1, n, dfn[t], out[t]);
    if (dfn[u] <= dfn[qu[x]]) {
      t = jump(qv[x], dep[qv[x]] - dep[lc] - 1);
      res -= ask(rt, 1, n, dfn[t], out[t]);
    }
  } else if (dfn[qu[x]] < dfn[u]) {
    int t = jump(qu[x], (dep[qu[x]] - dep[lc]) - (k - (dep[u] - dep[lc])));
    res += ask(rt, 1, n, dfn[t], out[t]);
  }
}
void solve(int u) {
  for (auto x : id[u]) {
    calc(u, x, rt[u]);
    add(rt[u], 1, n, dfn[qu[x] ^ qv[x] ^ u]);
  }
  for (auto v : e[u]) {
    if (v == fa[u][0]) continue;
    solve(v);
    bool flip = 0;
    if (id[u].size() < id[v].size()) swap(id[u], id[v]), flip = 1;
    for (auto x : id[v]) calc(u, x, rt[flip ? v : u]), id[u].push_back(x);
    merge(rt[u], rt[v]);
  }
}
signed main() {
  n = read(), m = read(), k = read();
  for (register int i = (2); i <= (n); ++i) {
    int u = read(), v = read();
    e[u].push_back(v), e[v].push_back(u);
  }
  dfs(1, 0);
  for (register int i = (1); i <= (m); ++i) {
    qu[i] = read(), qv[i] = read();
    qlca[i] = lca(qu[i], qv[i]);
    if (dep[qu[i]] + dep[qv[i]] - 2 * dep[qlca[i]] < k) continue;
    if (dfn[qu[i]] > dfn[qv[i]]) swap(qu[i], qv[i]);
    id[qu[i]].push_back(i);
    id[qv[i]].push_back(i);
  }
  solve(1);
  cout << res;
  return 0;
}
