#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 6;
long long deg[N], deg1[N];
vector<long long> adj[N];
long long visited[N];
pair<long long, long long> p[N];
void dfs(long long u) {
  visited[u] = 1;
  for (auto v : adj[u]) {
    if (visited[v] == false) dfs(v);
  }
}
int main() {
  long long n, m, x, y, loop = 0;
  scanf("%lld %lld", &n, &m);
  for (long long i = 0; i < m; i++) {
    scanf("%lld %lld", &x, &y);
    x--, y--;
    deg1[x]++;
    deg1[y]++;
    if (x != y) {
      deg[y]++;
      deg[x]++;
    } else
      loop++;
    if (x != y) {
      adj[x].push_back(y);
      adj[y].push_back(x);
    }
    p[i].first = x;
    p[i].second = y;
  }
  long long ans = 0;
  long long cc = 0;
  for (long long i = 0; i < n; i++) {
    if (visited[i] == false && deg1[i] != 0) {
      cc++;
      if (cc == 2) {
        printf("0\n");
        return 0;
      }
      dfs(i);
    }
  }
  for (long long i = 0; i < m; i++) {
    if (p[i].first != p[i].second)
      ans += (long long)(deg[p[i].first] + deg[p[i].second] - 2);
  }
  ans /= 2;
  ans += (loop * 1LL * (m - loop)) + (loop * (loop - 1)) / 2;
  printf("%lld\n", ans);
  return 0;
}
