#include <cstdio>
#include <map>
#include <vector>
#include <iostream>
using namespace std;
const int MAXN = 110000;
vector<int> g[MAXN];
bool used[MAXN];
int timer, tin[MAXN], fup[MAXN];
typedef long long ll;
map< pair<int,int>, bool > isB;
#define mp make_pair
int k = 0;
void IS_BRIDGE( int v, int to ){
k++;
isB[ mp(v,to) ] = true;
isB[ mp(to,v) ] = true;
}
void dfs (int v, int p = -1) {
used[v] = true;
tin[v] = fup[v] = timer++;
for (size_t i=0; i<g[v].size(); ++i) {
int to = g[v][i];
if (to == p) continue;
if (used[to])
fup[v] = min (fup[v], tin[to]);
else {
dfs (to, v);
fup[v] = min (fup[v], fup[to]);
if (fup[to] > tin[v])
IS_BRIDGE(v,to);
}
}
}
int n;
void find_bridges() {
timer = 0;
for (int i=0; i<n; ++i)
used[i] = false;
for (int i=0; i<n; ++i)
if (!used[i])
dfs (i);
}
long long res = 0;
int conComps = 0;
bool was2 [MAXN];
bool was1 [MAXN];
int dfs2( int v ){
was2[v] = true;
int sz = g[v].size();
int res = 1;
for( int i = 0; i < sz; i++ ){
int to = g[v][i];
if( !was2[to] )
res += dfs2(to);
}
return res;
}
int compCnt [MAXN];
int dfs1(int v){
was1[v] = true;
int sz = g[v].size();
long long q = 0;
int cnt = 1;
for( int i = 0; i < sz; i++ ){
int to = g[v][i];
if( !was1[to] ){
q = dfs1(to);
if( isB[ mp(v,to) ] ){
res += ll(q)*(n-q)-1;
}
cnt+=q;
}
}
return cnt;
}
int main(){
int m;
cin>>n>>m;
int fr,to;
for( int i = 0; i < m; i++ ){
scanf("%d%d", &fr, &to);
fr--,to--;
g[fr].push_back(to);
g[to].push_back(fr);
}
for( int i = 0; i < n; i++ ){
if( !was2[i] ){
compCnt[ conComps++ ] = dfs2(i);
}
}
find_bridges();
if( conComps>2 ){
cout<<0;
return 0;
}
else if( conComps==2 ){
cout<< ( ll(m-k)*compCnt[0]*compCnt[1] );
}
else{
dfs1(0);
res += ll(m-k)*( ll(n)*(n-1)/2 - m );
cout<<res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