MOD=10**9+7 P,Q=map(int,input().split()) ans=6*pow(2,P,MOD)+6*pow(2,Q,MOD)-4*3*2*1 ans%=MOD print(ans)