def power(x, y, p) :
    res = 1     # Initialize result
    x = x % p

    while (y > 0) :

        if ((y & 1) == 1) :
            res = (res * x) % p
        y = y >> 1      # y = y/2
        x = (x * x) % p

    return res
n,m=input().split(" ")
n=int(n)
m=int(m)
print(power(2,n*m-3,10**9+7))