#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
vector<int> to[MAXN];
vector<int> d1(MAXN, -1), d2(MAXN, -1);

void dfs(int u, int path, vector<int> &d)
{
  if (d[u] != -1)
  {
    return;
  }
  d[u] = path;
  for (auto v : to[u])
  {
    dfs(v, path + 1, d);
  }
}

int main()
{
  int N, u, v, a, b;
  cin >> N >> u >> v;
  u--, v--;
  for (int i = 0; i < N - 1; i++)
  {
    cin >> a >> b;
    a--, b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  dfs(u, 0, d1);
  dfs(v, 0, d2);
  int ans = 0, same = (1 << 30);
  for (int i = 0; i < N; i++)
  {
    if (d2[i] < d1[i])
      continue;
    if (d2[i] == d1[i])
    {
      same = min(d2[i], same);
    }
    else
    {
      ans = max(ans, d2[i] - 1);
    }
  }
  if (ans == 0 && same != (1 << 30))
  {
    cout << same << endl;
  }
  else
  {
    cout << ans << endl;
  }
}

#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
vector<int> G[100010];

int color[100010];

// 頂点を1と-1で塗っていく
bool dfs(int v, int c) {
    color[v] = c;
    for (int i = 0; i < G[v].size(); i++) {
        // 隣接している頂点が同じ色ならfalse
        if (color[G[v][i]] == c) return false;
        // 隣接している頂点がまだ塗られていないなら-cで塗る
        if (color[G[v][i]] == 0 && !dfs(G[v][i], -c)) return false;
    }

    // すべての頂点を塗れたらtrue
    return true;

}
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    rep(i, M) {
        int s, t;
        cin >> s >> t;
        s--; t--;
        G[s].push_back(t);
        G[t].push_back(s);
    }
    if(dfs(0, 1)) {
        int k1 = 0, k2 = 0;
        rep(i, 100010) {
            if (color[i] == 1) k1++;
            else if (color[i] == -1) k2++;
        }
        cout << k1 * k2 - M << endl;
    } else {
        cout << N * (N - 1) / 2 - M << endl;
    }



    return 0;
}
