100 10
87 73
15 71
14 33
1 4
20 80
65 67
36 36
25 4
22 21
7 97
 4 2
3 3
3 4
 5 4
3 3
4 4
5 5
1 2
 4 4
1 2
2 3
3 1
4 4
 4 3
1 1
2 3
3 4
 1000000 1
255765 255765
 4 3
1 2
2 3
4 4
 4 2
1 1
1 2
 3 3
1 1
2 2
3 3
 5 4
1 1
2 3
2 4
2 5
 4 5
1 4
3 4
1 2
2 3
2 4
 4 4
2 3
2 4
3 4
4 4
 10 9
8 10
3 10
2 8
9 3
4 8
1 10
7 9
5 4
7 3
 10 10
1 2
2 3
3 4
4 5
5 1
6 6
7 7
8 8
9 9
10 10
 5 5
1 4
3 4
1 2
2 3
2 4
 3 3
1 2
2 2
3 3
 5 3
1 1
2 2
3 3
 6 12
1 2
1 3
2 3
1 1
2 2
3 3
4 5
5 6
4 6
4 4
5 5
6 6
 4 4
1 2
2 3
1 3
4 4
 5 4
1 2
3 3
4 4
5 5
 7 13
6 7
2 7
3 7
4 3
5 2
1 4
7 7
3 1
5 5
3 3
1 5
2 6
6 6
 2 2
1 1
2 2
 5 5
1 1
2 2
3 3
4 4
5 5
 1 1
1 1
 7 3
1 1
3 3
6 6
 3 3
1 1
2 3
3 3

0 1 0 0 0 0 0 1 0 0 8 6 12 0 8 0 0 0 0 0 57 0 0 0 0 0
#include <bits/stdc++.h>
using namespace std;
vector<int> col;
vector<int> sum;
vector<vector<int> > g;
const int MAXN = 1e6;
bool used[MAXN];
int timer, tin[MAXN], fup[MAXN];
void dfs1(int i, int c) {
  sum[c]++;
  if (col[i] == 0) {
    col[i] = c;
    for (auto to : g[i]) {
      dfs1(to, c);
    }
  }
}
int j = 0;
set<int> cutpoint;
void dfs(int v, int p = -1) {
  int is = 0;
  int loop = 0;
  used[v] = true;
  tin[v] = fup[v] = timer++;
  int children = 0;
  for (size_t i = 0; i < g[v].size(); ++i) {
    int to = g[v][i];
    if (to == v) {
      loop = 1;
      continue;
    }
    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] && p != -1) is = 1;
      ++children;
    }
  }
  if (p == -1 && children > 1) is = 1;
  if (is == 0) {
    j += g[v].size();
    j -= loop;
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  col.resize(n, 0);
  sum.resize(n + 1, 0);
  int cur = 0;
  g.resize(n);
  int loop = 0;
  int w = -1;
  timer = 0;
  for (int i = 0; i < n; ++i) used[i] = false;
  for (int i = 0; i < m; i++) {
    int a1, a2;
    cin >> a1 >> a2;
    if (a1 == a2) {
      loop++;
    }
    a1--;
    a2--;
    g[a1].push_back(a2);
    g[a2].push_back(a1);
  }
  int fl = 0;
  for (int i = 0; i < n; i++) {
    if (col[i] == 0) {
      cur++;
      dfs1(i, cur);
      if (sum[cur] > 1) {
        if (w >= 0) {
          cout << 0 << endl;
          return 0;
        } else {
          w = i;
        }
        if (sum[cur] > 2) fl = 1;
      }
    }
  }
  if (w == -1 || fl == 0) {
    cout << 0 << endl;
    return 0;
  }
  dfs(w);
  int g = j;
  long long ans = g * (g - 1) / 2;
  cout << ans << endl;
}
