#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 5;

#define int long long

int n, m;
vector<int> adj[N];
int color[N];
int f[2];
bool visit[N];

void dfs(int u,int col) {
	if (color[u]) {
		if (color[u] == col) {
			cout << n * (n - 1) / 2 - m << endl;
			exit(0);
		}
		return;
	}
	f[col - 1]++;
	color[u] = 3 - col;
	visit[u] = true;
	for (int v : adj[u]) {
		dfs(v, 3 - col);
	}
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin >> n >> m;
	for (int i = 0;i < m;++i) {
		int u, v; cin >> u >> v;
		adj[u].push_back(v), adj[v].push_back(u);
		
	}
	dfs(1, 1);
	cout << f[0] * f[1] - m << endl; 
}