#include <bits/stdc++.h>
using namespace std;
vector<int> graph[1001];
int mat[1000][1000];
int main(void) {
  int n, m, s, t;
  cin >> n >> m >> s >> t;
  s--;
  t--;
  memset(mat, 0, sizeof(mat));
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    mat[u][v] = 1;
    mat[v][u] = 1;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  queue<int> nodes;
  int level1[n];
  memset(level1, -1, sizeof(level1));
  level1[s] = 0;
  nodes.push(s);
  while (!nodes.empty()) {
    int v = nodes.front();
    for (int i : graph[v]) {
      if (level1[i] == -1) {
        level1[i] = level1[v] + 1;
        nodes.push(i);
      }
    }
    nodes.pop();
  }
  int level2[n];
  memset(level2, -1, sizeof(level2));
  level2[t] = 0;
  nodes.push(t);
  int count[n];
  count[t] = 1;
  while (!nodes.empty()) {
    int v = nodes.front();
    for (int i : graph[v]) {
      if (level2[i] == -1) {
        level2[i] = level2[v] + 1;
        count[i] = count[v];
        nodes.push(i);
      } else {
        if (level2[i] > level2[v] + 1) {
          level2[i] = level2[v] + 1;
          count[i] = count[v];
        } else if (level2[i] == level2[v] + 1) {
          count[i] += count[v];
        }
      }
    }
    nodes.pop();
  }
  int track[n];
  for (int i = 0; i < n; i++) {
    if (level1[i] + level2[i] == level1[t]) {
      track[i] = 1;
    } else {
      track[i] = 0;
    }
  }
  int count1 = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (mat[i][j] == 1) {
        continue;
      }
      if (level1[i] + level2[j] + 1 < level1[t]) {
        count1++;
      }
    }
  }
  cout << ((n) * (n - 1)) / 2 - count1 - m << endl;
}
