#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 10;
int ds[maxn], dt[maxn];
int n, m, s, t;
vector<int> vec[maxn];
void bfs(int v, int *d) {
  for (int i = 0; i < maxn; i++) {
    d[i] = 1000000000;
  }
  queue<int> q;
  q.push(v);
  d[v] = 0;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (auto &it : vec[u]) {
      if (d[it] > d[u] + 1) {
        d[it] = d[u] + 1;
        q.push(it);
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  scanf("%d%d%d%d", &n, &m, &s, &t);
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    vec[x].push_back(y);
    vec[y].push_back(x);
  }
  bfs(s, ds);
  bfs(t, dt);
  int res = 0;
  int dis = ds[t];
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (ds[i] + dt[j] + 1 >= dis && ds[j] + dt[i] + 1 >= dis) {
        res++;
      }
    }
  }
  cout << res - m << endl;
  return 0;
}
