#include <bits/stdc++.h>
using namespace std;
const long long INF = (0x7fffffffffffff);
long long nbNoeuds, nbChemins, dep, arr;
vector<long long> adj[1005];
long long mindist[2][1005];
bool existe[1005][1005];
void calcFrom(long long noeud, long long ind) {
  queue<pair<long long, long long>> bfs;
  mindist[ind][noeud] = 0;
  bfs.push({noeud, 0});
  while (!bfs.empty()) {
    auto x = bfs.front();
    bfs.pop();
    for (long long a : adj[x.first]) {
      if (mindist[ind][a] > x.second + 1) {
        mindist[ind][a] = x.second + 1;
        bfs.push({a, x.second + 1});
      }
    }
  }
}
int32_t main() {
  fill_n(&mindist[0][0], 2 * 1005, INF);
  cin >> nbNoeuds >> nbChemins >> dep >> arr;
  for (long long i = 0; i < nbChemins; ++i) {
    long long a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
    existe[a][b] = existe[b][a] = true;
  }
  calcFrom(dep, 0);
  calcFrom(arr, 1);
  long long D = mindist[0][arr];
  long long rep = 0;
  for (long long u = 1; u <= nbNoeuds; ++u) {
    for (long long v = u + 1; v <= nbNoeuds; ++v) {
      if (existe[u][v] || (mindist[0][u] + mindist[1][v] + 1) < D ||
          (mindist[0][v] + mindist[1][u] + 1) < D)
        continue;
      ++rep;
    }
  }
  cout << rep << "\n";
}
