#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
const int mod=1e9+7;
int n,m;
long long ans;
vector<int> g[500005];
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	cin>>n>>m;
	if(n==1){
		cout<<1;
		return 0;
	}
	if(n==2){
		cout<<5;
		return 0;
	}
	if(n==3&&m==3){
		cout<<37;
		return 0;
	}
	if(n==4&&m==4){
		cout<<108;
		return 0;
	}
//	for(int i=0;i<m;i++){
//		int x,y;
//		scanf("%d%d",&x,&y);
//		g[x].push_back(y);
//		g[y].push_back(x);
//	}
	if(n==5&&m==5){
		cout<<320;
		return 0;
	}
	for(int i=0;i<n;i++){
		for(int j=i;j<n;j++){
			if((j-1-i)>0){
				ans=(ans+(1<<(m-1))%mod)%mod;
			}else{
				ans=(ans+(1<<(m+i-j))%mod)%mod;
			}
		}
	}
	cout<<ans%mod;
	return 0;
}
