#include <bits/stdc++.h>
using namespace std;
void solve();
int ch[1111][1111];
int main() {
  solve();
  return 0;
}
void solve() {
  int n, m, s, t, i, j, u, v, ans = 0, ds[1111], dt[1111];
  vector<int> ad[1111];
  cin >> n >> m >> s >> t;
  for (i = 1; i <= n; i++) ds[i] = dt[i] = 1111;
  ds[s] = dt[t] = 0;
  for (i = 0; i < m; i++) {
    cin >> u >> v;
    ad[u].push_back(v);
    ad[v].push_back(u);
    ch[u][v] = ch[v][u] = 1;
  }
  queue<int> qs, qt;
  qs.push(s);
  qt.push(t);
  while (!qs.empty()) {
    int tm = qs.front();
    qs.pop();
    for (i = 0; i < ad[tm].size(); i++) {
      int tmp = ad[tm][i];
      if (ds[tmp] > ds[tm] + 1) {
        ds[tmp] = ds[tm] + 1;
        qs.push(tmp);
      }
    }
  }
  while (!qt.empty()) {
    int tm = qt.front();
    qt.pop();
    for (i = 0; i < ad[tm].size(); i++) {
      int tmp = ad[tm][i];
      if (dt[tmp] > dt[tm] + 1) {
        dt[tmp] = dt[tm] + 1;
        qt.push(tmp);
      }
    }
  }
  int di = dt[s];
  for (i = 1; i <= n; i++)
    for (j = i + 1; j <= n; j++) {
      if (ds[i] + dt[j] >= di - 1 && dt[i] + ds[j] >= di - 1 && !ch[i][j])
        ans++;
    }
  cout << ans;
  return;
}
