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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

template<typename T>
bool chmin(T &_a, T _b){
    if(_a > _b){
        _a = _b;
        return true;
    }else{
        return false;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    vector<int> st(2);
    cin >> n >> m >> st[0] >> st[1];
    rep(i, 2){
        --st[i];
    }

    vector< vector<int> > g(n);
    rep(i, m){
        int u, v;
        cin >> u >> v;
        --u;
        --v;
        g[u].emplace_back(v);
        g[v].emplace_back(u);
    }

    vector< vector<int> > cost(2, vector<int>(n, IINF));
    rep(i, 2){
        queue< P > que;
        que.push({st[i], 0});
        while(!que.empty()){
            P now = que.front();
            que.pop();
            if(!chmin(cost[i][now.first], now.second)){
                continue;
            }
            for(auto e : g[now.first]){
                if(cost[i][e] > now.second + 1){
                    que.push({e, now.second + 1});
                }
            }
        }
    }

    int d = cost[0][st[1]];

    vector< vector<lint> > cnt(2, vector<lint>(d + 1, 0LL));
    rep(i, 2){
        rep(j, n){
            if(cost[i][j] <= d){
                ++cnt[i][cost[i][j]];
            }
        }
    }

    lint ans = 0;
    rep(i, d - 1){
        ans += cnt[0][i] * cnt[1][d - i - 2];
    }

    cout << ans << endl;

    return 0;
}
