#include <bits/stdc++.h>
using namespace std;
int n, m, s, t;
int edge[2005];
int node[1005];
int neg;
int nxt[2005];
int d_s[1005];
int d_t[1005];
void add(int from, int to) {
  edge[neg] = to;
  nxt[neg] = node[from];
  node[from] = neg++;
}
void bfs() {
  int vis[1005];
  queue<int> que;
  que.push(s);
  d_s[s] = 0;
  memset(vis, 0, sizeof(vis));
  vis[s] = 1;
  while (!que.empty()) {
    int x = que.front();
    que.pop();
    for (int k = node[x]; k != 0; k = nxt[k]) {
      int y = edge[k];
      if (vis[y] == 0) {
        d_s[y] = d_s[x] + 1;
        que.push(y);
        vis[y] = 1;
      }
    }
  }
  memset(vis, 0, sizeof(vis));
  que.push(t);
  d_t[t] = 0;
  vis[t] = 1;
  while (!que.empty()) {
    int x = que.front();
    que.pop();
    for (int k = node[x]; k != 0; k = nxt[k]) {
      int y = edge[k];
      if (vis[y] == 0) {
        d_t[y] = d_t[x] + 1;
        que.push(y);
        vis[y] = 1;
      }
    }
  }
}
int main() {
  memset(node, 0, sizeof(node));
  memset(nxt, 0, sizeof(nxt));
  neg = 1;
  cin >> n >> m >> s >> t;
  int from, to;
  for (int i = 0; i < m; i++) {
    cin >> from >> to;
    add(from, to);
    add(to, from);
  }
  bfs();
  int Size = d_s[t];
  int answer = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (d_s[i] + d_t[j] + 1 >= Size && d_s[j] + d_t[i] + 1 >= Size) {
        answer++;
      }
    }
  }
  answer -= m;
  cout << answer << endl;
  return 0;
}
