Recently Ivan the Fool decided to become smarter and study the probability theory. He thinks that he understands the subject fairly well, and so he began to behave like he already got PhD in that area.

To prove his skills, Ivan decided to demonstrate his friends a concept of random picture. A picture is a field of $n$ rows and $m$ columns, where each cell is either black or white. Ivan calls the picture random if for every cell it has at most one adjacent cell of the same color. Two cells are considered adjacent if they share a side.

Ivan's brothers spent some time trying to explain that it's not how the randomness usually works. Trying to convince Ivan, they want to count the number of different random (according to Ivan) pictures. Two pictures are considered different if at least one cell on those two picture is colored differently. Since the number of such pictures may be quite large, print it modulo $10^9 + 7$.


-----Input-----

The only line contains two integers $n$ and $m$ ($1 \le n, m \le 100\,000$), the number of rows and the number of columns of the field.


-----Output-----

Print one integer, the number of random pictures modulo $10^9 + 7$.


-----Example-----
Input
2 3

Output
8



-----Note-----

The picture below shows all possible random pictures of size $2$ by $3$.  [Image]

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Dynamic programming

Combinatorics

Mathematics


Solutions:
def read_int():
	return int(input())

def read_str():
	return input().strip()

def solve(n, m):
	mod = 10 ** 9 + 7
	k = max(n, m) + 1
	count_1 = [0] * k
	count_2 = [0] * k
	count_1[1] = 1
	count_2[1] = 0
	for i in range(2, k):
		count_1[i] = (count_1[i - 1] + count_2[i - 1]) % mod
		count_2[i] = count_1[i - 1]
	return 2 * (count_1[n] + count_2[n] + count_1[m] + count_2[m] - 1 + mod) % mod
(n, m) = map(int, read_str().split())
res = solve(n, m)
print('%s' % res)


import sys, math, statistics as ss, collections as cc
input = sys.stdin.readline
(n, m) = map(int, input().split())
a = [1] + [0] * n
for i in range(1, n + 1):
	if i > 0:
		a[i] = (a[i] + a[i - 1]) % 1000000007
		if i > 1:
			a[i] = (a[i] + a[i - 2]) % 1000000007
b = [1] + [0] * m
for i in range(1, m + 1):
	if i > 0:
		b[i] = (b[i] + b[i - 1]) % 1000000007
		if i > 1:
			b[i] = (b[i] + b[i - 2]) % 1000000007
print(2 * (a[-1] + b[-1] - 1) % 1000000007)


import sys
(n, m) = map(int, input().split())
if n < m:
	(n, m) = (m, n)
if n == 1 and m == 1:
	print(2)
elif n == 2 and m == 2:
	print(6)
else:
	md = 1000000007

	def Fn(n):
		(a, b) = (1, 1)
		for i in range(2, n + 1):
			(a, b) = ((a + b) % md, a)
		return a
	print((2 * Fn(n) + 2 * Fn(m) - 2) % md)


(n, m) = list(map(int, input().split()))
mod = 10 ** 9 + 7
B = [1]
W = [1]
BB = [0]
WW = [0]
for i in range(1, 100010):
	x = W[-1] + WW[-1]
	y = B[-1] + BB[-1]
	z = B[-1]
	w = W[-1]
	x %= mod
	y %= mod
	z %= mod
	w %= mod
	B.append(x)
	W.append(y)
	BB.append(z)
	WW.append(w)
print((B[n - 1] + W[n - 1] + BB[n - 1] + WW[n - 1] + B[m - 1] + W[m - 1] + BB[m - 1] + WW[m - 1] - 2) % mod)


def task_1(n, m):
	counts = 8
	last = 0
	current = 1
	fn = fm = None
	for i in range(0, max(n, m) + 1):
		if n == i:
			fn = current
		if m == i:
			fm = current
		(last, current) = (current, last + current)
	counts = 2 * (fn + fm - 1)
	print(counts % (10 ** 9 + 7))

def __starting_point():
	(n, m) = map(int, input().rstrip().split())
	task_1(n, m)
__starting_point()


(n, m) = map(int, input().split())
dp = [0] * 100001
(dp[1], dp[2], mod) = (1, 2, 10 ** 9 + 7)
if n < m:
	(n, m) = (m, n)
for i in range(1, n + 1):
	if i > 2:
		dp[i] = (dp[i - 1] + dp[i - 2]) % mod
print((2 * (dp[n] + dp[m]) - 2) % mod)


(n, m) = [int(x) for x in input().split()]
dp = [0] * 100001
dp[0] = 2
dp[1] = 2
dp[2] = 4
for i in range(3, 100001):
	dp[i] = (dp[i - 1] * 2 - dp[i - 3]) % (10 ** 9 + 7)
print((dp[n] + dp[m] - 2) % (10 ** 9 + 7))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)

def toord(c):
	return ord(c) - ord('a')

def lcm(a, b):
	return a * b // lcm(a, b)
mod = 10 ** 9 + 7
INF = float('inf')
from math import factorial, sqrt, ceil, floor, gcd
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def main():
	(n, m) = RL()
	if n < m:
		(n, m) = (m, n)
	dp = [[0, 0] for _ in range(n + 1)]
	dp[1] = [1, 1]
	dp[0] = [1, 1]
	for i in range(2, n + 1):
		dp[i][0] = max(dp[i][1], (dp[i - 1][1] + dp[i - 2][1]) % mod)
		dp[i][1] = max(dp[i][0], (dp[i - 1][0] + dp[i - 2][0]) % mod)
	print((sum(dp[m]) + sum(dp[n]) - 2) % mod)
main()


M = 10 ** 9 + 7
array = [0] * 100001
array[0] = 1
array[1] = 1

def fib(n):
	if array[n] == 0:
		array[n] = (fib(n - 1) + fib(n - 2)) % M
	return array[n]
for i in range(1, 100001):
	fib(i)
(n, m) = map(int, input().split())
print((array[n] + array[m] - 1) * 2 % M)


(n, m) = map(int, input().split())
if n + m == 2:
	print(2)
	return
if n > m:
	(n, m) = (m, n)
(a, b, c, d) = (1, 1, 1, 1)
mod = 10 ** 9 + 7
for i in range(2, m):
	(a, b, c, d) = (c, a + c, b + d, b)
	a %= mod
	b %= mod
	c %= mod
	d %= mod
if n == 1:
	print((a + b + c + d) % mod)
	return
a1 = b1 = c1 = d1 = 1
for i in range(2, n):
	(a1, b1, c1, d1) = (c1, a1 + c1, b1 + d1, b1)
	a1 %= mod
	b1 %= mod
	c1 %= mod
	d1 %= mod
print((a + b + c + d + a1 + b1 + c1 + d1 - 2 + mod) % mod)


import sys
(a, b) = map(int, sys.stdin.readline().split())
pp = pow(10, 9) + 7
fib = [[0, 1], [1, 1]]

def MatDiv(a, b):
	res = [[0, 0], [0, 0]]
	res[0][0] = (a[0][0] * b[0][0] + a[0][1] * b[1][0]) % pp
	res[0][1] = (a[0][0] * b[0][1] + a[0][1] * b[1][1]) % pp
	res[1][0] = (a[1][0] * b[0][0] + a[1][1] * b[1][0]) % pp
	res[1][1] = (a[1][0] * b[1][0] + a[1][1] * b[1][1]) % pp
	return res

