#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
int n, m, s, t;
vector<int> adj[N];
int dist1[N], dist2[N];
int vis[N];
int adj_mat[N][N];
vector<int> level[N];
void bfs(int s, int id) {
  queue<int> q;
  q.push(s);
  vis[s] = 1;
  if (id == 0)
    dist1[s] = 0;
  else
    dist2[s] = 0;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (auto v : adj[u]) {
      if (!vis[v]) {
        if (id == 0)
          dist1[v] = dist1[u] + 1;
        else
          dist2[v] = dist2[u] + 1;
        q.push(v);
        vis[v] = 1;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  cin >> n >> m >> s >> t;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    adj_mat[a][b] = 1;
    adj_mat[b][a] = 1;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  bfs(s, 0);
  memset(vis, 0, sizeof vis);
  bfs(t, 1);
  long long ans = 0;
  int short_path = dist1[t];
  unordered_set<int> not_in_path;
  for (int i = 1; i <= n; i++) {
    if (dist1[i] + dist2[i] == short_path) {
      level[dist1[i]].push_back(i);
    } else {
      not_in_path.insert(i);
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (i == j || adj_mat[i][j] == 1) continue;
      if ((dist1[i] + 1 + dist2[j]) >= short_path &&
          (dist2[i] + dist1[j] + 1) >= short_path) {
        ans++;
      }
    }
  }
  cout << ans << '\n';
  return 0;
}
