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>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int mod = (int)1e9 + 7, inf = 0x3fffffff, rx[] = {-1, 0, 1, 0},
          ry[] = {0, 1, 0, -1};
const long long INF = 1ll << 60;
const double pi = acos(-1), eps = 1e-8;
template <class T>
void rd(T &res) {
  res = 0;
  int ch, sign = 0;
  while ((ch = getchar()) != '-' && !(ch >= '0' && ch <= '9'))
    ;
  if (ch == '-')
    sign = 1;
  else
    res = ch - '0';
  while ((ch = getchar()) >= '0' && ch <= '9')
    res = (res << 3) + (res << 1) + ch - '0';
  res = sign ? -res : res;
}
template <class T>
void rec_pt(T x) {
  if (!x) return;
  rec_pt(x / 10);
  putchar(x % 10 ^ 48);
}
template <class T>
void pt(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (!x)
    putchar('0');
  else
    rec_pt(x);
}
template <class T>
inline void ptn(T x) {
  pt(x), putchar('\n');
}
template <class T>
inline void Max(T &a, T b) {
  if (b > a) a = b;
}
template <class T>
inline void Min(T &a, T b) {
  if (b < a) a = b;
}
template <class T>
inline T mgcd(T b, T d) {
  return b ? mgcd(d % b, b) : d;
}
struct node {
  int from, to, next;
} edge[2 * 200110];
vector<int> mat[100100];
int n, m;
int savex[200110], savey[200110];
int cnt, pre[100100];
bool mark[2 * 200110];
bool save[2 * 200110];
int low[100100];
int mylink[100100];
long long d[100100];
long long ans;
int one_graph_cnt;
int have_self_cycle[100100];
void add_edge(int u, int v) {
  edge[cnt].to = v;
  edge[cnt].from = u;
  edge[cnt].next = pre[u];
  pre[u] = cnt++;
}
void dfs(int s, int num) {
  low[s] = num;
  int mi = num;
  for (int p = pre[s]; p != -1; p = edge[p].next) {
    int v = edge[p].to;
    if (mark[p] == 1) continue;
    if (low[v] == -1) {
      mark[p] = 1;
      mark[p ^ 1] = 1;
      dfs(v, num + 1);
      if (low[v] > num) {
        save[p] = 1;
        save[p ^ 1] = 1;
      }
    }
    mi = min(mi, low[v]);
  }
  low[s] = mi;
}
void dfs1(int s, int num) {
  mylink[s] = num;
  ans += (long long)d[s] * (d[s] - 1) / 2;
  mark[s] = 1;
  for (int p = pre[s]; p != -1; p = edge[p].next) {
    int v = edge[p].to;
    if (mark[v] == 1 || save[p] == 1) continue;
    dfs1(v, num);
  }
}
void init() {
  cnt = 0;
  memset(pre, -1, sizeof(pre));
}
void connect_dfs(int s, int fa, int &graph_cnt) {
  mark[s] = 1;
  for (int p = pre[s]; p != -1; p = edge[p].next) {
    int v = edge[p].to;
    graph_cnt++;
    if (mark[v] == 1) {
      continue;
    }
    connect_dfs(v, s, graph_cnt);
  }
}
int main() {
  init();
  scanf("%d%d", &n, &m);
  long long cycle_self = 0;
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    savex[i] = x;
    savey[i] = y;
    if (x != y) {
      d[x]++;
      d[y]++;
    } else {
      cycle_self++;
      have_self_cycle[x] = 1;
      continue;
    }
    add_edge(x, y);
    add_edge(y, x);
  }
  if (m == 1) {
    cout << 0;
    return 0;
  }
  memset(mark, 0, sizeof(mark));
  int flag_zero = 0;
  for (int i = 1; i < n; ++i) {
    int graph_cnt = 0;
    if (mark[i] == 0) {
      connect_dfs(i, 0, graph_cnt);
      if (graph_cnt > 1 || (have_self_cycle[i] && graph_cnt == 1)) {
        flag_zero++;
      }
    }
  }
  if (flag_zero > 1) {
    cout << 0;
    return 0;
  }
  for (int i = 1; i < n; ++i) {
    ans += (long long)d[i] * (d[i] - 1) / 2;
  }
  ans += cycle_self * (cycle_self - 1) / 2;
  for (int i = 1; i < n; ++i) {
    if (have_self_cycle[i] == 1) {
      ans += d[i];
    }
  }
  cout << ans;
  return 0;
}
