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<pair<int, int>> adia[1000010];
vector<pair<int, int>> muchii;
int size[1000010];
int necritice[1000010];
bool critica[1000010];
int tata[1000010];
int g[1000010];
int h[1000010];
bool viz[1000010];
int find(int nod);
void unite(int a, int b);
int dfs(int nod);
int main() {
  ios_base ::sync_with_stdio(0);
  int n, a, b, m;
  cin >> n >> m;
  for (int i(1); i <= n; i++) tata[i] = i, g[i] = 1;
  while (m--) {
    cin >> a >> b;
    unite(a, b);
    int x = muchii.size();
    adia[a].push_back({b, x});
    if (a != b) adia[b].push_back({a, x});
    muchii.push_back({a, b});
  }
  int x = 0;
  for (int i(1); i <= n; i++) {
    if (adia[i].size() == 0) continue;
    int y = find(i);
    if (x == 0)
      x = y;
    else if (x != y) {
      cout << 0;
      return 0;
    }
  }
  h[muchii[0].first] = 2;
  dfs(muchii[0].first);
  long long ans(0);
  for (int i(0); i < (int)muchii.size(); i++) {
    if (critica[i]) continue;
    necritice[muchii[i].first]++;
    if (muchii[i].first != muchii[i].second) necritice[muchii[i].second]++;
  }
  for (int i(1); i <= n; i++) {
    size[i] = adia[i].size();
    ans += 1ll * necritice[i] * (size[i] - necritice[i]);
    ans += 1ll * necritice[i] * (necritice[i] - 1) / 2;
  }
  cout << ans;
  return 0;
}
int dfs(int nod) {
  viz[nod] = 1;
  int susmax = nod;
  int loctata = 1000001, tata = 0;
  for (auto i : adia[nod]) {
    if (h[i.first] == h[nod] - 1)
      loctata = i.second, tata = i.first;
    else {
      if (h[i.first]) {
        if (h[i.first] < h[susmax]) susmax = i.first;
      } else {
        h[i.first] = 1 + h[nod];
        int x = dfs(i.first);
        if (h[susmax] > h[x]) susmax = x;
      }
    }
  }
  if (susmax == nod && adia[nod].size() != 1 && adia[tata].size() != 1)
    critica[loctata] = 1;
  return susmax;
}
void unite(int a, int b) {
  a = find(a);
  b = find(b);
  if (a == b) return;
  if (g[a] > g[b])
    g[a] += g[b], tata[b] = a;
  else
    g[b] += g[a], tata[a] = b;
}
int find(int nod) {
  if (tata[tata[nod]] != tata[nod]) tata[nod] = find(tata[tata[nod]]);
  return tata[nod];
}
