MOD = 10**9 + 7

def check(dp, connected, arr):
    con = uncon = 0
    for x, y in arr:
        if dp[x][y] == 2:
            if connected[x][y]:
                con += 1
            else:
                uncon += 1
    if not con and uncon == 1:
        return True
    return False



def main():
    n, m = map(int, input().split())
    dp = [[0 for _ in range(m)] for _ in range(n)]
    connected = [[False for _ in range(m)] for _ in range(n)]
    total = 0
    dp[0][0] = 2
    for i in range(n):
        arr = []
        for j in range(m):
            if j > 0:
                left = dp[i][j-1]
                arr.append((i, j-1))
            else:
                left = 1

            if i > 0:
                top = dp[i-1][j]
                arr.append((i-1, j))
            else:
                top = 1

            if i > 0 and j > 0:
                top_left = dp[i-1][j-1]
                arr.append((i-1, j-1))
            else:
                top_left = 1
            
            if i > 0 and j < m - 1:
                top_right = dp[i-1][j+1]
                arr.append((i-1, j+1))
            else:
                top_right = 1


            if left == top == top_left == top_right == 1:
                dp[i][j] = 2
            elif check(dp, connected, arr):
                dp[i][j] = 2
                connected[i][j] = True
            else:
                dp[i][j] = 1
            total += dp[i][j]
    print(dp)
    return total % MOD

print(main())
