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;
inline int _Int() {
  int x;
  scanf("%d", &x);
  return x;
}
long long int bigMod(long long int A, long long int P, int M) {
  long long int R = 1;
  for (A %= M; P; P >>= 1) {
    if (P & 1) R = (R * A) % M;
    A = (A * A) % M;
  }
  return R;
}
long long int bigMul(long long int A, long long int B, long long int M) {
  long long int R = 0;
  for (A %= M; B; B >>= 1) {
    if (B & 1) R = (R + A) % M;
    A = (A + A) % M;
  }
  return R;
}
long long int negMod(long long int A, long long int B) {
  return (((A % B) + B) % B);
}
long long int invMod(long long int A, long long int M) {
  return bigMod(A, M - 2, M);
}
unsigned long long int _pow(unsigned long long int A, int P) {
  unsigned long long int R = 1;
  for (; P; P >>= 1) {
    if (P & 1) R = (R * A);
    A = (A * A);
  }
  return R;
}
template <class T>
T GCD(T x, T y) {
  while (x) x ^= y ^= x ^= y %= x;
  return y;
}
template <class T>
bool inRng(T u, T v, T x) {
  return u <= x && x <= v;
}
const int M = 1000000 + 7;
vector<int> graph[M];
bool vis[M];
void dfs(int u) {
  if (vis[u]) return;
  vis[u] = 1;
  for (int i = graph[u].size() - 1; i >= 0; i--) {
    int v = graph[u][i];
    dfs(v);
  }
}
long long int tsl;
int sl[M];
void Main() {
  int n = _Int();
  int m = _Int();
  for (int i = 0; i < m; i++) {
    int u = _Int(), v = _Int();
    if (u == v) {
      sl[u]++;
      tsl++;
    } else {
      graph[u].push_back(v);
      graph[v].push_back(u);
    }
  }
  for (int i = 1; i <= n; i++) {
    if (graph[i].size()) {
      dfs(i);
      break;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[i] && graph[i].size()) {
      printf("0\n");
      return;
    }
  }
  unsigned long long int Ans = (tsl * (m - 1)) - ((tsl * (tsl - 1)) >> (1LL));
  unsigned long long int x, one = 1;
  for (int i = 1; i <= n; i++) {
    x = graph[i].size();
    Ans += ((x * (x - 1)) >> one);
  }
  printf("%llu\n", Ans);
}
int main() {
  Main();
  return 0;
}
