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;
using db = double;
using ll = long long;
using uint = unsigned int;
using ull = unsigned long long;
template <class T>
void cmax(T& x, const T& y) {
  if (x < y) x = y;
}
template <class T>
void cmin(T& x, const T& y) {
  if (x > y) x = y;
}
template <class T>
void sort(vector<T>& v) {
  sort(v.begin(), v.end());
}
template <class T>
void reverse(vector<T>& v) {
  reverse(v.begin(), v.end());
}
template <class T>
void unique(vector<T>& v) {
  sort(v.begin(), v.end()), v.erase(unique(v.begin(), v.end()), v.end());
}
void reverse(string& s) { reverse(s.begin(), s.end()); }
const int io_size = 1 << 23 | 233;
const int io_limit = 1 << 22;
struct io_in {
  char ch;
  char getchar() {
    static char buf[io_size], *p1 = buf, *p2 = buf;
    return (p1 == p2) &&
                   (p2 = (p1 = buf) + fread(buf, 1, io_size, stdin), p1 == p2)
               ? EOF
               : *p1++;
  }
  io_in& operator>>(char& c) {
    for (c = getchar(); isspace(c); c = getchar())
      ;
    return *this;
  }
  io_in& operator>>(string& s) {
    for (s.clear(); isspace(ch = getchar());)
      ;
    if (!~ch) return *this;
    for (s = ch; !isspace(ch = getchar()) && ~ch; s += ch)
      ;
    return *this;
  }
  io_in& operator>>(char* str) {
    char* cur = str;
    while (*cur) *cur++ = 0;
    for (cur = str; isspace(ch = getchar());)
      ;
    if (!~ch) return *this;
    for (*cur = ch; !isspace(ch = getchar()) && ~ch; *++cur = ch)
      ;
    return *++cur = 0, *this;
  }
  template <class T>
  void read(T& x) {
    bool f = 0;
    while ((ch = getchar()) < 48 && ~ch) f ^= (ch == 45);
    x = ~ch ? (ch ^ 48) : 0;
    while ((ch = getchar()) > 47) x = x * 10 + (ch ^ 48);
    x = f ? -x : x;
  }
  io_in& operator>>(int& x) { return read(x), *this; }
  io_in& operator>>(ll& x) { return read(x), *this; }
  io_in& operator>>(uint& x) { return read(x), *this; }
  io_in& operator>>(ull& x) { return read(x), *this; }
  io_in& operator>>(db& x) {
    read(x);
    bool f = x < 0;
    x = f ? -x : x;
    if (ch ^ '.') return *this;
    double d = 0.1;
    while ((ch = getchar()) > 47) x += d * (ch ^ 48), d *= .1;
    return x = f ? -x : x, *this;
  }
} in;
struct io_out {
  char buf[io_size], *s = buf;
  int pw[233], st[233];
  io_out() {
    set(7);
    for (register int i = (pw[0] = 1); i <= (9); ++i) pw[i] = pw[i - 1] * 10;
  }
  ~io_out() { flush(); }
  void io_chk() {
    if (s - buf > io_limit) flush();
  }
  void flush() { fwrite(buf, 1, s - buf, stdout), fflush(stdout), s = buf; }
  io_out& operator<<(char c) { return *s++ = c, *this; }
  io_out& operator<<(string str) {
    for (char c : str) *s++ = c;
    return io_chk(), *this;
  }
  io_out& operator<<(char* str) {
    char* cur = str;
    while (*cur) *s++ = *cur++;
    return io_chk(), *this;
  }
  template <class T>
  void write(T x) {
    if (x < 0) *s++ = '-', x = -x;
    do {
      st[++st[0]] = x % 10, x /= 10;
    } while (x);
    while (st[0]) *s++ = st[st[0]--] ^ 48;
  }
  io_out& operator<<(int x) { return write(x), io_chk(), *this; }
  io_out& operator<<(ll x) { return write(x), io_chk(), *this; }
  io_out& operator<<(uint x) { return write(x), io_chk(), *this; }
  io_out& operator<<(ull x) { return write(x), io_chk(), *this; }
  int len, lft, rig;
  void set(int _length) { len = _length; }
  io_out& operator<<(db x) {
    bool f = x < 0;
    x = f ? -x : x, lft = x, rig = 1. * (x - lft) * pw[len];
    return write(f ? -lft : lft), *s++ = '.', write(rig), io_chk(), *this;
  }
} out;
template <int sz, int mod>
struct math_t {
  math_t() {
    fac.resize(sz + 1), ifac.resize(sz + 1);
    for (register int i = (fac[0] = 1); i <= (sz); ++i)
      fac[i] = fac[i - 1] * i % mod;
    ifac[sz] = inv(fac[sz]);
    for (register int i = (sz - 1); i >= (0); --i)
      ifac[i] = ifac[i + 1] * (i + 1) % mod;
  }
  vector<int> fac, ifac;
  int qpow(int x, int y) {
    int ans = 1;
    for (; y; y >>= 1, x = x * x % mod)
      if (y & 1) ans = ans * x % mod;
    return ans;
  }
  int inv(int x) { return qpow(x, mod - 2); }
  int C(int n, int m) {
    if (n < 0 || m < 0 || n < m) return 0;
    return fac[n] * ifac[m] % mod * ifac[n - m] % mod;
  }
};
int gcd(int x, int y) { return !y ? x : gcd(y, x % y); }
int lcm(int x, int y) { return x * y / gcd(x, y); }
int n, m, k;
const int maxn = 2e5 + 52;
struct BIT {
  int n;
  vector<int> c;
  BIT() {}
  BIT(const int& nn) { n = nn, c.resize(n + 1); }
  int l(int x) { return x & -x; }
  void u(int x, int y) {
    for (; x <= n; x += l(x)) c[x] += y;
  }
  int q(int x) {
    int a = 0;
    for (; x; x ^= l(x)) a += c[x];
    return a;
  }
  void U(int l, int r) { u(l, 1), u(r + 1, -1); }
};
struct SMT {
  vector<int> r, ls, rs, sum;
  int n, cnt;
  SMT() {}
  SMT(const int& nn) {
    n = nn, cnt = 0, r.resize(n), ls.resize(n << 5), rs.resize(n << 5),
    sum.resize(n << 5);
  }
  void up(int x) { sum[x] = sum[ls[x]] + sum[rs[x]]; }
  void i(int& p, int l, int r, int x) {
    if (!p) p = ++cnt;
    sum[p]++;
    if (l == r) return;
    int mid = l + r >> 1;
    (x <= mid) ? i(ls[p], l, mid, x) : i(rs[p], mid + 1, r, x);
    up(p);
  }
  int m(int x, int y) {
    if (!x || !y) return x | y;
    sum[x] += sum[y];
    ls[x] = m(ls[x], ls[y]);
    rs[x] = m(rs[x], rs[y]);
    return up(x), x;
  }
  int q(int p, int ql, int qr, int l, int r) {
    if (ql <= l && r <= qr) return sum[p];
    int mid = l + r >> 1, a = 0;
    if (ql <= mid) a += q(ls[p], ql, qr, l, mid);
    if (qr > mid) a += q(rs[p], ql, qr, mid + 1, r);
    return a;
  }
};
int f[maxn][22], d[maxn];
vector<int> g[maxn];
void dfs(int u) {
  for (int v : g[u]) {
    if (v != f[u][0]) {
      f[v][0] = u;
      d[v] = d[u] + 1;
      dfs(v);
    }
  }
}
int lca(int x, int y) {
  if (d[x] < d[y]) x ^= y ^= x ^= y;
  for (int i = 20; ~i; --i)
    if (d[f[x][i]] >= d[y]) x = f[x][i];
  if (x == y) return x;
  for (int i = 20; ~i; --i)
    if (f[x][i] != f[y][i]) x = f[x][i], y = f[y][i];
  return f[x][0];
}
int sz[maxn], son[maxn];
void dfshld(int u) {
  sz[u] = 1;
  for (int v : g[u]) {
    if (v != f[u][0]) {
      dfshld(v);
      sz[u] += sz[v];
      if (sz[v] > sz[son[u]]) son[u] = v;
    }
  }
}
int dfn[maxn], idx = 0;
void dfsidx(int u) {
  dfn[u] = ++idx;
  for (int v : g[u]) {
    if (v != son[u] && v != f[u][0]) dfsidx(v);
  }
  if (son[u]) dfsidx(son[u]);
}
int K(int x, int k) {
  for (int i = 20; ~i; --i)
    if (k & (1 << i)) x = f[x][i];
  return x;
}
int U[maxn], V[maxn];
vector<int> vr[maxn], ii[maxn];
BIT bit(maxn);
int pt[maxn];
SMT smt(maxn);
ll ans;
void DD(int x, int rt) {
  pt[x] = x;
  for (int dx : ii[x]) {
    int rd = k - (d[U[dx]] - d[rt]);
    cmax(rd, 0);
    if (d[V[dx]] - d[rt] >= rd) {
      int l = K(V[dx], d[V[dx]] - d[rt] - rd);
      ans += smt.q(smt.r[x], dfn[l], dfn[l] + sz[l] - 1, 1, n);
    }
    smt.i(smt.r[x], 1, n, dfn[V[dx]]);
  }
  for (int v : g[x]) {
    if (v == f[x][0] || (rt == x && v == son[x])) continue;
    DD(v, rt);
    if (((int)ii[pt[x]].size()) < ((int)ii[pt[v]].size()))
      swap(pt[x], pt[v]), swap(smt.r[x], smt.r[v]);
    while (((int)ii[pt[v]].size())) {
      int dx = ii[pt[v]].back();
      ii[pt[v]].pop_back();
      int rd = k - (d[x] - d[rt]);
      if (d[V[dx]] - d[rt] >= rd) {
        int l = K(V[dx], d[V[dx]] - d[rt] - rd);
        ans += smt.q(smt.r[x], dfn[l], dfn[l] + sz[l] - 1, 1, n);
      }
      ii[pt[x]].emplace_back(dx);
    }
    smt.r[x] = smt.m(smt.r[x], smt.r[v]);
  }
}
void D(int x) {
  for (int v : g[x])
    if (v != f[x][0]) D(v);
  for (int v : vr[x]) ans += bit.q(dfn[V[v]]);
  for (int v : vr[x]) {
    if (d[V[v]] - d[x] >= k) {
      int l = K(V[v], d[V[v]] - d[x] - k);
      bit.U(dfn[l], dfn[l] + sz[l] - 1);
    }
  }
  for (int v : vr[x]) {
    ans += bit.q(dfn[U[v]]);
    ii[U[v]].emplace_back(v);
  }
  DD(x, x);
  ii[pt[x]].clear();
  for (int v : vr[x]) {
    if (d[U[v]] - d[x] >= k) {
      int l = K(U[v], d[U[v]] - d[x] - k);
      bit.U(dfn[l], dfn[l] + sz[l] - 1);
    }
  }
}
signed main() {
  in >> n >> m >> k;
  for (int i = 1; i < n; i++) {
    int a, b;
    in >> a >> b;
    g[a].emplace_back(b), g[b].emplace_back(a);
  }
  dfs(1);
  for (int j = 1; j < 21; j++)
    for (int i = 1; i <= n; i++) f[i][j] = f[f[i][j - 1]][j - 1];
  dfshld(1), dfsidx(1);
  for (int i = 1; i <= m; i++) {
    int a, b;
    in >> a >> b;
    if (dfn[a] > dfn[b]) a ^= b ^= a ^= b;
    int l = lca(U[i] = a, V[i] = b);
    vr[l].emplace_back(i);
  }
  D(1);
  out << ans << '\n';
  return 0;
}
