#include <bits/stdc++.h>
const long long int MAX = (long long int)(1e18 + 1);
const long long int MIN = (long long int)(-1e18 - 1);
long long int mod = (long long int)(1e9 + 7);
using namespace std;
long long int max(long long int a, long long int b, long long int c) {
  return max(max(a, b), c);
}
long long int min(long long int a, long long int b, long long int c) {
  return min(min(a, b), c);
}
long long int max(long long int a, long long int b) { return (a > b) ? a : b; }
long long int min(long long int a, long long int b) { return (a < b) ? a : b; }
long long int power(long long int a, long long int n) {
  long long int p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
    }
    n >>= 1;
    a *= a;
  }
  return p;
}
long long int power_mod(long long int a, long long int n, long long int mod_) {
  long long int p = 1;
  while (n) {
    if (n % 2) {
      p = (p * a) % mod_;
    }
    n /= 2;
    a = (a * a) % mod_;
  }
  return p % mod_;
}
vector<long long int> col;
vector<vector<long long int>> graph;
void bfs(long long int src, long long int dis[]) {
  queue<long long int> q;
  q.push(src);
  col[src] = 1;
  while (q.size()) {
    long long int x = q.front();
    q.pop();
    for (auto y : graph[x]) {
      dis[y] = min(dis[y], dis[x] + 1);
      if (col[y] == 0) {
        q.push(y);
        col[y] = 1;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  long long int mn = MAX, mx = MIN;
  long long int n, t, m, k, i, j, sum = 0, prev, flag = 0, cnt = 0;
  long long int x = 0, y = 0, fx, diff, tot = 0, l, r;
  int TC = 1;
  while (TC--) {
    cin >> n >> m >> x >> y;
    --x;
    --y;
    graph.assign(n, {});
    for (i = 0; i < m; i++) {
      cin >> j >> k;
      j--;
      k--;
      graph[j].push_back(k);
      graph[k].push_back(j);
    }
    for (i = 0; i < n; i++) sort((graph[i]).begin(), (graph[i]).end());
    col.assign(n, 0);
    long long int disx[n], disy[n];
    for (i = 0; i < n; i++) disx[i] = disy[i] = mod;
    disx[x] = 0;
    disy[y] = 0;
    bfs(x, disx);
    col.assign(n, 0);
    bfs(y, disy);
    cnt = 0;
    for (i = 0; i < n; i++) {
      for (j = i + 1; j < n; j++) {
        if (binary_search((graph[i]).begin(), (graph[i]).end(), j)) continue;
        if ((disx[i] + 1 + disy[j] >= disy[x]) and
            (disx[j] + 1 + disy[i] >= disy[x])) {
          cnt++;
        }
      }
    }
    cout << cnt;
  }
  return 0;
}
