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 = 150005;
int n, m, k, i, j, x, y, rt[N], s[N], t[N];
vector<int> e[N];
int dep[N], be[N], en[N], dcnt, anc[20][N];
void dfs(int x, int fa) {
  be[x] = ++dcnt;
  dep[x] = dep[fa] + 1;
  anc[0][x] = fa;
  for (int y : e[x])
    if (y != fa) dfs(y, x);
  en[x] = dcnt;
}
inline int ka(int x, int k) {
  for (int i = 0; 1 << i <= k; ++i)
    if (k >> i & 1) x = anc[i][x];
  return x;
}
inline int lca(int x, int y) {
  if (dep[x] > dep[y]) swap(x, y);
  int dt = dep[y] - dep[x], i;
  for (i = 0; 1 << i <= dt; ++i)
    if (dt >> i & 1) y = anc[i][y];
  if (x == y) return x;
  for (i = 19; i >= 0; --i)
    if (anc[i][x] != anc[i][y]) x = anc[i][x], y = anc[i][y];
  return anc[0][x];
}
namespace ST {
struct node {
  int l, r, s;
} t[N * 40];
int tcnt;
void ins(int& x, int l, int r, int k, int v) {
  if (!x) x = ++tcnt;
  t[x].s += v;
  if (l == r) return;
  int m = l + r >> 1;
  if (k <= m)
    ins(t[x].l, l, m, k, v);
  else
    ins(t[x].r, m + 1, r, k, v);
}
int merge(int x, int y) {
  if (!x || !y) return x | y;
  t[x].s += t[y].s;
  t[x].l = merge(t[x].l, t[y].l);
  t[x].r = merge(t[x].r, t[y].r);
  return x;
}
int ask(int x, int rl, int rr, int l, int r) {
  if (!x || (l <= rl && rr <= r)) return t[x].s;
  int m = rl + rr >> 1;
  return (rl <= m ? ask(t[x].l, rl, m, l, r) : 0) +
         (m < rr ? ask(t[x].r, m + 1, rr, l, r) : 0);
}
}  // namespace ST
int aa[N];
struct chain {
  int a, b, c, d;
  int gett(int z) {
    z = dep[c] - dep[z];
    return ka(a, dep[a] - dep[b] - z);
  }
} ch[N];
bool bb[N];
set<int> see[N], *se[N];
vector<int> in[N], out[N];
long long ans;
void dfss(int x, int fa) {
  se[x] = see + x;
  for (auto u : in[x]) se[x]->insert(u);
  for (int y : e[x])
    if (y != fa) {
      dfss(y, x);
      aa[x] += aa[y];
      if (se[x]->size() < se[y]->size()) swap(se[x], se[y]), swap(rt[x], rt[y]);
      for (int z : *se[y]) {
        int zz = ch[z].gett(x);
        ans += ST::ask(rt[x], 1, n, be[z], en[z]);
        se[x]->insert(z);
      }
      rt[x] = ST::merge(rt[x], rt[y]);
    }
  for (auto u : out[x]) se[x]->erase(u);
  ans += 1ll * aa[x] * (aa[x] - 1) >> 1;
}
inline long long calc(int k) {
  ans = 0;
  memset(ST::t, 0, sizeof ST::t);
  ST::tcnt = 0;
  memset(rt, 0, sizeof rt);
  memset(aa, 0, sizeof aa);
  for (i = 1; i <= n; ++i) see[i].clear(), in[i].clear(), out[i].clear();
  for (i = 1; i <= m; ++i) {
    int l = lca(s[i], t[i]), d1 = dep[s[i]] - dep[l], d2 = dep[t[i]] - dep[l],
        d = d1 + d2;
    if (d < k) continue;
    if (d1 >= k) ++aa[s[i]], --aa[ka(s[i], d1 - k + 1)];
    if (d2 >= k) ++aa[t[i]], --aa[ka(t[i], d2 - k + 1)];
    if (l != s[i] && l != t[i]) {
      if (be[s[i]] > be[t[i]]) swap(s[i], t[i]);
      int s1, s2, t1, t2;
      auto gett = [&](int s, int t, int& a, int& b) {
        int dd = dep[t] - dep[l];
        if (dd >= k)
          b = ka(t, dd - k + 1), a = ka(s, dep[s] - dep[l] - 1);
        else
          b = t, a = ka(s, d - k);
      };
      gett(s[i], t[i], s1, t1);
      gett(t[i], s[i], t2, s2);
      ch[i] = (chain){s1, s2, t1, t2};
      in[t1].push_back(i);
      out[t2].push_back(i);
      ST::ins(rt[t1], 1, n, be[s2], 1);
      if (s1 > 1) ST::ins(rt[t1], 1, n, be[anc[0][s1]], -1);
      ST::ins(rt[anc[0][t2]], 1, n, be[s2], 1);
      if (s1 > 1) ST::ins(rt[anc[0][t2]], 1, n, be[anc[0][s1]], -1);
    }
  }
  dfss(1, 0);
  return ans;
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (i = 1; i < n; ++i)
    scanf("%d%d", &x, &y), e[x].push_back(y), e[y].push_back(x);
  dfs(1, 0);
  for (i = 1; i < 20; ++i)
    for (j = 1; j <= n; ++j) anc[i][j] = anc[i - 1][anc[i - 1][j]];
  for (i = 1; i <= m; ++i) scanf("%d%d", s + i, t + i);
  printf("%lld\n", calc(k) - calc(k + 1));
}
