from __future__ import division, print_function

def main():
    h, w = input_as_list()

    dp = [2, 4]
    while len(dp) < w:
        dp.append((dp[-1]+dp[-2]) % MOD)

    print((dp[w-1] -2 + pow(2, h, MOD)) % MOD)
    

INF = float('inf')
MOD = 10 ** 9 + 7
__interactive = False

import os, sys
from atexit import register
from io import BytesIO
import itertools
import __pypy__

if sys.version_info[0] < 3:
    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

mulmod = __pypy__.intop.int_mulmod

if "LOCAL_" in os.environ:
    debug_print = print
else:
    if not __interactive:
        sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
        sys.stdout = BytesIO()
        register(lambda: os.write(1, sys.stdout.getvalue()))

        input = lambda: sys.stdin.readline().rstrip('\r\n')
    debug_print = lambda *x, **y: None

flush = sys.stdout.flush

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x
    
def input_as_list():
    return list(map(int, input().split()))

def input_as_matrix(n, m):
    return [input_as_list() for _ in range(n)]
    
def array_of(f, *dim):
    return [array_of(f, *dim[1:]) for _ in range(dim[0])] if dim else f()

def range_with_count(start, step, count):
    return range(start, start + step * count, step)

def indices(l, start=0, end=0):
    return range(start, len(l)+end)

def ceil_power_of_2(n):
    """ [0, 1, 2, 4, 4, 8, 8, 8, 8, 16, 16, ...] """
    return 2 ** ((n - 1).bit_length())

def ceil_div(x, r):
    """ = ceil(x / r) """
    return (x + r - 1) // r
    
main()