#include <iostream>
#include <vector>
#include <queue>
#define make make_pair
#define N 100002
#define INF (1e9)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
void bfs(ll,ll);
ll n,m,s,t,a,b,cost[2][N],mincost,ans;
vector<ll> c[N];
ll C[N];

int main(){
  cin>>n>>m>>s>>t;
  for(int i=0;i<m;i++){
    cin>>a>>b;
    c[a].push_back(b);
    c[b].push_back(a);
  }
  bfs(0,s);
  bfs(1,t);
  for(int i=0;i<=mincost-2;i++) ans+=cost[0][i]*cost[1][mincost-2-i];
  if(mincost-2<0) cout<<0<<endl;
  else cout<<ans<<endl;
  return 0;
}

void bfs(ll index,ll start){
  queue<P> q;
  for(int i=1;i<=n;i++) C[i]=INF;
  q.push(make(0,start));
  C[start]=0;
  while(!q.empty()){
    P k=q.front(); q.pop();
    int cos=k.first,u=k.second;
    for(int i=0;i<(int)c[u].size();i++){
      int nu=c[u][i];
      if(C[nu]>cos+1){
	C[nu]=cos+1;
	q.push(make(C[nu],nu));
      }
    }
  }
  if(!index) mincost=C[t];
  for(int i=1;i<=n;i++){
    if(C[i]==INF) continue;
    cost[index][C[i]]++;
  }
}