n,m = [int(i) for i in input().split()]
if n==1 or m==1:
    if n>2 or m>2:
        if(max(n,m)==3):
            print(6)
    else:
        print(2**max(n,m))
else:
    print(pow(2,max(n,m),1000000007))
