#include <bits/stdc++.h>
using namespace std;
int N, M;
vector<pair<int, int> > G[1000000];
bool used[1000000];
int C[1000000];
void dfs(int x) {
  for (pair<int, int> &p : G[x]) {
    if (used[p.second]) continue;
    used[p.second] = true;
    dfs(p.first);
  }
}
signed main() {
  scanf("%d %d", &N, &M);
  int loops = 0;
  int root = 0;
  for (int i = 0; i < (M); i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--, v--;
    if (u == v)
      loops++;
    else {
      C[u]++;
      C[v]++;
    }
    G[u].push_back(pair<int, int>(v, i));
    G[v].push_back(pair<int, int>(u, i));
    root = u;
  }
  dfs(root);
  for (int i = 0; i < (M); i++) {
    if (!used[i]) {
      printf("0\n");
      return 0;
    }
  }
  long long c = (1LL * M * (M - 1) - 1LL * (M - loops) * (M - loops - 1));
  for (int i = 0; i < (N); i++) {
    c += 1LL * C[i] * (C[i] - 1);
  }
  c /= 2;
  printf("%lld\n", c);
  return 0;
}