def BinPow(x, p):
	if p == 1:
		return fib
	res = BinPow(x, p // 2)
	if p % 2 == 0:
		return MatDiv(res, res)
	else:
		return MatDiv(MatDiv(res, res), x)
tmp = BinPow(fib.copy(), a)
tmp2 = BinPow(fib.copy(), b)
print(((tmp[0][0] + tmp[0][1] + tmp2[0][0] + tmp2[0][1]) * 2 - 2) % pp)


MOD = 10 ** 9 + 7
(n, m) = map(int, input().split())
fib = [1] * (max(n, m) + 2)
for i in range(2, max(n, m) + 2):
	fib[i] = fib[i - 1] + fib[i - 2]
	fib[i] %= MOD
print(((fib[m] + fib[n]) * 2 - 2) % MOD)


from sys import stdin, stdout

def scal(typ=int):
	return typ(stdin.readline())

def vec(typ=int):
	if isinstance(typ, list):
		inp = stdin.readline().split()
		return [typ[i](inp[i]) for i in range(len(inp))]
	else:
		return list(map(typ, stdin.readline().split()))
(n, m) = vec()
p = 1000000007
(a, b, res) = (0, 1, 0)
for i in range(1, max(m, n) + 1):
	(a, b) = (b, (a + b) % p)
	if i == m:
		res = (res + b) % p
	if i == n:
		res = (res + b) % p
res -= 1
if res < 0:
	res += p
res = res % p
res = 2 * res % p
print(res)


(n, m) = [int(i) for i in input().split()]

def fib(n):
	(a, b) = (1, 1)
	for i in range(n):
		(a, b) = (b, (a + b) % 1000000007)
	return a
res1 = 2 * (fib(n) + fib(m) - 1) % 1000000007
print(res1)


import sys

def modulo_div(a, b, modulo):
	if b == 1:
		return a % modulo
	return (a + modulo_div(-a, modulo % b, b) * modulo) // b % modulo
for line in sys.stdin.readlines():
	inputs = line.split()
	n = int(inputs[0])
	m = int(inputs[1])
numer = 1
denom = 1
sums = 0
modulo = 10 ** 9 + 7
import time
fibonacci = [1, 1]
for i in range(max(n, m) + 1):
	fibonacci.append((fibonacci[-1] + fibonacci[-2]) % modulo)
sums += (fibonacci[n] + fibonacci[m] - 1) * 2 % modulo
print(sums)


foo = []
(n, m) = input().split()
n = int(n)
m = int(m)
foo.append(1)
foo.append(1)
for i in range(max(n, m)):
	foo.append(foo[i + 1] + foo[i])
o = 2 * (foo[n] + foo[m] - 1)
print(o % 1000000007)


(n, m) = map(int, input().split())
a = [0] * 100001
Mod = 1000000007
(a[1], a[2]) = (2, 4)
for i in range(3, max(n, m) + 1):
	a[i] = (a[i - 1] + a[i - 2]) % Mod
print((a[n] + a[m] - 2) % Mod, flush=False)


arr = [2, 4]
(n, m) = map(int, input().split(' '))
for i in range(2, max(n, m)):
	arr.append(arr[i - 1] + arr[i - 2])
print((arr[n - 1] + arr[m - 1] - 2) % (10 ** 9 + 7))


N = int(100000.0 + 3)
MOD = int(1000000000.0 + 7)
memo = [0] * N

def dp():
	memo[0] = 2
	memo[1] = 2
	for i in range(2, N):
		memo[i] = (memo[i - 1] + memo[i - 2]) % MOD
(n, m) = map(int, input().split())
dp()
print((memo[n] + -1 + memo[m] - 1) % MOD)


import sys
from collections import defaultdict as dd
from itertools import permutations as pp
from itertools import combinations as cc
from collections import Counter as ccd
from random import randint as rd
from bisect import bisect_left as bl
from heapq import heappush as hpush
from heapq import heappop as hpop
mod = 10 ** 9 + 7

def ri(flag=0):
	if flag == 0:
		return [int(i) for i in sys.stdin.readline().split()]
	else:
		return int(sys.stdin.readline())
(n, m) = ri()
if n < m:
	(n, m) = (m, n)
if n == 1 and m == 1:
	print(2)
	sys.exit(0)
f = [1, 1]
N = 10 ** 5 + 10
for i in range(N):
	f.append(f[-1] + f[-2])
	f[-1] %= mod
l = [1, 3]
for i in range(N):
	l.append(l[-1] + l[-2])
	l[-1] %= mod
ans = f[m - 1] + l[m - 1] + 3 * f[n - 2] + l[n - 2] - 2
ans = ans % mod
print(ans)


(n, m) = [int(x) for x in input().split()]
p = 10 ** 9 + 7
x = [0] * max(n, m)
x[0:1] = [1, 2]
for i in range(2, max(n, m)):
	x[i] = (x[i - 1] + x[i - 2]) % p
print(2 * (x[n - 1] + x[m - 1] - 1) % p)


(n, m) = list(map(int, input().split()))
a = [0] * 100001
a[0] = 1
a[1] = 1
p = 1000000007
for i in range(2, 100001):
	a[i] = (a[i - 1] + a[i - 2]) % p
print((a[n] + a[m] - 1) * 2 % p)


mod = 10 ** 9 + 7
(n, m) = map(int, input().split())
dp = [[[0, 0] for j in range(2)] for i in range(m)]
dp[0] = [[1, 0], [1, 0]]
for i in range(m - 1):
	for j in range(2):
		for k in range(2):
			if j == 0 and k == 0:
				dp[i + 1][j][1] += dp[i][j][k]
				dp[i + 1][j + 1][0] += dp[i][j][k]
			elif j == 1 and k == 0:
				dp[i + 1][j][1] += dp[i][j][k]
				dp[i + 1][j - 1][0] += dp[i][j][k]
			elif j == 0 and k == 1:
				dp[i + 1][j + 1][0] += dp[i][j][k]
			else:
				dp[i + 1][j - 1][0] += dp[i][j][k]
	for j in range(2):
		for k in range(2):
			dp[i + 1][j][k] %= mod
ans = -2
for j in range(2):
	for k in range(2):
		ans += dp[m - 1][j][k]
		ans %= mod
dp2 = [[[0, 0] for j in range(2)] for i in range(n)]
dp2[0] = [[1, 0], [1, 0]]
for i in range(n - 1):
	for j in range(2):
		for k in range(2):
			if j == 0 and k == 0:
				dp2[i + 1][j][1] += dp2[i][j][k]
				dp2[i + 1][j + 1][0] += dp2[i][j][k]
			elif j == 1 and k == 0:
				dp2[i + 1][j][1] += dp2[i][j][k]
				dp2[i + 1][j - 1][0] += dp2[i][j][k]
			elif j == 0 and k == 1:
				dp2[i + 1][j + 1][0] += dp2[i][j][k]
			else:
				dp2[i + 1][j - 1][0] += dp2[i][j][k]
	for j in range(2):
		for k in range(2):
			dp2[i + 1][j][k] %= mod
for j in range(2):
	for k in range(2):
		ans += dp2[n - 1][j][k]
		ans %= mod
print(ans)


(n, m) = map(int, input().split())
a = [0] * 10 ** 6
(a[1], a[2]) = (2, 4)
for i in range(3, max(n, m) + 1):
	a[i] = a[i - 1] + a[i - 2]
print((a[n] + a[m] - 2) % (10 ** 9 + 7))


(n, m) = map(int, input().split())
a = [0] * 10 ** 6
Mod = int(pow(10, 9) + 7)
(a[1], a[2]) = (2, 4)
for i in range(3, max(n, m) + 1):
	a[i] = (a[i - 1] + a[i - 2]) % Mod
print((a[n] + a[m] - 2) % Mod, flush=False)


Mod = 1000000007

def f(x):
	a = 0
	b = 2
	for i in range(x):
		b = (a + b) % Mod
		a = (b - a) % Mod
	return b % Mod
(n, m) = map(int, input().split())
print((f(n) + f(m) - 2) % Mod)


f = []
f.append(1)
f.append(1)
mod = 1000000000.0 + 7
for i in range(100010):
	f.append((f[-1] + f[-2]) % mod)
(n, m) = map(int, input().split())
print(int(2 * (f[n] + f[m] - 1) % mod))


(n, m) = list(map(int, input().split()))

def fib(n):
	if n < 2:
		return 1
	a = 1
	b = 1
	for i in range(2, n + 1):
		c = a + b
		a = b
		b = c
	return c
print((2 * fib(n) + 2 * fib(m) - 2) % (10 ** 9 + 7))


MOD = int(1000000000.0 + 7)

def f(n):
	global MOD
	li = [1, 2, 0]
	for i in range(2, n):
		li[i % 3] = li[(i - 1) % 3] + li[(i - 2) % 3] % MOD
	return li[(n - 1) % 3]
(n, m) = map(int, input().split())
print(2 * (f(n) + f(m) - 1) % MOD)


from sys import stdin
input = lambda : stdin.readline().strip()
lin = lambda : list(map(int, input().split()))
iin = lambda : int(input())
main = lambda : map(int, input().split())
from math import ceil, sqrt, factorial, log
from collections import deque
from bisect import bisect_left
mod = 998244353
mod = 1000000007

def gcd(a, b):
	(a, b) = (max(a, b), min(a, b))
	while a % b != 0:
		(a, b) = (b, a % b)
	return b

def moduloinverse(a):
	return pow(a, mod - 2, mod)

def solve(we):
	(n, m) = main()
	fib = [1, 1]
	for i in range(max(n, m) + 3):
		fib.append((fib[-1] + fib[-2]) % mod)
	print(2 * (fib[n] + fib[m] - 1) % mod)
qwe = 1
for _ in range(qwe):
	solve(_ + 1)


import sys, math, queue, collections
MOD = 10 ** 9 + 7
sys.setrecursionlimit(1000000)
(n, m) = map(int, input().split())
N = max(n, m) + 5
black_pb = [0 for i in range(N)]
white_pb = [0 for i in range(N)]
black_ok = [1 for i in range(N)]
white_ok = [1 for i in range(N)]
for i in range(2, N):
	black_ok[i] = (white_pb[i - 1] + white_ok[i - 1]) % MOD
	white_ok[i] = (black_pb[i - 1] + black_ok[i - 1]) % MOD
	black_pb[i] = black_ok[i - 1]
	white_pb[i] = white_ok[i - 1]
ans = (black_ok[n] + black_pb[n] + white_ok[n] + white_pb[n]) % MOD
ans = (ans + MOD - 2 + black_ok[m] + black_pb[m] + white_ok[m] + white_pb[m]) % MOD
print(ans)


nm = 10 ** 9 + 7
(n, m) = map(int, input().split())
mi = max(n, m)
fb = [0] * (mi + 2)
fb[1] = 1
for i in range(2, mi + 2):
	fb[i] = (fb[i - 1] + fb[i - 2]) % nm
print(2 * (fb[n + 1] + fb[m + 1] - 1) % nm)


import sys
M = 10 ** 9 + 7
array = [0] * 100010
array[0] = 1
array[1] = 1

def f(n):
	if array[n] == 0:
		array[n] = (f(n - 1) + f(n - 2)) % M
	return array[n]
for i in range(1, 100010):
	f(i)
(a, b) = map(int, input().split())
print((f(a) + f(b) - 1) * 2 % M)


mod = pow(10, 9) + 7
dp = [1, 1]
for i in range(100005):
	dp.append((dp[-1] % mod + dp[-2] % mod) % mod)
(n, m) = map(int, input().split())
print(2 * (dp[n] + dp[m] - 1) % mod % mod)


(m, n) = list(map(int, input().split()))
mm = max(m, n)
dp = [0] * (mm + 1)
dp[0] = 1
dp[1] = 1
for i in range(2, mm + 1):
	dp[i] = (dp[i - 1] + dp[i - 2]) % (10 ** 9 + 7)
print((dp[m] + dp[n] - 1) * 2 % (10 ** 9 + 7))


(n, m) = map(int, input().split())
l = list()
l.append(1)
l.append(1)
for i in range(2, 100001):
	l.append((l[i - 2] + l[i - 1]) % (10 ** 9 + 7))
print(2 * (l[n] + l[m] - 1) % (10 ** 9 + 7))


Array = [0, 1]

def fibonacci(n):
	a = 0
	b = 1
	if n == 0:
		return a
	elif n == 1:
		return b
	else:
		for _ in range(2, n):
			c = a + b
			a = b
			b = c
		return b
(n, m) = list(map(int, input().split()))
print(2 * (fibonacci(n + 2) + fibonacci(m + 2) - 1) % 1000000007)


P = 10 ** 9 + 7
(n, m) = tuple([int(x) for x in input().split()])
mx = max(n, m)
vals = []
for i in range(mx):
	if i == 0 or i == 1:
		vals.append(i + 1)
	else:
		new_val = (vals[-1] + vals[-2]) % P
		vals.append(new_val)
x = (vals[n - 1] + vals[m - 1]) % P
x = (x - 1) % P
x = x * 2 % P
print(x)


import sys
input = sys.stdin.readline

def read_i():
	return list(map(int, input().split()))

class Combinations:

	def __init__(self, max_num, mod):
		self.mod = mod
		self.factorials = [1]
		for i in range(1, max_num + 1):
			self.factorials.append(self.factorials[-1] * i % mod)
		self.invs = [pow(self.factorials[-1], mod - 2, mod)]
		for i in reversed(range(1, max_num + 1)):
			self.invs.append(self.invs[-1] * i % mod)
		self.invs = self.invs[::-1]

	def __call__(self, n, k):
		return self.factorials[n] * self.invs[k] * self.invs[n - k] % self.mod
(n, m) = read_i()
MOD = 10 ** 9 + 7
combinations = Combinations(max(n, m), MOD)
res = 0
for i in range(n // 2 + 1):
	res += combinations(n - i, i)
	res %= MOD
for i in range(m // 2 + 1):
	res += combinations(m - i, i)
	res %= MOD
res = 2 * (res - 1 + MOD) % MOD
print(res)


ai = [0] * 100100
bi = [0] * 100100
(n, m) = input().split()
n = int(n)
m = int(m)
ai[1] = 2
ai[2] = 4
len = max(n, m)
for i in range(3, 100100):
	ai[i] = (ai[i - 1] + ai[i - 2]) % 1000000007
print((ai[n] - 2 + ai[m]) % 1000000007)


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

def fib(x):
	a = 0
	b = 1
	temp = 0
	for i in range(0, x):
		temp = a + b
		a = b
		b = temp
	return temp
print(2 * (fib(n) + fib(m) - 1) % (10 ** 9 + 7))


(a, b) = map(int, input().split())
mod = 10 ** 9 + 7
ans = 0
for n in [a, b]:
	A = [[0, 0] for i in range(n)]
	A[0] = [0, 1]
	if n > 1:
		A[1] = [1, 1]
	for i in range(2, n):
		A[i][0] = sum(A[i - 2]) % mod
		A[i][1] = sum(A[i - 1]) % mod
	ans += sum(A[-1]) * 2 % mod
print((ans - 2) % mod)


MOD = 1000000007

def fib(n):
	a = b = 1
	for _ in range(n):
		(a, b) = (b, (a + b) % MOD)
	return a

def main():
	(n, m) = map(int, input().split())
	print((fib(n) + fib(m) - 1) * 2 % MOD)
main()


(r, c) = [int(i) for i in input().split()]
import operator as op
from functools import reduce, lru_cache

@lru_cache(maxsize=None)
def fib(n):
	if n == 0 or n == 1:
		return n
	else:
		return fib(n - 1) + fib(n - 2)

@lru_cache(maxsize=None)
def fibSum(n):
	count = 0
	for i in range(1, n):
		count += fib(i)
	return count

@lru_cache(maxsize=None)
def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom
f = [0, 1]
for i in range(2, max(r, c) + 2):
	f.append(f[i - 1] + f[i - 2])
	f[i] %= 1000000007
count = 1
count += f[r + 1] - 1
count += f[c + 1] - 1
count *= 2
count %= 1000000007
print(int(count))


mod = 10 ** 9 + 7
(n, m) = map(int, input().split())
fibo = [1, 2]
for i in range(3, max(m, n) + 1):
	fibo.append((fibo[-1] + fibo[-2]) % mod)
print(2 * (fibo[n - 1] + fibo[m - 1] - 1) % mod)


(N, M) = map(int, input().split())
P = 10 ** 9 + 7
F = [1, 2]
for i in range(max(N, M)):
	F.append((F[-1] + F[-2]) % P)
print((F[N - 1] + F[M - 1] - 1) * 2 % P)


(n, m) = [int(i) for i in input().split()]
f = [1, 1]
mod = 1000000007
for i in range(100005):
	f.append((f[-1] + f[-2]) % mod)
ans2 = 2 * f[m] + 2 * f[n] - 2
print(ans2 % mod)


(height, width) = list(map(int, input().split()))

def fib(n):
	if n < 2:
		return n
	(a, b) = [0, 1]
	for i in range(0, n):
		(a, b) = [b, a + b]
	return a

def solve(height, width):
	x = fib(width + 1) * 2
	return (x - 2 + fib(height + 1) * 2) % (pow(10, 9) + 7)
print(solve(height, width))


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

def create_dp(x):
	dp = [0 for _ in range(x)]
	dp[0] = 1
	if x == 1:
		return dp
	dp[1] = 2
	if x == 2:
		return dp
	for i in range(2, x):
		dp[i] = dp[i - 1] + dp[i - 2]
		dp[i] %= MOD
	return dp
MOD = 10 ** 9 + 7
cut_pattern = 0
dp = create_dp(max(n, m))
cut_pattern += dp[n - 1] * 2
cut_pattern += dp[m - 1] * 2
cut_pattern -= 2
cut_pattern %= MOD
print(cut_pattern)


(n, m) = map(int, input().split())
MOD = 1000000007
if n < m:
	(n, m) = (m, n)
dp = list()
dp.append(1)
dp.append(1)
for i in range(2, n + 1):
	dp.append((dp[i - 1] + dp[i - 2]) % MOD)
print((dp[n] + dp[m] + MOD - 1) * 2 % MOD)


(n, m) = map(int, input().split())
a = [0] * 10 ** 6
(_, a[1], a[2], i) = (10 ** 9 + 7, 2, 4, 3)
while i <= max(n, m):
	a[i] = a[i - 1] + a[i - 2]
	i += 1
print((a[n] + a[m] - 2) % _)


import os
import heapq
import sys
import math
import bisect
import operator
from collections import defaultdict
from io import BytesIO, IOBase

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def power(x, p, m):
	res = 1
	while p:
		if p & 1:
			res = res * x % m
		x = x * x % m
		p >>= 1
	return res

def inar():
	return [int(k) for k in input().split()]

def lcm(num1, num2):
	return num1 * num2 // gcd(num1, num2)

def main():
	(n, m) = inar()
	dp = [0] * 100100
	mod = 10 ** 9 + 7
	dp[1] = 2
	dp[2] = 4
	length = max(n, m)
	for i in range(3, 100100):
		dp[i] = (dp[i - 1] + dp[i - 2]) % mod
	print((dp[n] - 2 + dp[m]) % mod)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import stdin

def input():
	return stdin.readline()[:-1]

def intput():
	return int(input())

def sinput():
	return input().split()

def intsput():
	return map(int, sinput())
mod = 10 ** 9 + 7
(n, m) = intsput()
fib = [2, 2]
for _ in range(100001):
	fib.append((fib[-1] + fib[-2]) % mod)
print((fib[n] + fib[m] - 2) % mod)


import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
(n, m) = [int(item) for item in input().split()]
if n > m:
	(n, m) = (m, n)
if n == 1 and m == 1:
	print(2)
	exit()
dp = [[0] * m for _ in range(4)]
dp[0][1] = 1
dp[1][1] = 1
dp[2][1] = 1
dp[3][1] = 1
for i in range(2, m):
	dp[0][i] += dp[2][i - 1]
	dp[1][i] += dp[0][i - 1]
	dp[1][i] += dp[2][i - 1]
	dp[2][i] += dp[1][i - 1]
	dp[2][i] += dp[3][i - 1]
	dp[3][i] += dp[1][i - 1]
	dp[0][i] %= MOD
	dp[1][i] %= MOD
	dp[2][i] %= MOD
	dp[3][i] %= MOD
lr = 0
ud = 0
for i in range(4):
	lr += dp[i][m - 1]
	ud += dp[i][n - 1]
if n == 1:
	print(lr % MOD)
	exit()
else:
	print((lr + ud - 2) % MOD)


class ModComb:

	def __init__(self, MAX, mod=10 ** 9 + 7):
		fac = [1, 1]
		finv = [1, 1]
		inv = [0, 1]
		for i in range(2, MAX):
			fac.append(fac[i - 1] * i % mod)
			inv.append(mod - inv[mod % i] * (mod // i) % mod)
			finv.append(finv[i - 1] * inv[i] % mod)
		(self.fac, self.finv, self.mod) = (fac, finv, mod)

	def nCk(self, n, k):
		if n < k or n < 0 or k < 0:
			return 0
		(fac, finv, mod) = (self.fac, self.finv, self.mod)
		return fac[n] * (finv[k] * finv[n - k] % mod) % mod

def main():
	mod = 10 ** 9 + 7
	mc = ModComb(10 ** 5 + 7)
	(N, M) = map(int, input().split())
	ans = 0
	for i in range(1, N):
		ans += mc.nCk(N - i, i) % mod
	for i in range(1, M):
		ans += mc.nCk(M - i, i) % mod
	print((ans + 1) * 2 % mod)
main()


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(n, m) = list(map(int, input().split()))
z = 10 ** 9 + 7
fib = [0, 1, 2]
for i in range(3, max(n, m) + 1):
	fib.append((fib[-1] + fib[-2]) % z)
print(2 * ((fib[n] + fib[m] - 1) % z) % z)


import os
import sys
from io import BytesIO, IOBase
mod = 10 ** 9 + 7

def solve(x):
	dp = [[0, 0] for _ in range(x + 1)]
	dp[1] = [1, 1]
	dp[0] = [1, 1]
	for i in range(2, x + 1):
		dp[i][0] = (dp[i - 2][1] + dp[i - 1][1]) % mod
		dp[i][1] = (dp[i - 2][0] + dp[i - 1][0]) % mod
	return (dp[-1][0] + dp[-1][1]) % mod

def main():
	(n, m) = map(int, input().split())
	print((solve(n) + solve(m) - 2) % mod)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


mod = 10 ** 9 + 7

def getAns(maxSide):
	if maxSide == 1:
		return 2
	if maxSide == 2:
		return 4
	dpSide = [0] * maxSide
	for i in range(len(dpSide)):
		dpSide[i] = [0, 0]
	dpSide[0] = [1, 1]
	dpSide[1] = [2, 2]
	f = True
	for i in range(1, len(dpSide) - 1):
		dpSide[i + 1][0] += dpSide[i][1]
		dpSide[i + 1][1] += dpSide[i][0]
		dpSide[i + 1][1] += dpSide[i - 1][0]
		dpSide[i + 1][0] += dpSide[i - 1][1]
		dpSide[i + 1][0] %= mod
		dpSide[i + 1][1] %= mod
	return sum(dpSide[maxSide - 1]) % mod
(n, m) = map(int, input().split())
print((getAns(n) + getAns(m) - 2) % mod)


(n, m) = [int(x) for x in input().split()]
Fib = [0 for i in range(max(n, m) + 2)]
Fib[1] = 1
for i in range(2, max(n, m) + 2):
	Fib[i] = (Fib[i - 1] + Fib[i - 2]) % 1000000007
print((Fib[n + 1] + Fib[m + 1] - 1) * 2 % 1000000007)


import sys
import itertools
import math
import collections
from collections import Counter

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = prime[1] = False
	r = [p for p in range(n + 1) if prime[p]]
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)
FibArray = [0, 1]

def fib(n):
	if n <= len(FibArray):
		return FibArray[n - 1]
	else:
		temp_fib = fib(n - 1) + fib(n - 2)
		FibArray.append(temp_fib)
		return temp_fib

def count(n, k):
	total = k
	mod = 10 ** 9 + 7
	(same, diff) = (0, k)
	for i in range(2, n + 1):
		same = diff
		diff = total * (k - 1)
		diff = diff % mod
		total = (same + diff) % mod
	return total
mod = 10 ** 9 + 7
(n, m) = mi()
print((count(m, 2) + count(n, 2) - 2) % mod)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max, nsmallest, nlargest
INF = 999999999999999999999999
alphabets = 'abcdefghijklmnopqrstuvwxyz'

class SortedList:

	def __init__(self, iterable=[], _load=200):
		values = sorted(iterable)
		self._len = _len = len(values)
		self._load = _load
		self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
		self._list_lens = [len(_list) for _list in _lists]
		self._mins = [_list[0] for _list in _lists]
		self._fen_tree = []
		self._rebuild = True

	def _fen_build(self):
		self._fen_tree[:] = self._list_lens
		_fen_tree = self._fen_tree
		for i in range(len(_fen_tree)):
			if i | i + 1 < len(_fen_tree):
				_fen_tree[i | i + 1] += _fen_tree[i]
		self._rebuild = False

	def _fen_update(self, index, value):
		if not self._rebuild:
			_fen_tree = self._fen_tree
			while index < len(_fen_tree):
				_fen_tree[index] += value
				index |= index + 1

	def _fen_query(self, end):
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		x = 0
		while end:
			x += _fen_tree[end - 1]
			end &= end - 1
		return x

	def _fen_findkth(self, k):
		_list_lens = self._list_lens
		if k < _list_lens[0]:
			return (0, k)
		if k >= self._len - _list_lens[-1]:
			return (len(_list_lens) - 1, k + _list_lens[-1] - self._len)
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		idx = -1
		for d in reversed(range(len(_fen_tree).bit_length())):
			right_idx = idx + (1 << d)
			if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
				idx = right_idx
				k -= _fen_tree[idx]
		return (idx + 1, k)

	def _delete(self, pos, idx):
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len -= 1
		self._fen_update(pos, -1)
		del _lists[pos][idx]
		_list_lens[pos] -= 1
		if _list_lens[pos]:
			_mins[pos] = _lists[pos][0]
		else:
			del _lists[pos]
			del _list_lens[pos]
			del _mins[pos]
			self._rebuild = True

	def _loc_left(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(lo, pos) = (-1, len(_lists) - 1)
		while lo + 1 < pos:
			mi = lo + pos >> 1
			if value <= _mins[mi]:
				pos = mi
			else:
				lo = mi
		if pos and value <= _lists[pos - 1][-1]:
			pos -= 1
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value <= _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def _loc_right(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(pos, hi) = (0, len(_lists))
		while pos + 1 < hi:
			mi = pos + hi >> 1
			if value < _mins[mi]:
				hi = mi
			else:
				pos = mi
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value < _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def add(self, value):
		_load = self._load
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len += 1
		if _lists:
			(pos, idx) = self._loc_right(value)
			self._fen_update(pos, 1)
			_list = _lists[pos]
			_list.insert(idx, value)
			_list_lens[pos] += 1
			_mins[pos] = _list[0]
			if _load + _load < len(_list):
				_lists.insert(pos + 1, _list[_load:])
				_list_lens.insert(pos + 1, len(_list) - _load)
				_mins.insert(pos + 1, _list[_load])
				_list_lens[pos] = _load
				del _list[_load:]
				self._rebuild = True
		else:
			_lists.append([value])
			_mins.append(value)
			_list_lens.append(1)
			self._rebuild = True

	def discard(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_right(value)
			if idx and _lists[pos][idx - 1] == value:
				self._delete(pos, idx - 1)

	def remove(self, value):
		_len = self._len
		self.discard(value)
		if _len == self._len:
			raise ValueError('{0!r} not in list'.format(value))

	def pop(self, index=-1):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		value = self._lists[pos][idx]
		self._delete(pos, idx)
		return value

	def bisect_left(self, value):
		(pos, idx) = self._loc_left(value)
		return self._fen_query(pos) + idx

	def bisect_right(self, value):
		(pos, idx) = self._loc_right(value)
		return self._fen_query(pos) + idx

	def count(self, value):
		return self.bisect_right(value) - self.bisect_left(value)

	def __len__(self):
		return self._len

	def __getitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		return self._lists[pos][idx]

	def __delitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		self._delete(pos, idx)

	def __contains__(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_left(value)
			return idx < len(_lists[pos]) and _lists[pos][idx] == value
		return False

	def __iter__(self):
		return (value for _list in self._lists for value in _list)

	def __reversed__(self):
		return (value for _list in reversed(self._lists) for value in reversed(_list))

	def __repr__(self):
		return 'SortedList({0})'.format(list(self))

class SegTree:

	def __init__(self, n):
		self.N = 1 << n.bit_length()
		self.tree = [0] * (self.N << 1)

	def update(self, i, j, v):
		i += self.N
		j += self.N
		while i <= j:
			if i % 2 == 1:
				self.tree[i] += v
			if j % 2 == 0:
				self.tree[j] += v
			(i, j) = (i + 1 >> 1, j - 1 >> 1)

	def query(self, i):
		v = 0
		i += self.N
		while i > 0:
			v += self.tree[i]
			i >>= 1
		return v

def SieveOfEratosthenes(limit):
	isPrime = [True] * (limit + 1)
	isPrime[0] = isPrime[1] = False
	primes = []
	for i in range(2, limit + 1):
		if not isPrime[i]:
			continue
		primes += [i]
		for j in range(i * i, limit + 1, i):
			isPrime[j] = False
	return primes
from collections import Counter

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def memodict(f):

	class memodict(dict):

		def __missing__(self, key):
			ret = self[key] = f(key)
			return ret
	return memodict().__getitem__

def pollard_rho(n):
	if n & 1 == 0:
		return 2
	if n % 3 == 0:
		return 3
	s = (n - 1 & 1 - n).bit_length() - 1
	d = n >> s
	for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:
		p = pow(a, d, n)
		if p == 1 or p == n - 1 or a % n == 0:
			continue
		for _ in range(s):
			prev = p
			p = p * p % n
			if p == 1:
				return gcd(prev - 1, n)
			if p == n - 1:
				break
		else:
			for i in range(2, n):
				(x, y) = (i, (i * i + 1) % n)
				f = gcd(abs(x - y), n)
				while f == 1:
					(x, y) = ((x * x + 1) % n, (y * y + 1) % n)
					y = (y * y + 1) % n
					f = gcd(abs(x - y), n)
				if f != n:
					return f
	return n

@memodict
def prime_factors(n):
	if n <= 1:
		return Counter()
	f = pollard_rho(n)
	return Counter([n]) if f == n else prime_factors(f) + prime_factors(n // f)

def distinct_factors(n):
	factors = [1]
	for (p, exp) in prime_factors(n).items():
		factors += [p ** i * factor for factor in factors for i in range(1, exp + 1)]
	return factors

def all_factors(n):
	(small, large) = ([], [])
	for i in range(1, int(n ** 0.5) + 1, 2 if n & 1 else 1):
		if not n % i:
			small.append(i)
			large.append(n // i)
	if small[-1] == large[-1]:
		large.pop()
	large.reverse()
	small.extend(large)
	return small
	return ans

def main():
	mod = 1000000007
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = 1
	tc = 1
	for _ in range(tc):
		(n, m) = ria()
		fib = [0] * 100005
		fib[0] = 1
		fib[1] = 1
		for i in range(2, 100005):
			fib[i] = (fib[i - 1] + fib[i - 2]) % mod
		wi(2 * (fib[n] + fib[m] - 1) % mod)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


(n, m) = map(int, input().split())
d = [2, 4]
k = 10 ** 9 + 7
for i in range(2, max(n, m)):
	d += [(d[i - 1] + d[i - 2]) % k]
print((d[m - 1] + d[n - 1] - 2) % k)


from sys import stdin
(height, width) = map(int, stdin.readline().rstrip().split())

def fib(n):
	if n < 2:
		return n
	(a, b) = [0, 1]
	for i in range(0, n):
		(a, b) = [b, a + b]
	return a

def solve(height, width):
	x = fib(width + 1) * 2
	return (x - 2 + fib(height + 1) * 2) % (pow(10, 9) + 7)
print(solve(height, width))


(n, m) = list(map(int, input().split()))
max_element = max(n, m)
min_element = min(n, m)
dp = [2 for i in range(max_element + 1)]
for i in range(2, max_element + 1):
	dp[i] = dp[i - 1] + dp[i - 2]
print((dp[max_element] + dp[min_element] - 2) % (10 ** 9 + 7))


inputlist = list(map(int, input().split()))
m = inputlist[0]
k = inputlist[1]

def row(n):
	if n == 1:
		return 2
	elif n == 2:
		return 4
	else:
		i = 2
		a = 2
		b = 4
		while i < n:
			c = a + b
			a = b
			b = c
			i += 1
		return c
print((row(m) + row(k) - 2) % (10 ** 9 + 7))


(n, m) = map(int, input().split())
a = [0, 2]
mod = pow(10, 9) + 7
s = 0
t = 2
for i in range(2, 100002):
	u = (a[i - 1] * 2 % mod - s % mod) % mod
	if u < 0:
		u += mod
	a.append(u)
	s = t
	t = (u % mod - s % mod) % mod
	if t < 0:
		t += mod
print((a[n] % mod + a[m] % mod - 2) % mod)


import sys
input = sys.stdin.readline
mod = 10 ** 9 + 7
(n, m) = map(int, input().split())
dp = [1, 1]
for i in range(2, max(n, m) + 1):
	dp.append((dp[i - 1] + dp[i - 2]) % mod)
print(2 * (dp[n] + dp[m] - 1) % mod)


import sys
(n, m) = map(int, sys.stdin.readline().split())
f = [1, 1]
mod = 1000000007
for i in range(100000):
	f.append(f[-1] + f[-2])
res = 2 * (f[n] + f[m] - 1)
res %= mod
print(res)


a = list(map(int, input().split()))
T = max(a[0], a[1])
tab = [1 for k in range(T + 1)]
for k in range(2, T + 1):
	tab[k] = (tab[k - 1] + tab[k - 2]) % int(1000000000.0 + 7)
print(2 * (tab[a[0]] + tab[a[1]] - 1) % int(1000000000.0 + 7))


(n, m) = map(int, input().split())
mod = 1000000007
record = {}
(a, b) = (1, 1)
for d in range(max(n, m) + 1):
	(a, b) = (b % mod, a + b)
	record[d + 1] = a
ans = record[n] + record[m] - 1
print(ans * 2 % mod)


import sys
input = sys.stdin.buffer.readline
from collections import defaultdict
INF = float('inf')
con = 1000000007

def getlist():
	return list(map(int, input().split()))

def main():
	(N, M) = getlist()
	DP1 = [0] * 100001
	DP2 = [0] * 100001
	DP1[0] = 1
	DP1[1] = 1
	DP2[0] = 0
	DP2[1] = 1
	for i in range(2, 100001):
		DP1[i] = (DP1[i - 1] + DP2[i - 1]) % con
		DP2[i] = DP1[i - 1] % con
	ans = (DP1[N - 1] + DP1[M - 1] + DP2[N - 1] + DP2[M - 1]) * 2 - 2
	print(ans % con)
main()


dp = []
dp.append(2)
dp.append(4)
dp.append(6)
for i in range(3, 100001):
	dp.append((dp[i - 1] + dp[i - 2]) % 1000000007)
(n, m) = map(int, input().split())
ans = dp[m - 1]
ans += dp[n - 1] - 2
print(ans % 1000000007)


from sys import stdin
(n, m) = [int(i) for i in stdin.readline().strip().split()]
s = min(n, m)
t = max(n, m)
c = (t + 1) * [2]
for i in range(2, t + 1):
	c[i] = c[i - 1] + c[i - 2]
res = c[t] + c[s] - 2
print(res % (10 ** 9 + 7))


MOD = 1000000007
(n, m) = map(int, input().split())
L = [1, 2, 3, 5, 8, 14, 21, 34, 55, 89]
for i in range(n):
	t = (L[-1] + L[-2]) % MOD
	L.append(t % MOD)
dp = []
dp.append(L[n - 1] * 2 % MOD)
for i in range(2):
	t = (dp[-1] + 2) % MOD
	dp.append(t % MOD)
for i in range(m):
	t1 = 2 * dp[-1] % MOD
	t2 = dp[-3] % MOD
	t = (t1 - t2) % MOD
	dp.append(t % MOD)
print(dp[m - 1] % MOD)


from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf
mod = 10 ** 9 + 7
import sys
sys.setrecursionlimit(10 ** 9)
(n, m) = map(int, input().split())
dp = [0] * (n + m + 1)
dp[1] = 1
dp[0] = 0
for i in range(2, n + m + 1):
	dp[i] = dp[i - 1] % mod + dp[i - 2] % mod
	dp[i] %= mod
print(2 * (dp[n + 1] + dp[m + 1] - 1) % mod)


(a, b) = map(int, input().split())
t = max(a, b)
j = min(a, b)
(a, b) = (t, j)
dp = [2, 4]
for i in range(2, a + 1):
	dp.append(0)
if a < 3:
	row = dp[a - 1]
else:
	for i in range(2, a):
		dp[i] = dp[i - 1] + dp[i - 2]
	row = dp[a - 1]
if b - 2 < 0:
	print(row % (10 ** 9 + 7))
else:
	print((row + dp[b - 1] - 2) % (10 ** 9 + 7))


a = input().split(' ')
x = int(a[0])
y = int(a[1])
n = 2
m = 2
A = 1000000000 + 7
while x > 1:
	m = (m % A + n % A) % A
	n = (m % A - n % A) % A
	x -= 1
r1 = m
m = 2
n = 2
while y > 1:
	m = (m % A + n % A) % A
	n = (m % A - n % A) % A
	y -= 1
r2 = m
print((r1 + r2 - 2) % A)


(n, m) = map(int, input().split())
md = 10 ** 9 + 7
dp = [-1 for i in range(10 ** 5 + 1)]
dp[:3] = [0, 1, 2]
for i in range(3, 10 ** 5 + 1):
	dp[i] = (dp[i - 1] % md + dp[i - 2] % md) % md
print(2 * (dp[n] + dp[m] - 1) % md)


(n, m) = map(int, input().strip().split())
if n > m:
	len = n
else:
	len = m
f = [1, 1]
for i in range(len):
	x = (f[i] + f[i + 1]) % 1000000007
	f.append(x)
print((f[n] + f[m] - 1) * 2 % 1000000007)


from math import *
mod = 10 ** 9 + 7
(n, m) = map(int, input().split())
x = max(n, m) + 1
dp = [0] * (x + 1)
dp[1] = 1
for i in range(2, x + 1):
	dp[i] = (dp[i - 1] + dp[i - 2]) % mod

def solve(x):
	if x > 1:
		return dp[x + 1] - 1
	else:
		return 0
print(2 * (solve(n) + solve(m) + 1) % mod)


(n, m) = map(int, input().split())
dp = [0] * 100001
(dp[0], dp[1]) = (1, 1)
MOD = 1000000007
for i in range(2, 100001):
	dp[i] = (dp[i - 2] + dp[i - 1]) % MOD
print(2 * (dp[n] + dp[m] - 1) % MOD)


mod = 1000000000.0 + 7
(n, m) = list(map(int, input('').split()))
dp = [[[-1 for i in range(3)] for j in range(3)] for k in range(100005)]
dp[1] = 2
dp[2] = 4
for i in range(3, max(n, m) + 2):
	dp[i] = (dp[i - 1] + dp[i - 2]) % mod
ans = int((dp[n] + dp[m] - 2) % mod)
print(ans)


(a, b) = map(int, input().split())
(x, y) = (0, 1)
ans = 0
for i in range(a):
	(x, y) = (y, x + y)
	y %= 1000000007
	x %= 1000000007
ans += y
(x, y) = (0, 1)
for i in range(b):
	(x, y) = (y, x + y)
	y %= 1000000007
	x %= 1000000007
ans += y
print((ans - 1) * 2 % 1000000007)


mod = 1000000007
(n, m) = map(int, input().split())

def fib(n):
	(a, b) = (1, 1)
	for i in range(n):
		(a, b) = (b, (a + b) % mod)
	return a
res = 2 * (fib(n) + fib(m) - 1) % mod
print(res)


(n, m) = map(int, input().split())
f = [0] * 100010
f[0] = f[1] = 1
P = int(1000000000.0 + 7)
for i in range(2, 100001):
	f[i] = (f[i - 1] + f[i - 2]) % P
print((f[n] + f[m] - 1) * 2 % P)


(n, m) = map(int, input().split())
a = []
for i in range(100001):
	a.append(0)
a[0] = 0
a[1] = 2
a[2] = 4
for i in range(3, 100001):
	a[i] = (a[i - 1] % 1000000007 + a[i - 2] % 1000000007) % 1000000007
print((a[n] % 1000000007 + a[m] % 1000000007 - 2) % 1000000007)


l = [0] * (10 ** 6 + 1)
l[2] = 2
mod = 10 ** 9 + 7
(n, m) = [int(i) for i in input().split()]
for i in range(3, max(m, n) + 1):
	l[i] = (l[i - 1] + l[i - 2]) % mod
res = 0
for i in range(n + 1):
	res += l[i]
for j in range(m + 1):
	res += l[j]
print((2 + res) % mod)


ch = input()
L = [int(i) for i in ch.split()]
a = L[0]
b = L[1]
if a > b:
	(a, b) = (b, a)
d = {1: 1, 2: 0}
for i in range(1, b):
	x = d[1]
	y = d[2]
	d[2] = x + y
	d[1] = y
nb = d[1] + 2 * d[2]
d = {1: 1, 2: 0}
for i in range(1, a):
	x = d[1]
	y = d[2]
	d[2] = x + y
	d[1] = y
nb2 = d[1] + 2 * d[2]
print(2 * (nb + nb2 - 1) % (10 ** 9 + 7))


(n, m) = map(int, input().split())
dp0n = 1
dp1n = 1
dp0m = 1
dp1m = 1
(dpn, dpm) = (2, 2)
for i in range(3, n + 1):
	(dp0n, dp1n, dpn) = (dp1n % 1000000007, dpn % 1000000007, (dpn + dp1n) % 1000000007)
for i in range(3, m + 1):
	(dp0m, dp1m, dpm) = (dp1m % 1000000007, dpm % 1000000007, (dpm + dp1m) % 1000000007)
if n == 1:
	dpn = 1
if m == 1:
	dpm = 1
print((dpm * 2 + dpn * 2 - 2) % 1000000007)


from sys import stdin, stdout
for i in stdin:
	(n, m) = list(map(int, i.strip().split()))
	break
A = [1, 2]
B = [2, 4]
(i, j) = (0, 0)
while 1:
	if i and j:
		break
	if A[0] == m:
		C = A[1]
		i = 1
	if A[0] == n:
		D = A[1]
		j = 1
	(A, B) = (B, [B[0] + 1, (A[1] + B[1]) % (10 ** 9 + 7)])
stdout.write(str((C + D - 2) % (10 ** 9 + 7)))


import array
import math
import os
import sys
MOD = 10 ** 9 + 7

def main():
	(N, M) = read_ints()
	print(solve(N, M))

def solve(N, M):

	def row_count(w):
		dp = [0] * (w + 1)
		dp[0] = 1
		for i in range(w):
			if i + 1 <= w:
				dp[i + 1] += dp[i]
				dp[i + 1] %= MOD
			if i + 2 <= w:
				dp[i + 2] += dp[i]
				dp[i + 2] %= MOD
		return dp[w]
	c = row_count(N)
	r = row_count(M)
	return (c + r - 1) * 2 % MOD
DEBUG = 'DEBUG' in os.environ

def inp():
	return sys.stdin.readline().rstrip()

def read_int():
	return int(inp())

def read_ints():
	return [int(e) for e in inp().split()]

def dprint(*value, sep=' ', end='\n'):
	if DEBUG:
		print(*value, sep=sep, end=end)
main()


(n, m) = map(int, input().split())
mod = 10 ** 9 + 7
fib = [1, 1]
for i in range(200001):
	fib.append((fib[-1] + fib[-2]) % mod)
print((fib[n] * 2 - 2 + 2 * fib[m]) % mod)


(n, m) = map(int, input().split())
fib = [1, 1]
for i in range(max(n, m)):
	fib.append(fib[-1] + fib[-2])
print(2 * (fib[n] + fib[m] - 1) % 1000000007)


import heapq, math
from collections import defaultdict, deque
import sys, os.path
if os.path.exists('C:/Users/Dhanush/Desktop/cp/input.txt'):
	sys.stdout = open('C:/Users/Dhanush/Desktop/cp/output.txt', 'w')
	sys.stdin = open('C:/Users/Dhanush/Desktop/cp/input.txt', 'r')
input = sys.stdin.readline
mod = 10 ** 9 + 7

def solve(n):
	dp = [0 for _ in range(n + 1)]
	dp[0] = 1
	dp[1] = 2
	for i in range(2, n):
		dp[i] = (dp[i - 1] + dp[i - 2]) % mod
	return dp[n - 1]
(r, c) = map(int, input().split())
print((2 * (solve(r) - 1) % mod + 2 * (solve(c) - 1) % mod + 2) % mod)


(N, M) = map(int, input().split())
mod = 10 ** 9 + 7
L = max(N, M) + 1
dp = [[1, 1] for _ in range(L + 1)]
dp[1][0] = 1
dp[1][1] = 1
for l in range(2, L + 1):
	dp[l][0] = (dp[l - 1][1] + dp[l - 2][1]) % mod
	dp[l][1] = (dp[l - 1][0] + dp[l - 2][0]) % mod
ans = dp[N][0] + dp[N][1] + dp[M][0] + dp[M][1] - 2
if ans < 0:
	ans += mod
ans %= mod
print(ans)


r = [int(x) for x in input().split()]
fibonacci = [0 for i in range(100001)]
fibonacci[0] = 1
fibonacci[1] = 1
for i in range(99999):
	fibonacci[i + 2] = (fibonacci[i + 1] + fibonacci[i]) % 1000000007
print((2 * ((fibonacci[r[0]] + fibonacci[r[1]]) % 1000000007) - 2 + 1000000007) % 1000000007)


R = lambda : list(map(int, input().split()))
(n, m) = R()
m1 = 100005
a = [0] * m1
a[1] = 1
a[0] = 1
p = 1000000007
for i in range(2, m1):
	a[i] = (a[i - 1] + a[i - 2]) % p
print((a[n] - 1 + a[m]) * 2 % p)


arr = [2, 4]
mod = 10 ** 9 + 7
for i in range(100000):
	arr.append((arr[-1] + arr[-2]) % mod)
(n, m) = list(map(int, input().split()))
print((arr[m - 1] + arr[n - 1] - 2) % mod)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
import sys
mod = 10 ** 9 + 7
(n, m) = map(int, input().split())
dp = [1, 1, 2, 3]
for i in range(n + m + 1):
	dp.append(dp[-1] + dp[-2])
	dp[-1] %= mod
print(2 * (dp[n] + dp[m] - 1) % mod)


dp = [int(0)] * 100005
(n, m) = map(int, input().split())
N = max(n, m)
(dp[1], dp[2]) = (2, 4)
Mod = 10 ** 9 + 7
for i in range(3, N + 1):
	dp[i] = (dp[i - 1] + dp[i - 2]) % Mod
ans = dp[n]
for i in range(2, m + 1):
	ans = (ans + dp[i] - dp[i - 1]) % Mod
ans = (ans + Mod) % Mod
print(ans)


def patate(l):
	n = lst[0]
	m = lst[1]
	resultat = (fibo(n) + fibo(m) - 1) * 2
	print(resultat % 1000000007)

def fibo(n):
	if n == 0:
		return 1
	if n == 1:
		return 1
	if n % 2 == 0:
		return fibo(n / 2) ** 2 + fibo(n / 2 - 1) ** 2
	a = fibo((n - 1) / 2)
	b = fibo((n - 1) / 2 - 1)
	return a * (2 * b + a)
lst = list(map(int, input().split()))
patate(lst)


(n, m) = map(int, input().split())
MOD = 10 ** 9 + 7
ans = 2
tmp = [0] * 100010
tmp[1] = 2
tmp[2] = 2
dp = [[0] * 100010 for i in range(2)]
dp[1][1] = 2
dp[1][2] = 2
dp[0][2] = 2
for i in range(2, 100009):
	dp[0][i + 1] = dp[1][i]
	dp[1][i + 1] = dp[1][i] + dp[0][i]
	dp[0][i + 1] %= MOD
	dp[1][i + 1] %= MOD
sum_yoko = dp[0][m] + dp[1][m]
ans = sum_yoko - 2
sum_tate = dp[0][n] + dp[1][n]
ans += sum_tate
print(ans % MOD)


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7
(H, W) = MAP()
N = max(H, W)
dp = [0] * (N + 2)
dp[1] = 1
dp[2] = 2
for i in range(3, N + 1):
	dp[i] = dp[i - 1] + dp[i - 2]
	dp[i] %= MOD
print(2 * (dp[H] + dp[W] - 1) % MOD)


mod = 1000000007
(n, m) = [int(x) for x in input().split()]
m1 = 2
m2 = 1
for x in range(n):
	if x < 2:
		pass
	else:
		(m2, m1) = (m1, (m2 + m1) % mod)
doubles = m1 * 2 - 2
if n == 1:
	doubles = 0
m1 = 2
m2 = 1
for col in range(m):
	if col < 2:
		pass
	else:
		(m2, m1) = (m1, (m2 + m1) % mod)
singles = m1 * 2
if m == 1:
	singles = 2
print((doubles + singles) % mod)


MOD = int(1000000000.0) + 7
(N, M) = map(int, input().split())
fib = [0 for i in range(max(N, M) + 1)]
fib[0] = 1
fib[1] = 1
for i in range(2, max(N, M) + 1):
	fib[i] = (fib[i - 1] + fib[i - 2]) % MOD
print(2 * (fib[N] + fib[M] - 1) % MOD)


def mi():
	return map(int, input().split())
mod = 10 ** 9 + 7
(n, m) = mi()
a = 0
b = 2
(n, m) = (min(m, n), max(m, n))
for i in range(m):
	c = a + b
	a = b
	b = c
ba = b
b -= 2
a = 0
b = 2
for i in range(n):
	c = a + b
	a = b
	b = c
ba += b - 2
ba %= mod
print(ba)


MOD = 10 ** 9 + 7

def get(t, n):
	if n == 1:
		return t
	(a, b) = (t, 2 * t)
	for i in range(n - 2):
		(a, b) = (b, (a + b) % MOD)
	return b
(n, m) = map(int, input().split())
ans = 0
ans += get(2, n)
ans += get(2, m)
ans -= 2
print(ans % MOD)


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
ans = (dps[m - 1][0] + dps[m - 1][1] + dpd[m - 1][0] + dpd[m - 1][1] - 2) % mod
dps = [[0, 0] for _ in range(n)]
dpd = [[0, 0] for _ in range(n)]
dps[0] = [0, 0]
dpd[0] = [1, 1]
for i in range(1, n):
	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
ans += (dps[n - 1][0] + dps[n - 1][1] + dpd[n - 1][0] + dpd[n - 1][1] - 2) % mod
ans += 2
ans %= mod
print(ans)


from math import *
from collections import *
import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
a = [2, 4]
for i in range(3, max(n, m) + 1):
	a.append(a[-1] + a[-2])
p = 1000000007
print((a[n - 1] + a[m - 1] - 2) % p)


p = 1000000000 + 7
(n, m) = map(int, input().split())
k = n // 2
ans = 0
dp = [[0, 0] for i in range(max(3, max(m + 1, n + 1)))]
dp[2][0] = 1
dp[2][1] = 1
dp[1][1] = 1
for i in range(3, max(m + 1, n + 1)):
	dp[i][0] = (dp[i - 2][0] + dp[i - 2][1]) % p
	dp[i][1] = (dp[i - 1][1] + dp[i - 1][0]) % p
ans += 2 * ((dp[n][0] + dp[n][1]) % p) % p
ans += 2 * ((dp[m][0] + dp[m][1]) % p) % p
ans -= 2
print(ans % p)


mod = 10 ** 9 + 7
(n, m) = map(int, input().split())
(a1, b1) = (0, 2)
for h in range(n):
	(a1, b1) = (b1, (a1 + b1) % mod)
ans1 = b1
(a1, b1) = (0, 2)
for h in range(m):
	ans1 = (ans1 + a1) % mod
	(a1, b1) = (b1, (a1 + b1) % mod)
print(ans1)


(n, m) = map(int, input().split())
ans = [0, 1, 2, 3, 5]
for i in range(5, max(m, n) + 1):
	ans.append((ans[i - 2] + 2 * ans[i - 3] + ans[i - 4]) % (10 ** 9 + 7))
print(2 * (ans[n] + ans[m] - 1) % (10 ** 9 + 7))


e = 10 ** 9 + 7
(n, m) = map(int, input().split())
a = 0
b = 2
for i in range(n):
	c = (a + b) % e
	a = b
	b = c
ans = b
a = 2
b = 2
for i in range(m - 1):
	ans = (ans + a) % e
	c = (a + b) % e
	a = b
	b = c
print(ans)


(width, height) = list(map(int, input().strip().split(' ')[:2]))
modulo = 10 ** 9 + 7
fibs = [0, 0]
sum_fibs = [0, 0]
(a, b) = (1, 0)
for i in range(max(width, height)):
	fibs.append(a)
	sum_fibs.append((sum_fibs[-1] + a) % modulo)
	(a, b) = ((a + b) % modulo, a)

def ans(w, h):
	return 2 * (1 + sum_fibs[w] + sum_fibs[h]) % modulo
print(ans(width, height))


mod = int(10 ** 9 + 7)
(n, m) = map(int, input().split())
dp = [1, 1]
for x in range(2, max(n, m) + 1):
	dp.append(0)
	dp[x] = (dp[x - 1] + dp[x - 2]) % mod
sol = 2 * (dp[n] + dp[m] - 1) % mod % mod
print(sol)


from sys import stdin
inp = stdin.readline
(n, m) = [int(x) for x in inp().strip().split()]
a = [0] * 100001
a[1] = 1
a[0] = 1
mod = 10 ** 9 + 7
for i in range(2, 100001):
	a[i] = (a[i - 1] + a[i - 2]) % mod
print(2 * (a[n] + a[m] - 1) % mod)


def fibonacci(n):
	(a, b) = (0, 1)
	for i in range(n):
		(a, b) = (b, a + b)
	return a
(n, m) = list(map(int, input().split()))
print(2 * (fibonacci(m + 1) + fibonacci(n + 1) - 1) % 1000000007)


def main():
	mod = 1000000007
	a = [1, 1, 1]
	b = [1, 1, 1]
	c = [1, 1, 1]
	a[1] = 2
	a[2] = 4
	b[1] = 0
	b[2] = 2
	c[1] = 0
	c[2] = 2
	for i in range(3, 100001):
		a.append(a[i - 1] + a[i - 2])
		a[i] %= mod
		b.append(b[i - 1] + b[i - 2])
		b[i] %= mod
		c.append((c[i - 1] + b[i]) % mod)
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	print((a[n] + c[m]) % mod)
main()


(n, m) = map(int, input().split())
F = [0 for _ in range(100005)]
F[1] = 1
F[2] = 2
for i in range(3, max(n, m) + 1):
	F[i] = (F[i - 1] + F[i - 2]) % 1000000007
print((2 * (F[n] + F[m] - 1) + 1000000007) % 1000000007)


modulo = 1000000007
inline = [int(x) for x in input().split(' ')]
row = max(inline[0], inline[1])
col = min(inline[0], inline[1])
if row > 1 and col > 1:
	rowrec = [0] * row
	rowrec[0] = 2
	rowrec[1] = 4
	for i in range(2, row):
		rowrec[i] = (rowrec[i - 1] + rowrec[i - 2]) % modulo
	colrec = [0] * col
	colrec[0] = rowrec[row - 1]
	colrec[1] = 2 + colrec[0]
	for i in range(2, col):
		colrec[i] = (colrec[i - 1] + rowrec[i - 2]) % modulo
	print(colrec[col - 1])
else:
	theOne = max(row, col)
	rowrec = [0] * theOne
	if theOne == 1:
		print(2)
	else:
		rowrec[0] = 2
		rowrec[1] = 4
		for i in range(2, theOne):
			rowrec[i] = (rowrec[i - 1] + rowrec[i - 2]) % modulo
		print(rowrec[theOne - 1])


(n, m) = map(int, input().split())
modulo = 10 ** 9 + 7
combs = 0
r = 1
r_next = 2
a = min(n, m)
b = max(n, m)
for i in range(3, a + 1):
	(r, r_next) = (r_next, (r + r_next) % modulo)
combs += r_next if a > 1 else 1
for i in range(max(3, a + 1), b + 1):
	(r, r_next) = (r_next, (r + r_next) % modulo)
combs += r_next if b > 1 else 1
combs -= 1
combs *= 2
print(combs % modulo)


import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
if n == 1 and m == 1:
	print(2)
	exit()
MOD = 10 ** 9 + 7
N = max(n, m)
dp = [[0] * 4 for _ in range(N + 1)]
for j in range(4):
	dp[2][j] = 1
for i in range(2, N):
	dp[i + 1][0] = dp[i][2]
	dp[i + 1][1] = dp[i][0] + dp[i][2]
	dp[i + 1][2] = dp[i][1] + dp[i][3]
	dp[i + 1][3] = dp[i][1]
	for j in range(4):
		dp[i + 1][j] %= MOD
if n == 1:
	print(sum(dp[m]) % MOD)
elif m == 1:
	print(sum(dp[n]) % MOD)
else:
	print((sum(dp[n]) + sum(dp[m]) - 2) % MOD)


md = 10 ** 9 + 7
(n, m) = map(int, input().split())
if n == 1 and m == 1:
	print(2)
else:
	a = [0 for _ in range(max(n, m))]
	a[0] = 2 % md
	a[1] = 4 % md
	for i in range(2, max(n, m)):
		a[i] = (a[i - 1] + a[i - 2]) % md
	b = [0 for _ in range(n)]
	b[0] = a[m - 1]
	for i in range(1, n):
		x = 0 if i <= 2 else i - 2
		b[i] = (b[x] % md + a[i - 1]) % md
	print(b[-1])


from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
from collections import defaultdict as dd, deque

def data():
	return sys.stdin.readline().strip()

def mdata():
	return map(int, data().split())
mod = int(1000000000.0 + 7)
(n, m) = mdata()
dp = [[2, 0, 0]]
for i in range(1, m):
	dp.append([(2 * dp[i - 1][0] - dp[i - 1][2] + mod) % mod, (dp[i - 1][1] + dp[i - 1][0] - dp[i - 1][2] + mod) % mod, (dp[i - 1][0] - dp[i - 1][2] + mod) % mod])
cnt = dp[-1][1]
k1 = dp[-1][0] - dp[-1][1]
k2 = 0
for i in range(1, n):
	(k1, k2) = ((2 * k1 - k2 + mod) % mod, (k1 - k2 + mod) % mod)
print((cnt + k1) % mod)


(n, m) = map(int, input().split())
modulo = 10 ** 9 + 7
combs = 0
r = 1
r_next = 2
for i in range(3, n + 1):
	(r, r_next) = (r_next, (r + r_next) % modulo)
combs += r_next if n > 1 else 1
c = 1
c_next = 2
for j in range(3, m + 1):
	(c, c_next) = (c_next, (c + c_next) % modulo)
combs += c_next if m > 1 else 1
combs -= 1
combs *= 2
print(combs % modulo)


(n, m) = map(int, input().split())
mod = 10 ** 9 + 7
if n == 1 and m == 1:
	print(2)
	exit()
if n == 1 and m == 2 or (m == 1 and n == 2):
	print(4)
	exit()
if n == 2 and m == 2:
	print(6)
	exit()
add1 = 2
add2 = 4
add = [add1, add2]
for i in range(1, 200000):
	add += [(add[i] + add[i - 1]) % mod]
if n > 2 and m == 1:
	print(add[n - 1])
	exit()
if n > 2 and m == 2:
	print((add[n - 1] + 2) % mod)
	exit()
if n == 1 and m > 2:
	print(add[m - 1])
	exit()
if n == 2 and m > 2:
	print((add[m - 1] + 2) % mod)
	exit()
n1 = 2
n2 = 4
n -= 2
for i in range(n):
	nxt = n1 + n2
	nxt %= mod
	n1 = n2
	n2 = nxt
m1 = n2 + 2
m -= 2
for i in range(m):
	m1 = (m1 + add[i]) % mod
print(m1 % mod)


M = 10 ** 9 + 7
f = [1, 1, 2]
for i in range(1, 10 ** 5 + 3):
	f.append((f[-1] + f[-2]) % M)
(n, m) = map(int, input().split())
ans = 2 * f[n] % M
ans += 2 * (f[m] - 1)
ans %= M
print(ans)


(a, b) = map(int, input().split())
if a == 1 and b == 1:
	print(2)
else:
	d = max(a, b) * [0]
	d[0] = 1
	d[1] = 2
	for i in range(2, len(d)):
		d[i] = d[i - 1] + d[i - 2]
	print(2 * (d[a - 1] + d[b - 1] - 1) % (10 ** 9 + 7))


from sys import stdin
input = stdin.readline
MOD = 1000000007
(n, m) = [int(x) for x in input().split()]
dp = [1, 1]
for i in range(max(n, m) + 1):
	dp.append((dp[-2] + dp[-1]) % MOD)
x = dp[m] * 2
y = dp[n] * 2
ans = (x + y - 2) % MOD
print(ans)


(n, m) = map(int, input().split())
if n == 1 and m == 1:
	print(2)
else:
	k1 = max(n, m)
	k2 = min(n, m)
	l = [2] * k1
	l[1] = 4
	for i in range(2, k1):
		l[i] = (l[i - 1] + l[i - 2]) % 1000000007
	ans = l[k1 - 1]
	for i in range(1, k2):
		ans += (l[i] - l[i - 1]) % 1000000007
	print(ans % 1000000007)


import sys

def input():
	return sys.stdin.readline().rstrip()
MOD = int(1000000000.0 + 7)

def slv():
	(n, m) = map(int, input().split())
	DP1 = [0] * (m + n)
	DP2 = [[0] * 2 for i in range(m + n)]
	DP1[0] = 2
	DP2[0] = [0, 0]
	for i in range(1, m + n):
		DP1[i] = DP1[i - 1]
		DP2[i][0] = (DP2[i - 1][0] + DP2[i - 1][1]) % MOD
		DP2[i][1] = (DP2[i - 1][0] + DP1[i - 1]) % MOD
	ans = sum(DP2[m - 1]) + sum(DP2[n - 1]) + 2
	ans %= MOD
	print(ans)
	return

def main():
	t = 1
	for i in range(t):
		slv()
	return
main()


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))
(n, m) = inpl()
a = [1, 1]
for i in range(10 ** 5 + 10):
	a.append((a[-1] + a[-2]) % mod)
res = a[m]
ac = [0]
for x in a:
	ac.append((ac[-1] + x) % mod)
res += ac[n - 1]
print(res * 2 % mod)


m = 10 ** 9 + 7
memo = {1: 0, 2: 2}

def d(n):
	if n not in memo:
		memo[n] = (d(n - 1) + d(n - 2) + 2) % m
	return memo[n]
for i in range(3, 100000):
	d(i)
(a, b) = map(int, input().split())
(i, j) = (2, 4)
p = 1
while p < a:
	p += 1
	(i, j) = (j, (i + j) % m)
start1 = i
(i, j) = (4, 6)
p = 1
while p < a:
	p += 1
	(i, j) = (j, (i + j - 2) % m)
start2 = i
(i, j) = (start1, start2)
p = 1
while p < b:
	p += 1
	(i, j) = (j, (i + j - d(a)) % m)
print((i + m) % m)


(n, m) = map(int, input().split())
q = 10 ** 9 + 7
a1 = [0] * n
a2 = [0] * n
b1 = [0] * n
b2 = [0] * n
a1[0] = 1
b1[0] = 1
for i in range(1, n):
	a1[i] = b1[i - 1] + b2[i - 1]
	a2[i] = a1[i - 1]
	b1[i] = a1[i - 1] + a2[i - 1]
	b2[i] = b1[i - 1]
	a1[i] %= q
	a2[i] %= q
	b1[i] %= q
	b2[i] %= q
ans = (a1[n - 1] + a2[n - 1] + b1[n - 1] + b2[n - 1]) % q
a1 = [0] * m
a2 = [0] * m
b1 = [0] * m
b2 = [0] * m
a1[0] = 1
b1[0] = 1
for i in range(1, m):
	a1[i] = b1[i - 1] + b2[i - 1]
	a2[i] = a1[i - 1]
	b1[i] = a1[i - 1] + a2[i - 1]
	b2[i] = b1[i - 1]
	a1[i] %= q
	a2[i] %= q
	b1[i] %= q
	b2[i] %= q
ans += a1[m - 1] + a2[m - 1] + b1[m - 1] + b2[m - 1]
ans %= q
print((q + ans - 2) % q)


(n, m) = list(map(int, input().split()))
mod = 10 ** 9 + 7
p1 = 2
p2 = 0
ans = 2
n -= 1
while n:
	ans = (ans + p1) % mod
	(p1, p2) = ((p1 + p2) % mod, p1)
	n -= 1
p1 = 2
p2 = 0
m -= 1
while m:
	ans = (ans + p1) % mod
	(p1, p2) = ((p1 + p2) % mod, p1)
	m -= 1
print(ans)


MOD = 1000000007
(n, m) = list(map(int, input().split()))
mx = max(n, m)
dp = [0] * mx
dp[0] = 2
if mx >= 2:
	dp[1] = 4
for i in range(2, mx):
	dp[i] = (dp[i - 1] + dp[i - 2]) % MOD
ans = (dp[n - 1] + dp[m - 1] - 2) % MOD
print(int(ans))


(n, m) = map(int, input().split())
a = [0] * 100001
(_, a[1], a[2], i) = (1000000007, 2, 4, 3)
while i <= max(n, m):
	a[i] = a[i - 1] + a[i - 2]
	i += 1
print((a[n] + a[m] - 2) % _)


(m, n) = map(int, input().split())
t_1 = 2
t_2 = 4
if m >= 3:
	for numbers in range(3, m + 1):
		t_2_copy = t_2
		t_2 = t_2 + t_1
		t_1 = t_2_copy
x_1 = 2
x_2 = 4
if n >= 3:
	for numbers in range(3, n + 1):
		x_2_copy = x_2
		x_2 = x_2 + x_1
		x_1 = x_2_copy
if m >= 2 and n >= 2:
	print((t_2 + x_2 - 2) % (10 ** 9 + 7))
elif m == 1 and n != 1:
	print((t_1 + x_2 - 2) % (10 ** 9 + 7))
elif n == 1 and m != 1:
	print((t_2 + x_1 - 2) % (10 ** 9 + 7))
else:
	print(2)


mod = 10 ** 9 + 7
f = [1] * 100001
for i in range(2, 100001):
	f[i] = (f[i - 1] + f[i - 2]) % mod
(n, m) = map(int, input().split())
print(2 * (f[n] + f[m] - 1) % mod)


(n, m) = map(int, input().split())
mod = 10 ** 9 + 7
if n > m:
	(n, m) = (m, n)
if m == 1:
	print(2)
else:
	DP = [[0] * 2 for _ in range(m)]
	DP[1][0] = 2
	DP[1][1] = 2
	for i in range(2, m):
		DP[i][0] = DP[i - 1][1] % mod
		DP[i][1] = (DP[i - 1][0] + DP[i - 1][1]) % mod
	a = DP[m - 1][0] + DP[m - 1][1]
	if n == 1:
		print(a % mod)
	else:
		ans = a - 2
		ans += DP[n - 1][0] + DP[n - 1][1]
		print(ans % mod)