import sys
sys.setrecursionlimit(10**9)
d = {}
d[1] = 2
d[2] = 4
mod = pow(10,9) + 7
def cal(n):
	return pow(2,n,mod) - pow(2,n-1,mod) + 2



n,m = map(int,raw_input().split())

if n == 1 and m == 1:
	print 2
	exit()
if n == 1:
	print cal(m)
	exit()
if m == 1:
	print cal(n)
	exit()

print (cal(n) + cal(m) - 2)%(mod)