p, q = [int(i) for i in input().split()] mod = 10 ** 9 + 7 print((6 * (pow(2, p, mod) + pow(2, q, mod)) - 24) % mod)