#include <bits/stdc++.h>
using namespace std;
vector<long long> g[1000];
vector<vector<long long>> dist(2, vector<long long>(1000, 2000));
void dist_bfs(long long s, long long n, long long id) {
  deque<pair<long long, long long>> q;
  vector<long long> vis(n, false);
  q.push_back(make_pair(s, 0));
  vis[s] = true;
  while (!q.empty()) {
    auto x = q.front();
    dist[id][x.first] = x.second;
    q.pop_front();
    for (long long i = 0; i < g[x.first].size(); i++) {
      if (!vis[g[x.first][i]]) {
        vis[g[x.first][i]] = true;
        q.push_back(make_pair(g[x.first][i], x.second + 1));
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, i, j, k, t, s;
  cin >> n >> m >> s >> t;
  s--;
  t--;
  vector<vector<bool>> adjmat(1000, vector<bool>(1000, false));
  for (i = 0; i < m; i++) {
    cin >> j >> k;
    g[j - 1].push_back(k - 1);
    g[k - 1].push_back(j - 1);
    adjmat[j - 1][k - 1] = true;
    adjmat[k - 1][j - 1] = true;
  }
  dist_bfs(s, n, 0);
  dist_bfs(t, n, 1);
  long long ans = 0;
  for (i = 0; i < n; i++) {
    for (j = 0; j < i; j++) {
      if (!adjmat[i][j] && i != j) {
        long long p = dist[0][i] + dist[1][j] + 1,
                  q = dist[0][j] + dist[1][i] + 1;
        if (p >= dist[0][t] && q >= dist[0][t]) ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
