#include <bits/stdc++.h>
using namespace std;
const long long infl = 1e18 + 5;
long long n, m, k, q, x, y, f, val, t, i, j;
long long ind, cnt, sz, sm, ans, mx, mn;
long long a[1000004], b[1000004], vis[1000004], s;
vector<int> g[1000004];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  if (fopen("inp.txt", "r")) {
    freopen("myfile.txt", "w", stdout);
    freopen("inp.txt", "r", stdin);
  }
  cin >> n >> m >> s >> t;
  for (i = 0; i < m; i++) {
    cin >> x >> y;
    g[x].emplace_back(y);
    g[y].emplace_back(x);
  }
  memset(a, -1, sizeof(a));
  memset(b, -1, sizeof(b));
  a[t] = 0;
  queue<int> q;
  q.push(t);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    if (vis[u]) continue;
    vis[u] = 1;
    for (auto it : g[u]) {
      if (a[it] == -1)
        a[it] = a[u] + 1;
      else
        continue;
      q.push(it);
    }
  }
  memset(vis, 0, sizeof(vis));
  b[s] = 0;
  q.push(s);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    if (vis[u]) continue;
    vis[u] = 1;
    for (auto it : g[u]) {
      if (b[it] != -1) continue;
      b[it] = b[u] + 1;
      q.push(it);
    }
  }
  for (i = 1; i < n + 1; i++) {
    for (j = i + 1; j < n + 1; j++) {
      x = min(a[i], a[j]);
      y = min(b[i], b[j]);
      if (x + y + 1 >= a[s]) {
        ans++;
      }
    }
  }
  cout << ans - m;
  return 0;
}
