#include<bits/stdc++.h>
using namespace std;
long long n,m,a,b,T,k,he[500005],r[500005],ne[2000006],q[2000006],f[2000006],tmp,cnt,w[500005],p[500005];
void add(int x,int y) {
	tmp++;
	ne[tmp]=he[x];
	he[x]=tmp;
	f[tmp]=y;
}
int op;
long long ans;
void targen(int x) {
	p[x]=1;
	cnt++;
	w[x]=x;
	for(int i=he[x]; i!=-1; i=ne[i]) {
		if(q[i]==0) {
			if(p[f[i]]==0) {
				if(i%2==1){
					q[i]=1;
					q[i+1]=1;
				}else{
					q[i]=1;
					q[i-1]=1;
				}
				targen(f[i]);
			} else {
				op=w[f[i]];
			}
		}
		
	}
	if(op!=w[x])
		w[x]=op;
}
int main() {
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i=1; i<=n; i++)he[i]=-1;
	for(int i=1; i<=m; i++) {
		scanf("%d%d",&a,&b);
		add(a,b);
		add(b,a);
	}
	for(int i=n;i>=1;i--){
		ans+=pow(i,2);
	}
	cout<<ans;
	return 0;
}
