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 char gc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline long long read() {
  long long x = 0;
  char ch = getchar();
  bool positive = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') positive = 0;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return positive ? x : -x;
}
inline void write(long long a) {
  if (a < 0) {
    a = -a;
    putchar('-');
  }
  if (a >= 10) write(a / 10);
  putchar('0' + a % 10);
}
inline void writeln(long long a) {
  write(a);
  puts("");
}
inline void wri(long long a) {
  write(a);
  putchar(' ');
}
inline unsigned long long rnd() {
  return ((unsigned long long)rand() << 30 ^ rand()) << 4 | rand() % 4;
}
const int N = 150005, M = 40000000, K = 18;
int ls[M], rs[M], tr[M];
int qj, n, m, k, ti, nodecnt, q[N << 2], dep[N], rt[N], in[N], out[N], dp[N][K];
vector<int> v[N], zs[N], jb[N];
vector<pair<int, int> > e[N];
long long ans;
bool cmp(int a, int b) { return in[a] < in[b]; }
bool zx(int a, int b) { return in[a] <= in[b] && out[a] >= out[b]; }
int lca(int a, int b) {
  if (zx(a, b)) return a;
  for (int i = (int)(K - 1); i >= (int)(0); i--)
    if (dp[a][i] && !zx(dp[a][i], b)) a = dp[a][i];
  return dp[a][0];
}
int get(int a, int k) {
  for (int i = (int)(K - 1); i >= (int)(0); i--)
    if (k >> i & 1) a = dp[a][i];
  return a;
}
int ask(int l, int r, int i, int j, int nod) {
  if (!nod || i > r || j < l) return 0;
  if (i <= l && r <= j) return tr[nod];
  int mid = (l + r) >> 1;
  return ask(l, mid, i, j, ls[nod]) + ask(mid + 1, r, i, j, rs[nod]);
}
void ins(int l, int r, int pos, int de, int &nod) {
  if (!nod) nod = ++nodecnt;
  tr[nod] += de;
  if (l == r) return;
  int mid = (l + r) >> 1;
  if (pos <= mid)
    ins(l, mid, pos, de, ls[nod]);
  else
    ins(mid + 1, r, pos, de, rs[nod]);
}
int mer(int a, int b) {
  if (!a || !b) return a | b;
  ls[a] = mer(ls[a], ls[b]);
  rs[a] = mer(rs[a], rs[b]);
  tr[a] += tr[b];
  return a;
}
void bao(int x) {
  ins(1, n, in[x], 1, rt[0]);
  if (out[x] < n) ins(1, n, out[x] + 1, -1, rt[0]);
}
void dfs(int p, int fa) {
  for (auto i : v[p])
    if (i != fa) {
      dfs(i, p);
    }
  for (auto i : e[p]) {
    ans += ask(1, n, 1, in[i.first], rt[0]) + ask(1, n, 1, in[i.second], rt[0]);
  }
  for (auto i : e[p]) {
    if (dep[i.first] >= dep[p] + k)
      bao(get(i.first, dep[i.first] - dep[p] - k));
    if (dep[i.second] >= dep[p] + k)
      bao(get(i.second, dep[i.second] - dep[p] - k));
  }
}
void ins(int p, int j) {
  if (dep[p] - dep[qj] >= k) {
    if (j == qj)
      ans += tr[rt[p]] * 2;
    else {
      int bro = get(j, dep[j] - dep[p] - 1);
      ans += tr[rt[p]] * 2 - ask(1, n, in[bro], out[bro], rt[p]);
    }
  } else {
    int bro = get(j, dep[j] - dep[qj] - (k - dep[p] + dep[qj]));
    ans += ask(1, n, in[bro], out[bro], rt[p]);
  }
  jb[p].push_back(j);
}
void solve(int p) {
  for (auto i : zs[p]) {
    solve(i);
    if (p != qj) {
      if (jb[i].size() > jb[p].size()) {
        swap(jb[p], jb[i]);
        swap(rt[p], rt[i]);
      }
      for (auto j : jb[i]) ins(p, j);
      rt[p] = mer(rt[p], rt[i]);
    }
  }
}
void init(int p, int fa) {
  dp[p][0] = fa;
  in[p] = ++ti;
  dep[p] = dep[fa] + 1;
  for (auto i : v[p])
    if (i != fa) init(i, p);
  out[p] = ti;
}
int main() {
  n = read(), m = read(), k = read();
  for (int i = (int)(1); i <= (int)(n - 1); i++) {
    int s = read(), t = read();
    v[s].push_back(t);
    v[t].push_back(s);
  }
  init(1, 0);
  for (int i = (int)(1); i <= (int)(K - 1); i++)
    for (int j = (int)(1); j <= (int)(n); j++)
      dp[j][i] = dp[dp[j][i - 1]][i - 1];
  for (int i = (int)(1); i <= (int)(m); i++) {
    int s = read(), t = read(), x = lca(s, t);
    if (dep[s] + dep[t] - 2 * dep[x] < k) continue;
    e[x].push_back(make_pair(s, t));
  }
  dfs(1, 0);
  ans *= 2;
  for (int o = (int)(1); o <= (int)(n); o++) {
    int tt = 0;
    for (auto i : e[o]) {
      q[++tt] = i.first;
      q[++tt] = i.second;
    }
    sort(q + 1, q + tt + 1, cmp);
    for (int i = (int)(tt - 1); i >= (int)(1); i--)
      q[++tt] = lca(q[i], q[i + 1]);
    sort(q + 1, q + tt + 1, cmp);
    tt = unique(q + 1, q + tt + 1) - q - 1;
    stack<int> st;
    st.push(q[1]);
    for (int i = (int)(2); i <= (int)(tt); i++) {
      while (!zx(st.top(), q[i])) st.pop();
      zs[st.top()].push_back(q[i]);
      st.push(q[i]);
    }
    for (auto i : e[o]) {
      if (i.first != o) {
        ins(i.first, i.second);
        ins(1, n, in[i.second], 1, rt[i.first]);
      }
      if (i.second != o) {
        ins(i.second, i.first);
        ins(1, n, in[i.first], 1, rt[i.second]);
      }
    }
    qj = o;
    solve(o);
    for (int i = (int)(1); i <= (int)(nodecnt); i++) ls[i] = rs[i] = tr[i] = 0;
    nodecnt = 0;
    for (int i = (int)(1); i <= (int)(tt); i++) {
      int x = q[i];
      jb[x].clear();
      rt[x] = 0;
      zs[x].clear();
    }
  }
  cout << ans / 2 << endl;
}
