import sys
import math
from collections import defaultdict,deque
import heapq
mod=10**9+7
n,m=map(int,sys.stdin.readline().split())
dps=[[0,0] for _ in range(m)]
dpd=[[0,0] for _ in range(m)]
dps[0]=[0,0]
dpd[0]=[1,1]
for i in range(1,m):
	dpd[i][0]=(dps[i-1][1]+dpd[i-1][1])%mod
	dpd[i][1]=(dps[i-1][0]+dpd[i-1][0])%mod
	dps[i][0]=dpd[i-1][0]%mod
	dps[i][1]=dpd[i-1][1]%mod
# print(dpd,'dpd')
# print(dps,'dps')
ans=(dps[m-1][0]+dps[m-1][1]+dpd[m-1][0]+dpd[m-1][1]-2)%mod
ans+=pow(2,n,mod)
print(ans)