
def main():
    
    n,m=readIntArr()
    
    # If we have all alternating (WBWB... or BWBW...) we have 2**(n-1) permutations each.
    # If there is any non-alternating sequence, we have only 1 permutation each.
    
    # Compute for 1 row
    dp=[[0,0] for _ in range(m)] # dp[i][same as prev]
    dp[0][0]=2
    dp[0][1]=0
    for i in range(1,m):
        dp[i][1]=dp[i-1][0]
        dp[i][0]=(dp[i-1][0]+dp[i-1][1])%MOD
    total=(dp[m-1][0]+dp[m-1][1]-2+pow(2,n,MOD)+MOD)%MOD
    print(total)
    
    return

import sys
input=sys.stdin.buffer.readline #FOR READING PURE INTEGER INPUTS (space separation ok)
# input=lambda: sys.stdin.readline().rstrip("\r\n") #FOR READING STRING/TEXT INPUTS.
 
def oneLineArrayPrint(arr):
    print(' '.join([str(x) for x in arr]))
def multiLineArrayPrint(arr):
    print('\n'.join([str(x) for x in arr]))
def multiLineArrayOfArraysPrint(arr):
    print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))
 
def readIntArr():
    return [int(x) for x in input().split()]
# def readFloatArr():
#     return [float(x) for x in input().split()]

def makeArr(defaultValFactory,dimensionArr): # eg. makeArr(lambda:0,[n,m])
    dv=defaultValFactory;da=dimensionArr
    if len(da)==1:return [dv() for _ in range(da[0])]
    else:return [makeArr(dv,da[1:]) for _ in range(da[0])]
 
def queryInteractive(i,j):
    print('? {} {}'.format(i,j))
    sys.stdout.flush()
    return int(input())
 
def answerInteractive(ans):
    print('! {}'.format(' '.join([str(x) for x in ans])))
    sys.stdout.flush()
 
inf=float('inf')
MOD=10**9+7
# MOD=998244353
 
 
for _abc in range(1):
    main()