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;
template <typename A, typename B>
string to_string(pair<A, B> p);
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
string to_string(const string& s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
         to_string(get<2>(p)) + ")";
}
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
         to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
template <typename T>
void read(T& x) {
  x = 0;
  char ch = getchar();
  long long f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f *= -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  x *= f;
}
template <typename T, typename... Args>
void read(T& first, Args&... args) {
  read(first);
  read(args...);
}
const int N = 150050;
int n, m, k, s[N], t[N], lc[N], u, v;
vector<int> G[N], G2[N], T[N];
int fa[N][20], d[N], dfn[N], sz[N], tim = 0;
void dfs0(int num, int cf = 0) {
  dfn[num] = ++tim;
  fa[num][0] = cf;
  sz[num] = 1;
  for (int j = 0; fa[num][j]; j++) fa[num][j + 1] = fa[fa[num][j]][j];
  for (auto ct : G[num]) {
    if (ct == cf) continue;
    d[ct] = d[num] + 1;
    dfs0(ct, num);
    sz[num] += sz[ct];
  }
}
int lca(int u, int v) {
  if (d[u] < d[v]) swap(u, v);
  for (int i = 19; i >= 0; i--)
    if (fa[u][i] && d[fa[u][i]] >= d[v]) u = fa[u][i];
  for (int i = 19; i >= 0; i--)
    if (fa[u][i] != fa[v][i]) u = fa[u][i], v = fa[v][i];
  return u == v ? u : fa[u][0];
}
int anc(int u, int x) {
  for (int i = 19; i >= 0; i--)
    if (fa[u][i] && d[fa[u][i]] >= x) u = fa[u][i];
  return u;
}
struct Fenwick {
  int s[N];
  vector<pair<int, int> > log;
  void update(int pos, int dif) {
    log.emplace_back(pos, dif);
    for (; pos < N; pos |= pos + 1) s[pos] += dif;
  }
  void reset() {
    int pos, dif;
    for (auto ct : log) {
      pos = ct.first;
      dif = -ct.second;
      for (; pos < N; pos |= pos + 1) s[pos] += dif;
    }
    log.clear();
  }
  int query(int pos) {
    pos += 1;
    int res = 0;
    for (; pos > 0; pos &= pos - 1) res += s[pos - 1];
    return res;
  }
} A;
vector<pair<int, int> > first[N], F2[N];
struct node {
  int ls = 0, rs = 0;
  int val = 0;
} nds[10000010];
int cnt = 0, rts[N];
int query(int id, int l, int r, int cl = 0, int cr = N) {
  if (id == 0) return 0;
  if (l <= cl && cr <= r) return nds[id].val;
  int ans = 0;
  if (l <= ((cl + cr) / 2)) ans += query(nds[id].ls, l, r, cl, ((cl + cr) / 2));
  if (r > ((cl + cr) / 2))
    ans += query(nds[id].rs, l, r, ((cl + cr) / 2) + 1, r);
  return ans;
}
void add(int id, int x, int cl = 0, int cr = N) {
  if (cl == cr) return;
  nds[id].val++;
  if (x <= ((cl + cr) / 2)) {
    if (!nds[id].ls) nds[id].ls = ++cnt;
    add(nds[id].ls, x, cl, ((cl + cr) / 2));
  }
  if (x > ((cl + cr) / 2)) {
    if (!nds[id].rs) nds[id].rs = ++cnt;
    add(nds[id].rs, x, ((cl + cr) / 2) + 1, cr);
  }
}
int merge(int a, int b) {
  if (!a || !b) return a | b;
  nds[a].val += nds[b].val;
  nds[a].ls = merge(nds[a].ls, nds[b].ls);
  nds[a].rs = merge(nds[a].rs, nds[b].rs);
  return a;
}
void reset() {
  memset(nds, 0, sizeof(nds[0]) * (cnt + 10));
  cnt = 0;
}
long long ans = 0;
int crt = 0;
void dfs1(int num) {
  42;
  int cmx = -1, cs = -1;
  int tgt;
  for (auto ct : T[num]) {
    if (d[num] + d[ct] - 2 * d[crt] >= k) {
      if (d[num] >= d[crt] + k)
        tgt = anc(num, d[num] - k);
      else
        tgt = anc(ct, d[crt] + k - (d[num] - d[crt]));
      ans += query(rts[num], dfn[tgt], dfn[tgt] + sz[tgt] - 1);
    }
    add(rts[num], dfn[ct]);
  }
  for (auto ct : G2[num]) {
    dfs1(ct);
    for (auto ct : T[ct]) {
      if (d[num] + d[ct] - 2 * d[crt] >= k) {
        if (d[num] >= d[crt] + k)
          tgt = anc(num, d[num] - k);
        else
          tgt = anc(ct, d[crt] + k - (d[num] - d[crt]));
        42;
        ans += query(rts[num], dfn[tgt], dfn[tgt] + sz[tgt] - 1);
      }
      T[num].push_back(ct);
    }
    rts[num] = merge(rts[num], rts[ct]);
  }
}
int main() {
  read(n, m, k);
  for (int i = 1; i < n; i++) {
    read(u, v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  d[1] = 1;
  for (int i = 1; i <= n; i++) sort(G[i].begin(), G[i].end());
  dfs0(1);
  for (int i = 0; i < m; i++) {
    read(s[i], t[i]);
    if (dfn[s[i]] > dfn[t[i]]) swap(s[i], t[i]);
    lc[i] = lca(s[i], t[i]);
    42;
    first[d[lc[i]]].emplace_back(s[i], t[i]);
    F2[lc[i]].emplace_back(s[i], t[i]);
  }
  for (int i = n; i >= 1; i--) {
    for (auto ct : first[i]) {
      int l = ct.first, r = ct.second;
      ans += A.query(dfn[l]);
      ans += A.query(dfn[r]);
    }
    42;
    for (auto ct : first[i]) {
      int l = ct.first, r = ct.second;
      if (d[l] >= i + k) {
        l = anc(l, i + k);
        A.update(dfn[l], 1);
        A.update(dfn[l] + sz[l], -1);
      }
      if (d[r] >= i + k) {
        r = anc(r, i + k);
        A.update(dfn[r], 1);
        A.update(dfn[r] + sz[r], -1);
      }
    }
  }
  42;
  A.reset();
  for (int i = 1; i <= n; i++) {
    crt = i;
    vector<int> cu, scope;
    scope.push_back(i);
    for (auto ct : F2[i]) {
      cu.push_back(ct.first);
      if (!rts[ct.first]) rts[ct.first] = ++cnt;
      T[ct.first].push_back(ct.second);
    }
    auto cmp = [&](int a, int b) -> bool { return dfn[a] < dfn[b]; };
    sort(cu.begin(), cu.end(), cmp);
    cu.erase(unique(cu.begin(), cu.end()), cu.end());
    vector<int> stk;
    stk.push_back(i);
    auto pb = [&](int a) {
      scope.push_back(a);
      G2[stk.back()].push_back(a);
      stk.push_back(a);
    };
    for (auto ct : cu) {
      int dd = lca(ct, stk.back());
      while (d[stk.back()] > d[dd]) stk.pop_back();
      if (d[stk.back()] < d[dd]) pb(dd);
      if (d[stk.back()] < d[ct]) pb(ct);
    }
    42;
    42;
    42;
    dfs1(i);
    42;
    reset();
    for (auto ct : cu) {
      ans += 1ll * A.query(dfn[ct]) * T[ct].size();
      for (auto ed : T[ct]) {
        if (d[ed] >= d[i] + k) {
          int cc = anc(ed, d[i] + k);
          A.update(dfn[cc], 1);
          A.update(dfn[cc] + sz[cc], -1);
        }
      }
    }
    A.reset();
    for (auto ct : scope) {
      G2[ct].clear();
      rts[ct] = 0;
      T[ct].clear();
    }
  }
  cout << ans << endl;
  return 0;
}
