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;
template <class T, class U>
inline void relax_min(T &a, U b) {
  a = min(a, b);
}
template <class T, class U>
inline void relax_max(T &a, U b) {
  a = max(a, b);
}
template <typename T>
inline bool updmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
inline bool updmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <class T, class U>
istream &operator>>(istream &in, pair<T, U> &a) {
  in >> a.first >> a.second;
  return in;
}
template <class T, class U>
ostream &operator<<(ostream &out, const pair<T, U> &a) {
  out << a.first << ' ' << a.second;
  return out;
}
template <class T>
istream &operator>>(istream &in, vector<T> &a) {
  for (decltype(0)((i)) = (0); ((i)) < ((((int)(a).size()))); ++((i)))
    in >> a[i];
  return in;
}
template <class T>
ostream &operator<<(ostream &out, const vector<T> &a) {
  for (decltype(0)((i)) = (0); ((i)) < ((((int)(a).size()))); ++((i)))
    out << a[i] << ' ';
  return out;
}
int next_int() {
  int(tmp);
  scanf("%d", &(tmp));
  return tmp;
}
long long next_ll() {
  long long(tmp);
  scanf("%lld", &(tmp));
  return tmp;
}
long long modPow(long long a, long long b, long long MOD) {
  long long ret = 1;
  for (; b; b >>= 1) {
    if (b & 1)
      ret = ((((((long long)(ret) * (long long)(a))) % ((MOD))) + ((MOD))) %
             ((MOD)));
    a = ((((((long long)(a) * (long long)(a))) % ((MOD))) + ((MOD))) % ((MOD)));
  }
  return ret;
}
const long long EXACTLY_ONE_HUNDRED = 100;
const long long EXACTLY_ONE_THOUSAND = 1000;
const long long EXACTLY_ONE_MILLION = 1000 * 1000;
const long long EXACTLY_ONE_BILLION =
    EXACTLY_ONE_THOUSAND * EXACTLY_ONE_MILLION;
const int MAXN1 = (int)(EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + 3;
const int MAXN2 = (int)(2 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + 3;
const int MAXN3 = (int)(3 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + 3;
const int MAXN4 = (int)(4 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + 3;
const int MAXN5 = (int)(5 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + 3;
const int MAXN = MAXN3;
const int INF = (int)EXACTLY_ONE_BILLION + 7;
const int INF2 = 1 << 30;
const long long INFLL = 4LL * EXACTLY_ONE_BILLION * EXACTLY_ONE_BILLION + 7;
const long long INFLL2 = 1LL << 60;
const long double Pi = acos(-1.0);
const long double EPS = 1e-7;
const int MOD = (int)EXACTLY_ONE_BILLION + 7;
vector<vector<int> > g;
vector<bool> used;
void dfs(int v) {
  used[v] = true;
  for (int to : g[v]) {
    if (!used[to]) dfs(to);
  }
}
int main() {
  long long(n), (m);
  scanf("%lld%lld", &((n)), &((m)));
  g.resize(n);
  used.resize(n);
  long long cnt_same = 0;
  for (decltype(0)((i)) = (0); ((i)) < ((m)); ++((i))) {
    int(u), (v);
    scanf("%d%d", &((u)), &((v)));
    --u, --v;
    if (u ^ v) {
      g[u].push_back(v);
      g[v].push_back(u);
    }
    cnt_same += (u == v);
  }
  long long cnt = 0;
  for (decltype(0)((i)) = (0); ((i)) < ((n)); ++((i))) {
    if (!used[i]) {
      dfs(i);
      ++cnt;
    }
  }
  if (cnt >= 2) {
    cout << 0;
    return 0;
  }
  long long ans = 0;
  ans += cnt_same * (m - 1) - cnt_same * (cnt_same - 1) / 2;
  for (decltype(0)((i)) = (0); ((i)) < ((n)); ++((i))) {
    long long x = ((int)(g[i]).size());
    ans += x * (x - 1) / 2;
  }
  printf("%lld\n", (ans));
  return 0;
}
