#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int64_t INF = 100000000000000018LL;
vector<vector<long long>> graph1(N), graph2(N);
long long dist1[N], dist2[N];
void solve() {
  long long n, m, s, t;
  cin >> n >> m >> s >> t;
  set<pair<long long, long long>> second;
  long long x, y, i, j;
  for (i = 1; i <= m; i++) {
    cin >> x >> y;
    graph1[x].push_back(y);
    graph1[y].push_back(x);
    second.insert({x, y});
    second.insert({y, x});
  }
  vector<bool> visited1(n + 1, false), visited(n + 1, false);
  queue<pair<long long, long long>> q1, q2;
  q1.push({s, 0});
  visited1[s] = true;
  long long ans1 = 0, ans2 = 0;
  while (!q1.empty()) {
    pair<long long, long long> p = q1.front();
    long long k = p.second;
    q1.pop();
    dist1[p.first] = p.second;
    for (auto it : graph1[p.first]) {
      if (!visited1[it]) {
        visited1[it] = true;
        q1.push({it, k + 1});
      }
    }
  }
  long long cnt = 0;
  q1.push({t, 0});
  visited[t] = true;
  while (!q1.empty()) {
    pair<long long, long long> p = q1.front();
    long long k = p.second;
    q1.pop();
    dist2[p.first] = p.second;
    for (auto it : graph1[p.first]) {
      if (!visited[it]) {
        visited[it] = true;
        q1.push({it, k + 1});
      }
    }
  }
  long long d = dist1[t];
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if (i == j) continue;
      if (second.find({i, j}) == second.end()) {
        second.insert({i, j});
        second.insert({j, i});
        if (dist1[i] + dist2[j] + 1 >= d && dist2[i] + dist1[j] + 1 >= d) cnt++;
      }
    }
  }
  cout << cnt;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
}
