#include <bits/stdc++.h>
using namespace std;
long long n, m, s, t, ds[1005], dt[1005], v[1005], ans, adj[1005][1005];
vector<long long> a[1005];
void bfs(long long x, long long y) {
  queue<pair<long long, long long> > q;
  q.push({x, 0});
  v[x] = 1;
  while ((int)q.size()) {
    pair<long long, long long> p = q.front();
    q.pop();
    if (y)
      dt[p.first] = p.second;
    else
      ds[p.first] = p.second;
    for (auto i : a[p.first]) {
      if (!v[i]) {
        q.push({i, p.second + 1});
        v[i] = 1;
      }
    }
  }
}
void solve() {
  memset(ds, 1, sizeof ds);
  memset(dt, 1, sizeof dt);
  cin >> n >> m >> s >> t;
  while (m--) {
    long long x, y;
    cin >> x >> y;
    a[x].push_back(y);
    a[y].push_back(x);
    adj[x][y] = adj[y][x] = 1;
  }
  bfs(s, 0);
  memset(v, 0, sizeof v);
  bfs(t, 1);
  for (__typeof((n + 1)) i = (1); i < (n + 1); i++) {
    for (__typeof((n + 1)) j = (i + 1); j < (n + 1); j++) {
      if (adj[i][j] || adj[j][i]) continue;
      if (ds[i] + dt[j] + 1 >= dt[s] && dt[i] + ds[j] + 1 >= ds[t]) ans++;
    }
  }
  cout << ans << " ";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}
