#include<bits/stdc++.h>

using namespace std;

long long p=1e9+7;

int n,m;

long long a=1,b=1;

int main()
{
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	
	scanf("%d%d",&n,&m);
	
	for (int i=1;i<=n;i++)
	{
		a*=2;
		a=a-a/p*p;
	}
	
	for (int j=1;j<=m;j++)
	{
		b*=2;
		b=b-b/p*p;
	}
	
	printf("%lld",(a+b-1)-(a+b+1)/p*p);
	
	return 0;
}