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;
const int MaxN = 2000006;
const int MaxM = MaxN << 1;
struct Edge {
  int u;
  int to, next;
};
Edge E[MaxN << 1];
int head[MaxN], Ecou;
int LOW[MaxN], DFN[MaxN];
int couBridge;
bool bridge[MaxM], cutp[MaxN];
int add_block[MaxN];
int Index;
void Tarjan(int u, int pre) {
  int v;
  int couSon = 0;
  LOW[u] = DFN[u] = ++Index;
  for (int i = head[u]; i != -1; i = E[i].next) {
    v = E[i].to;
    if (v == pre) continue;
    if (!DFN[v]) {
      ++couSon;
      Tarjan(v, u);
      if (LOW[v] < LOW[u]) LOW[u] = LOW[v];
      if (DFN[u] < LOW[v]) {
        bridge[i] = 1;
        bridge[i ^ 1] = 1;
        ++couBridge;
      }
      if (u != pre && DFN[u] <= LOW[v]) {
        cutp[u] = 1;
        ++add_block[u];
      }
    } else if (DFN[v] < LOW[u])
      LOW[u] = DFN[v];
  }
  if (u == pre && couSon > 1) {
    cutp[u] = 1;
    add_block[u] = couSon - 1;
  }
}
void check(int str, int n) { Tarjan(str, str); }
int N, M;
void init() {
  Ecou = 0;
  memset(head, -1, sizeof(head));
}
inline void addEdge(int u, int v) {
  E[Ecou].to = v;
  E[Ecou].next = head[u];
  E[Ecou].u = u;
  head[u] = Ecou++;
}
bool vis[MaxN];
queue<int> que;
inline int bfs(int u) {
  while (!que.empty()) que.pop();
  vis[u] = 1;
  que.push(u);
  int ret = 0;
  while (!que.empty()) {
    u = que.front();
    que.pop();
    for (int i = head[u]; i != -1; i = E[i].next) {
      ret = 1;
      if (!vis[E[i].to]) {
        vis[E[i].to] = 1;
        que.push(E[i].to);
      }
    }
  }
  return ret;
}
long long du[MaxN], zi, du1, isz[MaxN], du2, sss;
long long getans() {
  long long ret = 0;
  ret += zi * (zi - 1LL) / 2LL;
  for (int i = 0; i < Ecou; i += 2) {
    if (E[i].u == E[i].to) continue;
    if (bridge[i] == 0) ++sss;
  }
  for (int u = 1; u <= N; ++u)
    if (isz[u]) {
      ret += sss;
      if (du[u] == 1) ++ret;
    }
  for (int u = 1; u <= N; ++u) {
    long long du1 = 0, du1z = 0;
    long long du2 = 0;
    for (int i = head[u]; i != -1; i = E[i].next) {
      if (E[i].to == u) continue;
      if (du[E[i].to] == 1)
        ++du1;
      else if (du[E[i].to] > 1)
        ++du2;
      if (du[E[i].to] == 1 && isz[E[i].to] == 0) ++du1z;
    }
    if (du1 + du2 < 2) continue;
    if (du1 == 0) {
      if (du2 == 2 && isz[u] == 0 && cutp[u] == 0) {
        ++ret;
      }
    }
    if (du1 == 1) {
      if (du2 == 1 && isz[u] == 0 && du1z == 1)
        ++ret;
      else
        continue;
    }
    if (du1 > 1) {
      ret += du1z * (du1z - 1LL) / 2LL;
      ret += (du1 - du1z) * du1z;
    }
  }
  return ret;
}
int main() {
  int a, b;
  scanf("%d %d", &N, &M);
  init();
  for (int i = 1; i <= M; ++i) {
    scanf("%d %d", &a, &b);
    addEdge(a, b);
    addEdge(b, a);
    if (a != b) {
      ++du[a];
      ++du[b];
    } else
      ++zi, isz[a] = 1;
  }
  for (int i = 1; i <= N; ++i) {
    if (du[i] == 1 && isz[i] == 0) ++du1;
    if (du[i] > 1) ++du2;
  }
  int cou = 0;
  int rem = -1;
  for (int i = 1; i <= N; ++i)
    if (!vis[i])
      if (bfs(i)) {
        ++cou;
        rem = i;
      }
  check(rem, N);
  if (cou > 1)
    puts("0");
  else
    printf("%I64d\n", getans());
  return 0;
}
