#include <bits/stdc++.h>
using namespace std;
const int Mod=1e9+7;
const int maxn=5e5+5;
int n,m,x,y;
vector<int> G[maxn];
#define int long long

signed main()
{
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&x,&y);
		G[x].push_back(y);
		G[y].push_back(x); 
	}
	printf("%d\n",n*m); 
	return 0;
} 
