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 maxn = 1.5e5;
int n, m, k, fa[maxn + 3], dep[maxn + 3], sz[maxn + 3], big[maxn + 3],
    top[maxn + 3];
int cnt, dfn[maxn + 3], rht[maxn + 3], pnt[maxn + 3], a[maxn + 3], b[maxn + 3],
    c[maxn + 3];
int seq[maxn * 2 + 3], cur, la[maxn + 3], to, st[maxn + 3], sum[maxn + 3],
    son[maxn + 3], rt;
vector<int> G[maxn + 3], vec[maxn + 3], T[maxn + 3], X[maxn + 3], tmp;
struct bit {
  int n, m, t[maxn + 3], e[maxn + 3];
  bit(int n = 0) {
    this->n = n, m = 0, fill(t + 1, t + n + 1, 0), fill(e + 1, e + n + 1, 0);
  }
  void cl() { m++; }
  void add(int x, int y) {
    for (int i = x; i <= n; i += i & -i) {
      if (e[i] != m) e[i] = m, t[i] = 0;
      t[i] += y;
    }
  }
  int sum(int x) {
    int y = 0;
    for (int i = x; i; i ^= i & -i) {
      y += e[i] == m ? t[i] : 0;
    }
    return y;
  }
} B;
void dfs1(int u, int pa = 0) {
  sz[u] = 1;
  for (int i = (0); i <= int(G[u].size() - 1); i++) {
    int v = G[u][i];
    if (v == pa) continue;
    fa[v] = u, dep[v] = dep[u] + 1;
    dfs1(v, u);
    sz[u] += sz[v];
    if (sz[v] > sz[big[u]]) big[u] = v;
  }
}
void dfs2(int u, int pa = 0, int t = 1) {
  dfn[u] = rht[u] = ++cnt, pnt[cnt] = u;
  top[u] = t;
  if (big[u]) dfs2(big[u], u, t), rht[u] = rht[big[u]];
  for (int i = (0); i <= int(G[u].size() - 1); i++) {
    int v = G[u][i];
    if (v == pa || v == big[u]) continue;
    dfs2(v, u, v);
    rht[u] = rht[v];
  }
}
int lca(int u, int v) {
  while (top[u] != top[v]) {
    if (dep[top[u]] < dep[top[v]]) swap(u, v);
    u = fa[top[u]];
  }
  return dep[u] < dep[v] ? u : v;
}
int kth(int u, int k) {
  int g = dep[u] - k;
  while (dep[top[u]] > g) u = fa[top[u]];
  return pnt[dfn[u] - (dep[u] - g)];
}
long long solve1(int u, int pa = 0) {
  long long res = 0;
  for (int i = (0); i <= int(G[u].size() - 1); i++) {
    int v = G[u][i];
    if (v == pa) continue;
    res += solve1(v, u);
  }
  for (int i = (0); i <= int(vec[u].size() - 1); i++) {
    int x = vec[u][i];
    res += B.sum(dfn[a[x]]) + B.sum(dfn[b[x]]);
  }
  for (int i = (0); i <= int(vec[u].size() - 1); i++) {
    int x = vec[u][i];
    if (dep[a[x]] - dep[c[x]] >= k) {
      int u = kth(a[x], dep[a[x]] - dep[c[x]] - k);
      B.add(dfn[u], 1), B.add(rht[u] + 1, -1);
    }
    if (dep[b[x]] - dep[c[x]] >= k) {
      int u = kth(b[x], dep[b[x]] - dep[c[x]] - k);
      B.add(dfn[u], 1), B.add(rht[u] + 1, -1);
    }
  }
  return res;
}
void cl(int u) {
  if (la[u] != cur)
    la[u] = cur, vector<int>().swap(T[u]), vector<int>().swap(X[u]);
}
void add(int u, int v) { cl(u), cl(v), T[u].push_back(v); }
void insert(int x) {
  int y = lca(x, st[to]);
  while (to > 1 && dep[st[to - 1]] >= dep[y]) add(st[to - 1], st[to]), to--;
  if (st[to] != y) add(y, st[to]), st[to] = y;
  if (x != y) st[++to] = x;
}
void pre(int u) {
  sum[u] = X[u].size(), son[u] = 0;
  for (int i = (0); i <= int(T[u].size() - 1); i++) {
    int v = T[u][i];
    pre(v), sum[u] += sum[v];
    if (sum[v] >= sum[son[u]]) son[u] = v;
  }
}
void dfs(int u) {
  for (int i = (0); i <= int(X[u].size() - 1); i++) {
    int x = X[u][i];
    tmp.push_back(x);
  }
  for (int i = (0); i <= int(T[u].size() - 1); i++) {
    int v = T[u][i];
    dfs(v);
  }
}
long long work(int u) {
  long long res = 0;
  for (int i = (0); i <= int(T[u].size() - 1); i++) {
    int v = T[u][i];
    if (v == son[u]) continue;
    res += work(v), B.cl();
  }
  int d = max(0, k - (dep[u] - dep[rt]));
  if (son[u]) {
    res += work(son[u]);
    for (int i = (0); i <= int(T[u].size() - 1); i++) {
      int v = T[u][i];
      if (v == son[u]) continue;
      vector<int>().swap(tmp), dfs(v);
      for (int j = (0); j <= int(tmp.size() - 1); j++) {
        int x = tmp[j];
        if (dep[x] - dep[rt] >= d) {
          int y = kth(x, dep[x] - dep[rt] - d);
          res += B.sum(rht[y]) - B.sum(dfn[y] - 1);
        }
      }
      for (int j = (0); j <= int(tmp.size() - 1); j++) {
        int x = tmp[j];
        B.add(dfn[x], 1);
      }
    }
  }
  for (int i = (0); i <= int(X[u].size() - 1); i++) {
    int x = X[u][i];
    if (dep[x] - dep[rt] >= d) {
      int y = kth(x, dep[x] - dep[rt] - d);
      res += B.sum(rht[y]) - B.sum(dfn[y] - 1);
    }
    B.add(dfn[x], 1);
  }
  return res;
}
long long solve2(int u) {
  ++cur, rt = u;
  int k = 0;
  for (int i = (0); i <= int(vec[u].size() - 1); i++) {
    int x = vec[u][i];
    seq[++k] = dfn[a[x]], seq[++k] = dfn[b[x]];
  }
  sort(seq + 1, seq + k + 1);
  k = unique(seq + 1, seq + k + 1) - (seq + 1);
  to = 0;
  st[++to] = u, cl(u);
  for (int i = (1); i <= int(k); i++) insert(pnt[seq[i]]);
  for (int i = (to - 1); i >= int(1); i--) add(st[i], st[i + 1]);
  for (int i = (0); i <= int(vec[u].size() - 1); i++) {
    int x = vec[u][i];
    X[a[x]].push_back(b[x]);
    X[b[x]].push_back(a[x]);
  }
  pre(u);
  long long res = work(u);
  assert(res % 2 == 0);
  B.cl();
  return res / 2;
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = (1); i <= int(n - 1); i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    G[u].push_back(v), G[v].push_back(u);
  }
  dfs1(1);
  dfs2(1);
  for (int i = (1); i <= int(m); i++) {
    scanf("%d %d", &a[i], &b[i]);
    c[i] = lca(a[i], b[i]);
    vec[c[i]].push_back(i);
  }
  B = bit(n);
  long long ans = solve1(1);
  B.cl();
  for (int i = (1); i <= int(n); i++) ans += solve2(i);
  printf("%lld\n", ans);
  return 0;
}
