#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T>inline void read(T &x){
	x=0;int f=1;
	char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')ch=getchar(),f=-1;
	while(ch>='0'&&ch<='9')x=x*10+(ch^48),ch=getchar();
	x*=f;
	return;
}
const int mod=1e9+7;
inline ll q_pow(ll a,int b){
	ll ret=1;
	for(;b;b>>=1,a=a*a%mod)ret=ret*(b&1?a:1)%mod;
	return ret;
}
int n,m;
signed main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	read(n);
	read(m);
	printf("%lld\n",(q_pow((ll)2,n+m)-n-m+mod)%mod);
	return 0;
}

