#include <cstdio>
#include <vector>
using namespace std;

const int SIZE = 100005;
int depth[SIZE];
int A[SIZE], B[SIZE];
bool visited[SIZE];
vector<int> adj[SIZE];
int d0=1, d1=0;
int cnt = 0;
void dfs(int here){
	visited[here] = true;
	for(int i=0; i<adj[here].size(); i++){
		int next = adj[here][i];
		if(visited[next])
			continue;
		depth[next] = depth[here] + 1;
		if(depth[next] % 2 == 0)
			d0++;
		else
			d1++;
		dfs(next);
	}
}

int main(){
	int N, M;
	scanf("%d %d", &N, &M);
	for(int i=0; i<M; i++){
		scanf("%d %d", &A[i], &B[i]);
		adj[A[i]].push_back(B[i]);
		adj[B[i]].push_back(A[i]);
	}
	dfs(1);
	int i;
	for(i=0; i<M; i++){
		if(depth[A[i]] % 2 == depth[B[i]] % 2){
			printf("%lld\n", 1LL * N * (N - 1) / 2 - M);
			return 0;
		}
	}
	printf("%lld\n", 1LL * d1 * d0 - M);
}