#include<bits/stdc++.h>
using namespace std;
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	int n,m,i,a,b;
	cin>>n>>m;
	for (i=1;i<=m;i++){
		cin>>a>>b;
	}
	cout<<n*m*n*m%1000000007<<endl;
}