#include<bits/stdc++.h>
using namespace std;

int N, M, s, t;
vector< int > graph[100000];

void bfs(int s, vector< int >& v)
{
  v.assign(N, -1);
  queue< int > que;
  que.push(s);
  v[s] = 0;
  while(!que.empty()) {
    int p = que.front(); que.pop();
    for(int to : graph[p]) {
      if(v[to] == -1) {
        v[to] = v[p] + 1;
        que.push(to);
      }
    }
  }            
}
int main()
{
  scanf("%d %d %d %d", &N, &M, &s, &t);
  --s, --t;
  for(int i = 0; i < M; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    --x, --y;
    graph[x].push_back(y);
    graph[y].push_back(x);
  }

  vector< int > m1, m2;
  bfs(s, m1);
  bfs(t, m2);
  
  int sum1[100001] = {}, sum2[100001] = {};
  for(int k : m1) if(k >= 0) sum1[k]++;
  for(int k : m2) if(k >= 0) sum2[k]++;
  long long ret = 0;
  for(int i = 0; i < m1[t] - 1; i++) {
    ret += 1LL * sum1[i] * sum2[m1[t] - 2 - i];
  }
  printf("%lld\n", ret);
}