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 Inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3fll;
const int maxn = 150005;
int n, m, k;
vector<int> nei[maxn];
int bg[maxn], en[maxn], tmc;
int fa[19][maxn], dep[maxn];
void dfs(int now, int lst) {
  fa[0][now] = lst;
  for (int i = 1; i <= (18); ++i) fa[i][now] = fa[i - 1][fa[i - 1][now]];
  dep[now] = dep[lst] + 1;
  bg[now] = ++tmc;
  for (auto &to : (nei[now])) {
    if (to == lst) continue;
    dfs(to, now);
  }
  en[now] = tmc;
}
struct Path {
  int u, v, c;
  bool operator<(const Path &p) const { return dep[c] < dep[p.c]; }
} p[maxn];
vector<int> cs[maxn];
int inline lca(int a, int b) {
  if (dep[a] < dep[b]) swap(a, b);
  int up = dep[a] - dep[b];
  for (int i = 0; i < (19); ++i)
    if ((up >> i) & 1) a = fa[i][a];
  if (a == b) return a;
  for (int i = (18); (-1) > 0 ? i <= (0) : i >= (0); i += (-1))
    if (fa[i][a] != fa[i][b]) a = fa[i][a], b = fa[i][b];
  return fa[0][a];
}
int inline atdep(int a, int de) {
  int up = dep[a] - de;
  for (int i = 0; i < (19); ++i)
    if ((up >> i) & 1) a = fa[i][a];
  return a;
}
struct Fenwick {
  int dt[maxn];
  void inline add(int a, int x) {
    while (a < maxn) dt[a] += x, a += a & -a;
  }
  int inline sum(int a) {
    int ans = 0;
    while (a) ans += dt[a], a -= a & -a;
    return ans;
  }
  void inline add(int l, int r, int x) {
    add(l, x);
    add(r + 1, -x);
  }
} bit;
int ls[maxn << 2], rs[maxn << 2];
int dt[maxn << 2], nds;
void inline add(int to, int x, int &now, int nl = 1, int nr = n) {
  if (!now) now = ++nds;
  if (nl == nr) return void(dt[now] += x);
  int m = (nl + nr) >> 1;
  if (m >= to)
    add(to, x, ls[now], nl, m);
  else
    add(to, x, rs[now], m + 1, nr);
  dt[now] = dt[ls[now]] + dt[rs[now]];
}
int inline sum(int l, int r, int now, int nl = 1, int nr = n) {
  if (nl > r || nr < l) return 0;
  if (nl >= l && nr <= r) return dt[now];
  int m = (nl + nr) >> 1;
  return sum(l, r, ls[now], nl, m) + sum(l, r, rs[now], m + 1, nr);
}
void inline merge(int &x, int y, int nl = 1, int nr = n) {
  if (!x || !y) return void(x += y);
  if (nl == nr) return void(dt[x] += dt[y]);
  int m = (nl + nr) >> 1;
  merge(ls[x], ls[y], nl, m);
  merge(rs[x], rs[y], m + 1, nr);
  dt[x] = dt[ls[x]] + dt[rs[x]];
}
long long ans = 0;
vector<int> us[maxn];
vector<int> egs[maxn];
int rt[maxn];
vector<int> ss[maxn];
void inline mrg(int a, int b) {
  bool tag = 0;
  if (((int)(ss[a]).size()) < ((int)(ss[b]).size())) swap(a, b), tag = 1;
  for (auto &id : (ss[b])) {
    int to = p[id].v, lc = p[id].c;
    int dis = dep[b] + dep[to] - 2 * dep[lc] - k;
    to = atdep(to, max(1, dep[to] - dis));
    ans += sum(bg[to], en[to], rt[a]);
    if (bg[p[id].u] >= bg[to] && bg[p[id].u] <= en[to])
      ans -= sum(bg[p[id].u], bg[p[id].u], rt[a]);
  }
  if (tag) swap(a, b), ss[a].swap(ss[b]), swap(rt[a], rt[b]);
  ss[a].insert(ss[a].end(), ss[b].begin(), ss[b].end());
  ss[b].clear();
  merge(rt[a], rt[b]);
}
void dfs3(int now) {
  rt[now] = 0;
  ss[now].clear();
  for (auto &id : (us[now])) {
    int to = p[id].v, lc = p[id].c;
    int dis = dep[now] + dep[to] - 2 * dep[lc] - k;
    to = atdep(to, max(1, dep[to] - dis));
    ans += sum(bg[to], en[to], rt[now]);
    add(bg[p[id].v], 1, rt[now]);
    ss[now].push_back(id);
  }
  for (auto &to : (egs[now])) {
    dfs3(to);
    mrg(now, to);
  }
}
void dfs2(int now, int lst) {
  for (auto &to : (nei[now])) {
    if (to == lst) continue;
    dfs2(to, now);
  }
  for (auto &id : (cs[now])) ans += bit.sum(bg[p[id].v]);
  for (auto &id : (cs[now])) {
    if (dep[p[id].v] - dep[now] >= k) {
      int to = atdep(p[id].v, dep[now] + k);
      bit.add(bg[to], en[to], 1);
    }
  }
  vector<int> nd;
  for (auto &id : (cs[now]))
    ans += bit.sum(bg[p[id].u]), us[p[id].u].push_back(id),
        nd.push_back(p[id].u);
  sort((nd).begin(), (nd).end(), [&](int a, int b) { return bg[a] < bg[b]; });
  nd.erase(unique((nd).begin(), (nd).end()), nd.end());
  vector<int> stk;
  stk.push_back(1);
  egs[1].clear();
  for (auto &to : (nd))
    if (to != 1) {
      int l = lca(to, stk.back());
      if (l != stk.back()) {
        while (((int)(stk).size()) > 1 &&
               bg[l] < bg[stk[((int)(stk).size()) - 2]]) {
          egs[stk[((int)(stk).size()) - 2]].push_back(stk.back());
          stk.pop_back();
        }
        if (bg[l] != bg[stk[((int)(stk).size()) - 2]]) {
          egs[l].clear();
          egs[l].push_back(stk.back());
          stk.back() = l;
        } else {
          egs[l].push_back(stk.back());
          stk.pop_back();
        }
      }
      egs[to].clear();
      stk.push_back(to);
    }
  while (((int)(stk).size()) > 1)
    egs[stk[((int)(stk).size()) - 2]].push_back(stk.back()), stk.pop_back();
  memset(ls, 0, sizeof(int) * (nds + 5));
  memset(rs, 0, sizeof(int) * (nds + 5));
  memset(dt, 0, sizeof(int) * (nds + 5));
  nds = 0;
  dfs3(1);
  for (auto &id : (cs[now])) us[p[id].u].clear();
  for (auto &id : (cs[now])) {
    if (p[id].u != now && dep[p[id].u] - dep[now] >= k) {
      int to = atdep(p[id].u, dep[now] + k);
      bit.add(bg[to], en[to], 1);
    }
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= (n - 1); ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    nei[u].push_back(v);
    nei[v].push_back(u);
  }
  dfs(1, 0);
  for (int i = 1; i <= (m); ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    if (bg[u] > bg[v]) swap(u, v);
    p[i].u = u;
    p[i].v = v;
    p[i].c = lca(u, v);
    cs[p[i].c].push_back(i);
  }
  dfs2(1, 0);
  printf("%lld\n", ans);
  return 0;
}
