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 N = 2e5 + 7;
const int K = 20;
vector<int> g[N];
int up[K][N];
int l[N], r[N];
int h[N];
vector<int> e;
void dfs(int u, int p) {
  e.push_back(u);
  l[u] = (int)e.size() - 1;
  up[0][u] = p;
  for (int i = 1; i < K; ++i) {
    up[i][u] = up[i - 1][up[i - 1][u]];
  }
  for (auto v : g[u]) {
    if (v != p) {
      h[v] = h[u] + 1;
      dfs(v, u);
    }
  }
  r[u] = (int)e.size() - 1;
}
bool anc(int a, int b) { return l[a] <= l[b] && r[b] <= r[a]; }
int lca(int a, int b) {
  if (anc(a, b)) return a;
  for (int i = K - 1; i >= 0; --i) {
    if (!anc(up[i][a], b)) {
      a = up[i][a];
    }
  }
  return up[0][a];
}
int get_par(int u, int k) {
  for (int i = 0; i < K; ++i) {
    if (k & (1 << i)) {
      u = up[i][u];
    }
  }
  return u;
}
int inter_vert(int a, int b, int c, int d) {
  int f = (h[a] >= h[c] ? a : c);
  int s = (h[b] <= h[d] ? b : d);
  if (anc(f, s)) {
    return h[s] - h[f];
  } else {
    return 0;
  }
}
struct Fenwick {
  vector<int> f;
  int n;
  void init(int nn) {
    n = nn;
    f.resize(n);
  }
  void modify(int i, int x) {
    for (; i < n; i |= i + 1) {
      f[i] += x;
    }
  }
  void add(int l, int r, int x) {
    modify(l, x);
    if (r + 1 < n) modify(r + 1, -x);
  }
  int get(int r) {
    int res = 0;
    for (; r >= 0; r &= r + 1, --r) {
      res += f[r];
    }
    return res;
  }
};
vector<pair<int, int>> who[N];
int k;
Fenwick F;
long long ans = 0;
void jhfs(int u, int p) {
  for (auto v : g[u]) {
    if (v != p) {
      jhfs(v, u);
    }
  }
  for (auto p : who[u]) {
    ans += F.get(l[p.first]);
    ans += F.get(l[p.second]);
  }
  for (auto p : who[u]) {
    int a = p.first;
    if (h[a] - h[u] >= k) {
      int v = get_par(a, h[a] - h[u] - k);
      F.add(l[v], r[v], 1);
    }
    a = p.second;
    if (h[a] - h[u] >= k) {
      int v = get_par(a, h[a] - h[u] - k);
      F.add(l[v], r[v], 1);
    }
  }
  for (int i = 0; i < (int)who[u].size(); ++i) {
    for (int j = i + 1; j < (int)who[u].size(); ++j) {
      bool ok = false;
      if (inter_vert(u, who[u][i].first, u, who[u][j].first) +
              inter_vert(u, who[u][i].second, u, who[u][j].second) >=
          k)
        ok = true;
      if (inter_vert(u, who[u][i].first, u, who[u][j].second) +
              inter_vert(u, who[u][i].second, u, who[u][j].first) >=
          k)
        ok = true;
      if (ok) ++ans;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m >> k;
  for (int i = 0; i + 1 < n; ++i) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(0, 0);
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    who[lca(a, b)].emplace_back(a, b);
  }
  F.init(n);
  jhfs(0, 0);
  cout << ans << '\n';
}
