#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#define INF 100000000000000000LL
using namespace std;

int main()
{
	int n, m;
	int a, b;
	scanf("%d %d", &n, &m);
	vector<int> v[100000];
	for(int i=0; i<m; i++){
		scanf("%d %d", &a, &b);
		a--;
		b--;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	int c=0;
	vector<int> conn[100000];
	int d[100000], e[100000]={};
	fill(d, d+n, -1);
	set<int> st;
	for(int i=0; i<n; i++){
		st.insert(i);
	}
	vector<int> w;
	while(!st.empty()){
		auto begin=st.begin();
		w.push_back(*begin);
		conn[c].push_back(*begin);
		d[*begin]=0;
        if(v[*begin].empty()) e[c]=2;
		st.erase(begin);
		while(!w.empty()){
			int x=w.back();
			w.pop_back();
			for(int i=0; i<v[x].size(); i++){
				if(d[v[x][i]]==-1){
					d[v[x][i]]=(d[x]+1)%2;
				}else if(d[v[x][i]]==d[x]){
					e[c]=1;
				}
				if(st.find(v[x][i])==st.end()) continue;
				w.push_back(v[x][i]);
				conn[c].push_back(v[x][i]);
				st.erase(v[x][i]);
			}
		}
		c++;
	}
	long long int cn2=0, cn0=0, cn1=0, ans=0;
	for(int i=0; i<c; i++){
		if(e[i]==2){
			cn2++;
		}else if(e[i]==1){
			cn1++;
		}else{
			cn0++;
		}
	}
	for(int i=0; i<c; i++){
		if(e[i]==2){
          ans=ans+n;
		}else if(e[i]==1){
		  ans=ans+cn2*conn[i].size()+cn0+cn1;
		}else{
          ans=ans+cn2*conn[i].size()+2*cn0+cn1;
		}
	}
	long long int N=(long long int)n;
	printf("%lld\n", ans);
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100001,INF=1<<30;
vector<int> S[MAX],color(MAX,0),odd,even;

void DFS(int u){
    int cnt=1;
    bool ok=true;
    stack<int> ST;
    color[u]=1;
    ST.push(u);
    
    while(!ST.empty()){
        int a=ST.top();
        ST.pop();
        for(int i=0;i<S[a].size();i++){
            int b=S[a][i];
            if(color[b]==0){
                if(color[a]==1){
                    color[b]=2;
                    ST.push(b);
                    cnt++;
                }else{
                    color[b]=1;
                    ST.push(b);
                    cnt++;
                }
            }else if(color[a]==color[b]){
                ok=false;
            }
        }
    }
    
    if(ok) even.push_back(cnt);
    else odd.push_back(cnt);
    
    return;
}

int main(){
    
    int N,M;cin>>N>>M;
    for(int i=0;i<M;i++){
        int a,b;cin>>a>>b;
        a--;b--;
        S[a].push_back(b);
        S[b].push_back(a);
    }
    
    for(int i=0;i<N;i++){
        if(S[i].size()==0||color[i]) continue;
        DFS(i);
    }
    
    int rem=N;
    
    ll ans=0;
    
    for(int i=0;i<odd.size();i++){
        rem-=odd[i];
    }
    
    for(int i=0;i<even.size();i++){
        rem-=even[i];
    }
    
    ans+=odd.size()+even.size()*2;
    ans+=ll(N)*ll(N)-ll((N-rem))*ll((N-rem));
    
    ans+=ll(4)*ll(even.size())*ll((even.size()-1))/2;
    ans+=ll(2)*ll(even.size())*ll(odd.size());
    ans+=ll(2)*ll(odd.size())*ll((odd.size()-1))/2;
    
    cout<<ans<<endl;
    //cout<<rem<<" "<<odd.size()<<" "<<even.size()<<endl;
    
}


