#include <iostream>
#define int long long

using namespace std;

const int MOD=1e9+7;

int pow(int x)
{
    if(x==0)
        return 1;
    if(x==1)
        return 2;
    if(x%2==0)
    {
        int ret=pow(x>>1);
        return (ret*ret)%MOD;
    }
    if(x%2==1)
    {
        int ret=pow(x>>1);
        return (ret*ret*2)%MOD;
    }
}

signed main()
{
    ios::sync_with_stdio(false);
    freopen("barrack.in","r",stdin);
    freopen("barrack.out","w",stdout);
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        int x,y;
        cin>>x>>y;
    }
    int p1=pow(n-2);
    p1=p1*n*(n-1)/2%MOD;
    int p2=pow(m);
    p2=p2*n%MOD;
    int ans=p1+p2;
    ans%=MOD;
    cout<<ans;
}//I don't know.--by famous JCY
//10point.
