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 int MAXN = 150000 + 23;
int n, m, k, fa[MAXN][18], depth[MAXN], dfn[MAXN], siz[MAXN], cnt = 0;
vector<int> g[MAXN];
long long rest = 0;
void dfs(int now, int pre) {
  fa[now][0] = pre;
  dfn[now] = ++cnt;
  siz[now] = 1;
  for (int i = 1; i <= 17; ++i) fa[now][i] = fa[fa[now][i - 1]][i - 1];
  for (auto it : g[now])
    if (it != pre)
      depth[it] = depth[now] + 1, dfs(it, now), siz[now] += siz[it];
}
int jump(int now, int dis) {
  for (int i = 0; i < 18; ++i)
    if ((dis >> i) & 1) now = fa[now][i];
  return now;
}
int lca(int u, int v) {
  if (depth[u] > depth[v]) swap(u, v);
  v = jump(v, depth[v] - depth[u]);
  if (u == v) return u;
  for (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];
}
struct BIT {
  int bit[MAXN];
  BIT() { memset(bit, 0, sizeof(bit)); }
  void add(int pos, int val) {
    while (pos <= n) {
      bit[pos] += val, pos += pos & (-pos);
    }
  }
  int sum(int pos) {
    int s = 0;
    while (pos) {
      s += bit[pos], pos ^= pos & (-pos);
    }
    return s;
  }
  int query(int l, int r) {
    if (r < l) return 0;
    return sum(r) - sum(l - 1);
  }
} ds1, ds2;
vector<pair<int, int> > v[MAXN];
void work3(vector<int>& V) {
  sort(V.begin(), V.end());
  int Sz = V.size() - (lower_bound(V.begin(), V.end(), k) - V.begin());
  rest -= 1ll * Sz * (Sz - 1) / 2;
}
void work2(vector<pair<int, int> >& V) {
  vector<int> Lp, Rp;
  for (auto it : V) Lp.push_back(it.first);
  for (auto it : V) Rp.push_back(it.second);
  work3(Lp);
  work3(Rp);
  sort(V.begin(), V.end());
  reverse(V.begin(), V.end());
  for (auto it : V) {
    int need = max(1, k - it.first);
    if (it.second >= need) {
      rest += ds2.query(need, n);
    }
    ds2.add(it.second, 1);
  }
  for (auto it : V) ds2.add(it.second, -1);
}
pair<int, int> Orz(pair<int, int> A) {
  if (A.first < A.second) return A;
  return make_pair(A.second, A.first);
}
void work(int now) {
  map<pair<int, int>, vector<pair<int, int> > > M;
  map<int, vector<int> > D;
  for (auto it : v[now]) {
    if (it.first != now)
      D[jump(it.first, depth[it.first] - depth[now] - 1)].push_back(
          depth[it.first] - depth[now]);
    if (it.second != now)
      D[jump(it.second, depth[it.second] - depth[now] - 1)].push_back(
          depth[it.second] - depth[now]);
    if (it.first != now && it.second != now) {
      pair<int, int> A, B;
      A = make_pair(jump(it.first, depth[it.first] - depth[now] - 1),
                    jump(it.second, depth[it.second] - depth[now] - 1));
      B = make_pair(depth[it.first] - depth[now],
                    depth[it.second] - depth[now]);
      if (A.first > A.second) swap(A.first, A.second), swap(B.first, B.second);
      M[A].push_back(B);
    }
  }
  for (auto ite = D.begin(); ite != D.end(); ++ite) {
    vector<int>& V = ite->second;
    sort(V.begin(), V.end());
    int Sz = V.size() - (lower_bound(V.begin(), V.end(), k) - V.begin());
    rest += 1ll * Sz * (Sz - 1) / 2;
  }
  for (auto ite = M.begin(); ite != M.end(); ++ite) work2(ite->second);
}
void gao(int now, int pre) {
  for (auto it : v[now]) {
    int z;
    if (depth[it.second] - depth[now] >= k) {
      z = jump(it.second, depth[it.second] - depth[now] - k);
      rest += ds1.query(dfn[z], dfn[z] + siz[z] - 1);
    }
    if (depth[it.first] - depth[now] >= k) {
      z = jump(it.first, depth[it.first] - depth[now] - k);
      rest += ds1.query(dfn[z], dfn[z] + siz[z] - 1);
    }
  }
  work(now);
  for (auto it : v[now]) ds1.add(dfn[it.first], 1), ds1.add(dfn[it.second], 1);
  for (auto it : g[now])
    if (it != pre) gao(it, now);
  for (auto it : v[now])
    ds1.add(dfn[it.first], -1), ds1.add(dfn[it.second], -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);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1, 0);
  for (int i = 1; i <= m; ++i) {
    int s, t;
    scanf("%d%d", &s, &t);
    v[lca(s, t)].push_back(make_pair(s, t));
  }
  gao(1, 0);
  cout << rest << endl;
  return 0;
}
