#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

const int maxn = 100100;
vector<int> g[maxn];
int col[maxn];

bool FAIL = false;
ll cnt[3];

void dfs(int u, int c = 1) {
  col[u] = c;
  ++cnt[c];
  for (int v : g[u]) {
    if (col[v]) {
      if (col[v] == col[u]) {
        FAIL = true;
      }
    } else {
      dfs(v, 3 - c);
    }
  }
}

signed main() {
#ifdef LOCAL
  assert(freopen("c.in", "r", stdin));
#endif
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(0);
  if (FAIL) {
    cout << ll(n) * (n - 1) / 2 - m << '\n';
  } else {
    cout << cnt[1] * cnt[2] - m << '\n';
  }
}