#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
long long int exp(long long int a, long long int b) {
  long long int r = 1;
  while (b) {
    if (b & 1) r = r * a % 1000000007, r %= 1000000007;
    a = a * a % 1000000007;
    b /= 2;
  }
  return r;
}
vector<long long int> g[1011];
vector<long long int> d1(1011), d2(1011);
int solve() {
  long long int n, i, j, k, m, x, y, z;
  long long int s, t;
  cin >> n >> m >> s >> t;
  set<pair<int, int> > st;
  for (i = 1; i <= m; ++i) {
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
    st.insert({x, y});
    st.insert({y, x});
  }
  d1[s] = 0;
  queue<int> q;
  q.push(s);
  vector<int> vis(n + 1);
  while (q.size()) {
    int u = q.front();
    q.pop();
    vis[u] = 1;
    for (auto v : g[u]) {
      if (!vis[v]) {
        vis[v] = 1;
        d1[v] = d1[u] + 1;
        q.push(v);
      }
    }
  }
  d2[t] = 0;
  q.push(t);
  vis = vector<int>(n + 1);
  while (q.size()) {
    int u = q.front();
    q.pop();
    vis[u] = 1;
    for (auto v : g[u]) {
      if (!vis[v]) {
        vis[v] = 1;
        d2[v] = d2[u] + 1;
        q.push(v);
      }
    }
  }
  long long int ans = 0;
  for (i = 1; i <= n; ++i) {
    for (j = i + 1; j <= n; ++j) {
      if (st.count({i, j})) continue;
      long long int mind = d1[i] + 1 + d2[j];
      mind = min(mind, d1[j] + 1 + d2[i]);
      if (mind >= d1[t]) ++ans;
    }
  }
  cout << ans << "\n";
  return 0;
  ;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  ;
  while (t--) {
    solve();
  }
  return 0;
  ;
}
