#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
long long inf = 1e18;
queue<int> q1, q2;
int dis_1[1001], dis_2[1001];
int vis1[1001], vis2[1001];
vector<int> v[1001];
int main() {
  int n, m, s, t, k;
  cin >> n >> m >> s >> t;
  int x, y;
  k = m;
  while (m--) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  vis1[s] = 1;
  vis2[t] = 1;
  q1.push(s);
  q2.push(t);
  while (!(q1.empty())) {
    int x = q1.front();
    q1.pop();
    for (int i = 0; i < v[x].size(); i++)
      if (vis1[v[x][i]] == 0) {
        dis_1[v[x][i]] = dis_1[x] + 1;
        q1.push(v[x][i]);
        vis1[v[x][i]] = 1;
      }
  }
  while (!(q2.empty())) {
    int x = q2.front();
    q2.pop();
    for (int i = 0; i < v[x].size(); i++)
      if (vis2[v[x][i]] == 0) {
        dis_2[v[x][i]] = dis_2[x] + 1;
        q2.push(v[x][i]);
        vis2[v[x][i]] = 1;
      }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (!((i == s && j == t) || (i == t && j == s))) {
        if (1 + min(dis_1[i] + dis_2[j], dis_2[i] + dis_1[j]) >= dis_1[t])
          ans++;
      }
    }
  }
  if (dis_1[t] == 1)
    cout << ans - k + 1;
  else
    cout << ans - k;
}
