Tatyana is a big sports fan and she likes volleyball a lot! She writes down the final scores of the game after it has ended in her notebook. 

If you are not familiar with the rules of volleyball, here's a brief:

2 teams play in total
During the course of the game, each team gets points, and thus increases its score by 1. 
The initial score is 0 for both teams. 

The game ends when 

One of the teams gets 25 points and another team has < 24 points ( strictly less than 24). 
If the score ties at 24:24, the teams continue to play until the absolute difference between the scores is 2.  

Given the final score of a game in the format A:B i.e., the first team has scored A points and the second has scored B points, can you print the number of different sequences of getting points by teams that leads to this final score? 

Input Format 

The first line contains A and the second line contains B.  

Constraints  

0 ≤ A , B ≤ 10^{9}

Output Format 

Output the number of different sequences of getting points by the teams that leads to the final score A : B. Final means that the game should be over after this score is reached. If the number is larger than 10^{9}+7, output number modulo 10^{9} + 7. Print 0 if no such volleyball game ends with the given score. 

Example input #00

3
25

Example output #00

2925

Example input #01

24
17

Example output #01

0

Explanation #01

There's no game of volleyball that ends with a score of 24 : 17.

Difficulty: MEDIUM
Tags: Combinatorics

Starter code:

Solutions:
MOD = 1000000007

def C(n, k):
	ret = 1
	for i in range(k):
		ret = ret * (n - i) // (i + 1)
	return ret % MOD

def f(x, y):
	if y < 25:
		return 0
	if y == 25:
		return 0 if x >= 24 else C(24 + x, x)
	return 0 if y - x != 2 else C(48, 24) * pow(2, y - 26, MOD) % MOD
(a, b) = sorted(map(int, [input(), input()]))
print(f(a, b))


m = 1000000007

def binom(n, r):
	if r > n - r:
		r = n - r
	rt = 1
	for i in range(n - r + 1, n + 1):
		rt *= i
	for i in range(1, r + 1):
		rt //= i
	return rt % m

def f(a, b):
	if a == b or (a < 25 and b < 25):
		return 0
	if a > b:
		(a, b) = (b, a)
	if b > 25:
		if b - a != 2:
			return 0
		else:
			return 603457371 * ((1 << a - 24) % m) % m
	if b == 25 and a == 24:
		return 0
	return binom(a + b - 1, a)
print(f(int(input()), int(input())))


import math, sys

def f(x, r):
	res = 1
	for i in range(1, x + 1):
		res = res * i % r
	return res

def p(x, n, r):
	if n == 0:
		return 1
	res = x
	m = [n // 2 ** i % 2 for i in range(1 + int(math.log(n) / math.log(2)))]
	k = len(m) - 1
	for i in range(1, k + 1):
		res = res ** 2 * x ** m[k - i] % r
	return res

def C(n, k, r):
	return f(n, r) * p(f(k, r), r - 2, r) * p(f(n - k, r), r - 2, r) % r
a = int(input())
b = int(input())
(a, b) = [max(a, b), min(a, b)]
if a == 25 and b < 24 or (a > 25 and a - b == 2):
	if a > 25:
		print(C(48, 24, 10 ** 9 + 7) * p(2, b - 24, 10 ** 9 + 7) % (10 ** 9 + 7))
	else:
		print(C(a + b - 1, a - 1, 10 ** 9 + 7))
else:
	print('0')


import sys
MOD = 1000000007

def choose(n, k):
	if k < 0 or k > n:
		return 0
	else:
		(p, q) = (1, 1)
		for i in range(1, min(k, n - k) + 1):
			p *= n
			q *= i
			n -= 1
		return p // q
A = int(sys.stdin.readline())
B = int(sys.stdin.readline())
(A, B) = (max(A, B), min(A, B))
if A == 25 and B < 24:
	print(choose(A + B - 1, B) % MOD)
elif A == 26 and B == 24 or (B >= 25 and A - B == 2):
	print(pow(2, A - 26, MOD) * choose(48, 24) % MOD)
else:
	print(0)


from math import factorial as f
(a, b) = sorted([int(input()) for _ in (0, 0)])
if b < 25 or (b != 25 and b - a != 2) or (b == 25 and b - a < 2):
	print(0)
elif b == 25:
	print(f(b + a - 1) // f(a) // f(b - 1) % (10 ** 9 + 7))
else:
	print(32247603683100 * pow(2, a - 24, 10 ** 9 + 7) % (10 ** 9 + 7))


from operator import mul
from fractions import Fraction
from functools import reduce

def nCk(n, k):
	return int(reduce(mul, (Fraction(n - i, i + 1) for i in range(k)), 1))
A = int(input())
B = int(input())
if max(A, B) == 25 and min(A, B) < 24:
	print(nCk(A + B - 1, min(A, B)) % (10 ** 9 + 7))
elif max(A, B) > 25 and max(A, B) - min(A, B) == 2:
	k = min(A, B) - 24
	print(603457371 * 2 ** (k % (5 * 10 ** 8 + 3)) % (10 ** 9 + 7))
else:
	print(0)


import sys
MOD = 1000000007

def choose(n, k):
	if k < 0 or k > n:
		return 0
	else:
		(p, q) = (1, 1)
		for i in range(1, min(k, n - k) + 1):
			p *= n
			q *= i
			n -= 1
		return p // q
A = int(sys.stdin.readline())
B = int(sys.stdin.readline())
(A, B) = (max(A, B), min(A, B))
if A == 25 and B < 24:
	print(choose(A + B - 1, B) % MOD)
elif B >= 24 and A - B == 2:
	print(pow(2, A - 26, MOD) * choose(48, 24) % MOD)
else:
	print(0)


import math
mod = 10 ** 9 + 7
a = int(input())
b = int(input())
if a < 24 and b == 25:
	print(math.factorial(a + b - 1) // (math.factorial(a) * math.factorial(b - 1)) % mod)
elif b < 24 and a == 25:
	print(math.factorial(a + b - 1) // (math.factorial(a - 1) * math.factorial(b)) % mod)
elif abs(a - b) != 2:
	print(0)
else:
	to_tie = 32247603683100
	a -= 24
	b -= 24
	if a < b:
		print(2 ** a % mod * to_tie % mod)
	else:
		print(2 ** b % mod * to_tie % mod)


from math import factorial
a = int(input())
b = int(input())
mod = 10 ** 9 + 7
if a < 25 and b < 25 or a == b:
	print(0)
else:
	if a > b:
		aa = a
		a = b
		b = aa
	if a < 24:
		if b == 25:
			print(int(factorial(a + b - 1) / (factorial(a) * factorial(b - 1))) % mod)
		else:
			print(0)
	elif a == 24:
		if b == 26:
			print(int(factorial(a + b - 2) / (factorial(a) * factorial(b - 2))) % mod)
		else:
			print(0)
	elif b - a == 2:
		s = int(factorial(48) / (factorial(24) * factorial(24))) % mod
		c = 2 ** (b - 26) % mod
		s = s * c % mod
		print(int(s % mod))
	else:
		print(0)


import sys
MOD = 1000000007

def choose(n, k):
	if k < 0 or k > n:
		return 0
	else:
		(p, q) = (1, 1)
		for i in range(1, min(k, n - k) + 1):
			p *= n
			q *= i
			n -= 1
		return p // q
A = int(sys.stdin.readline())
B = int(sys.stdin.readline())
(A, B) = (max(A, B), min(A, B))
if A == 25 and B < 24:
	print(choose(A + B - 1, B) % MOD)
elif B >= 24 and A - B == 2:
	print(pow(2, A - 26, MOD) * choose(48, 24) % MOD)
else:
	print(0)


import sys
MOD = 1000000007

def choose(n, k):
	if k < 0 or k > n:
		return 0
	else:
		(p, q) = (1, 1)
		for i in range(1, min(k, n - k) + 1):
			p *= n
			q *= i
			n -= 1
		return p // q
A = int(sys.stdin.readline())
B = int(sys.stdin.readline())
(A, B) = (max(A, B), min(A, B))
if A == 25 and B < 24:
	print(choose(A + B - 1, B) % MOD)
elif B >= 24 and A - B == 2:
	print(pow(2, A - 26, MOD) * choose(48, 24) % MOD)
else:
	print(0)


import sys
MOD = 1000000007

def choose(n, k):
	if k < 0 or k > n:
		return 0
	else:
		(p, q) = (1, 1)
		for i in range(1, min(k, n - k) + 1):
			p *= n
			q *= i
			n -= 1
		return p // q
A = int(sys.stdin.readline())
B = int(sys.stdin.readline())
(A, B) = (max(A, B), min(A, B))
if A == 25 and B < 24:
	print(choose(A + B - 1, B) % MOD)
elif B >= 24 and A - B == 2:
	print(pow(2, A - 26, MOD) * choose(48, 24) % MOD)
else:
	print(0)


comb = {}
for i in range(49):
	comb[i, 0] = 1
	comb[i, i] = 1
	for j in range(1, i):
		comb[i, j] = (comb[i - 1, j] + comb[i - 1, j - 1]) % 1000000007

def num_seq(M, N):
	if M < 25 and N < 25:
		return 0
	elif max(M, N) > 25:
		if abs(M - N) == 2:
			return comb[48, 24] * 2 ** (min(M, N) - 24) % 1000000007
		else:
			return 0
	elif abs(M - N) >= 2:
		return comb[M + N - 1, min(M, N)]
	else:
		return 0
A = int(input())
B = int(input())
print(num_seq(A, B))


def modPow(x, y, m):
	if y == 0:
		return 1
	if y == 1:
		return x
	temp = modPow(x, y // 2, m)
	if y % 2 == 0:
		return temp * temp % m
	else:
		return temp * temp % m * x % m

def ways(x, y):
	if x < 0 or y < 0:
		return 0
	if W[x][y] != -1:
		return W[x][y]
	W[x][y] = (ways(x - 1, y) + ways(x, y - 1)) % M
	return W[x][y]
W = [[-1] * 26 for _ in range(26)]
W[0][0] = 0
W[0][1] = 1
W[1][0] = 1
M = 10 ** 9 + 7
a = int(input())
b = int(input())
if abs(a - b) > 2 and min(a, b) >= 24 or max(a, b) < 25 or (min(a, b) >= 24 and abs(a - b) < 2):
	print(0)
	quit()
if min(a, b) >= 24:
	res = ways(24, 24) * modPow(2, min(a, b) - 24, M) % M
else:
	res = ways(min(a, b), 24)
print(res)


MOD = 10 ** 9 + 7
nCr = [[1]]
for n in range(1, 49):
	nCr += [[1]]
	for r in range(1, n):
		nCr[n] += [(nCr[n - 1][r] + nCr[n - 1][r - 1]) % MOD]
	nCr[n] += [1]

def ways(a, b):
	(x, y) = (max(a, b), min(a, b))
	if x < 25:
		return 0
	if x == 25:
		if y >= 24:
			return 0
		return nCr[y + 24][y]
	if x > 25:
		if x - y == 2:
			return nCr[48][24] * pow(2, y - 24, MOD)
		else:
			return 0
print(ways(int(input()), int(input())) % MOD)


p = 1000000007
max_n = 51
factorial = [1] * max_n
inv_factorial = [1] * max_n

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	(g, y, x) = egcd(b % a, a)
	return (g, x - b // a * y, y)

def mod_inv(a, m):
	(gcd, x, y) = egcd(a, m)
	if gcd != 1:
		return None
	return x % m

def nCr(n, r):
	return factorial[n] * inv_factorial[r] * inv_factorial[n - r] % p
for i in range(1, max_n):
	factorial[i] = i * factorial[i - 1] % p
	inv_factorial[i] = mod_inv(i, p) * inv_factorial[i - 1] % p
a = int(input())
b = int(input())
if a < b:
	(a, b) = (b, a)
if a == 25 and b < 24:
	print(nCr(a + b - 1, b))
elif a > 25 and a - b == 2:
	print(nCr(48, 24) * pow(2, b - 24, p) % p)
else:
	print(0)


import sys
MOD = 1000000007

def choose(n, k):
	if k < 0 or k > n:
		return 0
	else:
		(p, q) = (1, 1)
		for i in range(1, min(k, n - k) + 1):
			p *= n
			q *= i
			n -= 1
		return p // q
A = int(sys.stdin.readline())
B = int(sys.stdin.readline())
(A, B) = (max(A, B), min(A, B))
if A == 25 and B < 24:
	print(choose(A + B - 1, B) % MOD)
elif B >= 24 and A - B == 2:
	print(pow(2, A - 26, MOD) * choose(48, 24) % MOD)
else:
	print(0)


import sys
MOD = 1000000007

def seq(n, k):
	if k < 0 or k > n:
		return 0
	else:
		(p, q) = (1, 1)
		for i in range(1, min(k, n - k) + 1):
			p *= n
			q *= i
			n -= 1
		return p // q
A = int(sys.stdin.readline())
B = int(sys.stdin.readline())
(A, B) = (max(A, B), min(A, B))
if A == 25 and B < 24:
	print(seq(A + B - 1, B) % MOD)
elif B >= 24 and A - B == 2:
	print(pow(2, A - 26, MOD) * seq(48, 24) % MOD)
else:
	print(0)


from math import factorial

def seqs(a, b):
	(a, b) = (min(a, b), max(a, b))
	if b > 25:
		if a == b - 2:
			return 32247603683100 * 2 ** (a - 24)
		else:
			return 0
	elif b == 25 and a < 24:
		return factorial(a + b - 1) / (factorial(a) * factorial(b - 1))
	else:
		return 0
A = int(input().strip())
B = int(input().strip())
print(int(seqs(A, B)) % 1000000007)


from math import factorial
from operator import mul
from functools import reduce
A = int(input())
B = int(input())
T = 1
if abs(A - B) > 0 and max(A, B) == 25 and (min(A, B) < 24):
	maxt = max(A, B)
	mint = min(A, B)
	T = factorial(A + B - 1) // (factorial(mint) * factorial(maxt - 1))
	print(T % (10 ** 9 + 7))
elif A >= 24 and B >= 24 and (abs(A - B) == 2):
	F = factorial(48) // factorial(24) ** 2
	maxt = max(A, B)
	mint = min(A, B)
	x = (mint + maxt - 48 - 2) // 2
	print(F * 2 ** x % (10 ** 9 + 7))
else:
	print(0)


import itertools, math
a = int(input())
b = int(input())
if a < 25 and b < 25 or abs(a - b) < 2:
	count = 0
elif a < 24 or b < 24:
	n = a + b - 1
	r = min(a, b)
	count = math.factorial(n) // math.factorial(r) // math.factorial(n - r)
elif abs(a - b) == 2:
	count = math.factorial(48) // math.factorial(24) // math.factorial(48 - 24)
	past_24 = min(a - 24, b - 24)
	count *= 2 ** past_24
	count = int(count)
else:
	count = 0
print(count % (10 ** 9 + 7))


from sys import stdin
from itertools import accumulate as acc, count, combinations_with_replacement as cmbrep, takewhile as tkw, repeat as rp, dropwhile as dpw, combinations as comb
from functools import reduce
from random import randint
from collections import Counter
from math import sqrt, log, factorial
from fractions import gcd
from heapq import merge
from os.path import basename, exists, expanduser, splitext, isfile
from os import getcwd
tp = 25
modo = 10 ** 9 + 7

def clv1(A, B):
	if B > A:
		(A, B) = (B, A)
	if A < tp or (B > tp - 2 and A - B != 2):
		return 0
	if A == tp:
		al = [1] * (B + 1)
		for _ in range(tp - 1):
			al = acc(al)
		return list(al)[-1] % modo
	else:
		al = [1] * tp
		for _ in range(tp - 2):
			al = acc(al)
		base = list(al)[-1]
		return base * pow(2, B - 23, modo) % modo
rd = stdin
(A, B) = (int(rd.readline().strip()) for _ in range(2))
print(clv1(A, B))


a = int(input())
b = int(input())
mod = 10 ** 9 + 7

def ncr(n, r):
	ft = 1
	ct = 1
	for i in range(n - r + 1, n + 1):
		ft = ft * i
		ft = ft / ct
		ct += 1
	return int(ft)
if a == 25 and b < 24 or (b == 25 and a < 24):
	c = a + b - 1
	if a > b:
		ans = ncr(c, b)
	else:
		ans = ncr(c, a)
	ans = ans % mod
	print(ans)
elif a < 25 and b < 25 or abs(a - b) < 2 or (a > 23 and b > 23 and (abs(a - b) > 2)):
	print(0)
else:
	c1 = a - 24
	c2 = b - 24
	prt = ncr(48, 24)
	prt = prt % mod
	mn = min(c1, c2)
	if mn == 0:
		print(prt)
	else:
		prt2 = 2 ** mn
		prt = prt * prt2 % mod
		print(prt)


import math

def nCr(n, r):
	f = math.factorial
	return round(f(n) / f(r) / f(n - r))

def numscores(a, b):
	if a == 25 and b == 25:
		return 0
	elif a < 25 and b < 25:
		return 0
	elif a == 25 or b == 25:
		if a - b == 1:
			return 0
		if a < b:
			(a, b) = (b, a)
		return nCr(a + b - 1, a - 1)
	elif a > 23 and b > 23 and (abs(a - b) == 2):
		if a < b:
			(a, b) = (b, a)
		return nCr(48, 24) * 2 ** (b - 24)
	else:
		return 0
a = int(input())
b = int(input())
score = round(numscores(a, b))
if score > 10 ** 9 + 7:
	score %= 10 ** 9 + 7
print(score)


MOD = 10 ** 9 + 7

def C(n, r):
	c = 1
	if r > n - r:
		r = n - r
	for i in range(r):
		c = c * (n - i) // (i + 1)
	return c

def solve(a, b):
	if a > b:
		(a, b) = (b, a)
	if b < 25:
		return 0
	if b - a < 2:
		return 0
	if b > 25 and b - a > 2:
		return 0
	return C(min(a, 24) + min(b, 24), min(a, 24)) % MOD * pow(2, max(a, 24) - 24, MOD) % MOD
A = int(input())
B = int(input())
print(solve(A, B))


P = 10 ** 9 + 7
from math import factorial as f
A = int(input())
B = int(input())
(A, B) = (max(A, B), min(A, B))
if A == 25:
	if B > 23:
		print(0)
	else:
		print(f(A + B - 1) // f(B) // f(A - 1) % P)
elif A < 25:
	print(0)
elif A - B != 2:
	print(0)
else:
	st = 32247603683100
	t = A - 25
	print(st * (1 << t - 1) % P)


import sys
import math

def recPow(x, n):
	if n == 0:
		return 1
	if n % 2 == 0:
		return pow(recPow(x, n / 2), 2) % 1000000007
	else:
		return x * recPow(x, n - 1) % 1000000007

def biencodiem(a, b):
	grande = max(a, b) - 1
	chico = min(a, b)
	return factorial(grande + chico) // (factorial(grande) * factorial(chico))

def hardcodiem(a, b):
	if a == 0 and b == 0:
		return 1
	suma = 0
	if a > 0:
		suma = suma + hardcodiem(a - 1, b)
	if b > 0:
		suma = suma + hardcodiem(a, b - 1)
	return suma

def factorial(a):
	if a < 2:
		return 1
	mult = 1
	for x in range(2, a + 1):
		mult = mult * x
	return mult
a = input()
b = input()
a = int(a)
b = int(b)
if a < 25 and b < 25:
	print(0)
elif abs(a - b) < 2:
	print(0)
elif a >= 24 and b >= 24:
	if abs(a - b) == 2:
		c = max(a, b)
		c = c - 2 - 24
		a = 0
		pot = 1
		d = recPow(2, c) % 1000000007 * biencodiem(25, 24) % 1000000007 % 1000000007
		print(str(d))
	else:
		print(0)
else:
	print(biencodiem(max(a, b), min(a, b)) % 1000000007)


factorial_memo = [1]

def factorial(n):
	if n < len(factorial_memo):
		return factorial_memo[n]
	for i in range(len(factorial_memo), n + 1):
		factorial_memo.append(i * factorial_memo[i - 1])
	return factorial_memo[n]

def combinations(n, k):
	return factorial(n) // factorial(k) // factorial(n - k)

def game_still_going(a, b):
	return a < 25 and b < 25 or (a >= 24 and b >= 24 and (abs(a - b) <= 1))

def illegal_game(a, b):
	return (a >= 24 and b >= 24) and abs(a - b) > 2

def game_won_at_25(a, b):
	return a == 25 and b < 24 or (b == 25 and a < 24)

def games_ending_at_25(a, b):
	assert a == 25 or b == 25
	assert a < 24 or b < 24
	points_loser = min(a, b)
	return combinations(points_loser + 24, points_loser)

def games_ending_after_25(a, b):
	assert a >= 24 and b >= 24
	assert abs(a - b) == 2
	ways_to_get_to_24 = combinations(2 * 24, 24)
	last_even_score = min(a, b)
	if last_even_score == 24:
		return ways_to_get_to_24
	else:
		return pow(2, last_even_score - 24) * ways_to_get_to_24

def solve(a, b):
	if game_still_going(a, b):
		return 0
	if illegal_game(a, b):
		return 0
	if game_won_at_25(a, b):
		return games_ending_at_25(a, b)
	return games_ending_after_25(a, b)

def main():
	(A, B) = (int(input()), int(input()))
	print(solve(A, B) % 1000000007)
main()


import sys, math
a = int(input())
b = int(input())
if a < 25 and b < 25 or a == b or ((a == 25 or b == 25) and abs(a - b) < 2) or ((a >= 25 and b >= 25) and abs(a - b) > 2):
	print(0)
elif a == 25 and b < 24 or (b == 25 and a < 24):
	if a < b:
		print(int(math.factorial(24 + a) / (math.factorial(a) * math.factorial(24)) % (math.pow(10, 9) + 7)))
	else:
		print(int(math.factorial(24 + b) / (math.factorial(b) * math.factorial(24)) % (math.pow(10, 9) + 7)))
else:
	currAnswer = int(math.factorial(48) / (math.factorial(24) * math.factorial(24)) % (math.pow(10, 9) + 7))
	if a < b:
		currAnswer = currAnswer * 2 ** (a - 24) % (pow(10, 9) + 7)
	else:
		currAnswer = currAnswer * 2 ** (b - 24) % (pow(10, 9) + 7)
	currAnswer = int(currAnswer % (pow(10, 9) + 7))
	print(currAnswer)


a = int(input())
b = int(input())
A = min(a, b)
B = max(a, b)

def comb(N, A):
	r = 1
	for n in range(A):
		r *= N - n
	for n in range(2, A + 1):
		r //= n
	return r
mod = 10 ** 9 + 7
if 25 == B >= A + 2:
	print(comb(A + B - 1, A) % mod)
elif 24 <= A + 2 == B:
	print(comb(48, 24) * pow(2, A - 24, mod) % mod)
else:
	print(0)


import math

def binomial(n, k):
	return int(math.factorial(n)) // (int(math.factorial(k)) * int(math.factorial(n - k)))

def countWays(S):
	(minS, maxS) = (S[0], S[1])
	if maxS < 25 or (maxS > 25 and maxS - minS != 2) or (maxS == 25 and minS > 23):
		return 0
	if maxS == 25:
		C = binomial(maxS + minS - 1, minS)
		return C % 1000000007
	C = binomial(24 + 24, 24)
	C *= 2 ** (minS - 24)
	return C % 1000000007
(S1, S2) = (int(input().strip()), int(input().strip()))
print(countWays(sorted([S1, S2])))


import sys
import math
N1 = int(sys.stdin.readline().strip())
N2 = int(sys.stdin.readline().strip())
if N2 > N1:
	(N2, N1) = (N1, N2)

def scores(N1, N2):
	if N1 < 25 or N1 - N2 < 2:
		return 0
	elif N1 == 25:
		if N2 > 23:
			return 0
		num = math.factorial(N1 + N2 - 1)
		denom = math.factorial(N2) * math.factorial(N1 - 1)
		return int(num / denom)
	elif N1 > 25:
		if N1 - N2 == 2:
			num = math.factorial(24 + 24)
			denom = math.factorial(24) * math.factorial(24)
			return int(num / denom) * 2 ** (N2 - 24)
		else:
			return 0
print(scores(N1, N2) % 1000000007)


def C(n, k):
	res = 1
	div = 1
	for i in range(k):
		res *= n - i
		div *= k - i
	return res // div

def pow2(n, mod):
	if n == 0:
		return 1
	elif n == 1:
		res = 2
	elif n % 2 == 1:
		res = 2 * pow2(n // 2, mod) ** 2
		res %= mod
	else:
		res = pow2(n // 2, mod) ** 2
		res %= mod
	return res
m = int(input())
n = int(input())
if m < n:
	(m, n) = (n, m)
if m < 25 or (n >= 23 and m - n != 2):
	res = 0
else:
	mod = 10 ** 9 + 7
	if m == 25:
		res = C(n + 24, n) % mod
	else:
		res = 603457371
		res *= pow2(n - 24, mod)
		res %= mod
print(res)


store_result = {}

def sim(a, b):
	a_score = b_score = 0
	if a > 0 and (max(a, b) < 25 or a >= b):
		try:
			a_score = store_result[str(max(a - 1, b)) + '_' + str(min(a - 1, b))]
		except:
			a_score = sim(a - 1, b)
			store_result[str(max(a - 1, b)) + '_' + str(min(a - 1, b))] = a_score
	if b > 0 and (max(a, b) < 25 or b >= a):
		try:
			b_score = store_result[str(max(a, b - 1)) + '_' + str(min(a, b - 1))]
		except:
			b_score = sim(a, b - 1)
			store_result[str(max(a, b - 1)) + '_' + str(min(a, b - 1))] = b_score
	if a == 0 and b == 0:
		return 1
	return a_score + b_score
a = int(input())
b = int(input())
if max(a, b) < 25:
	print(0)
elif min(a, b) >= 24 and abs(a - b) != 2:
	print(0)
else:
	print(int(1 << max(min(a, b) - 24, 0)) * sim(min(24, max(a, b) - 1), min(24, min(a, b))) % 1000000007)


def scores(a, b):
	if a < 25 and b < 25:
		return 0
	if a >= 24 and b >= 24 and (abs(a - b) != 2):
		return 0
	if a == 25 and b < 24:
		return choose_mod(a + b - 1, a - 1)
	if a < 24 and b == 25:
		return choose_mod(a + b - 1, b - 1)
	return choose_mod(48, 24) * 2 ** (min(a, b) - 24) % 1000000007

def choose_mod(n, k):
	j = min(k, n - k)
	c = 1
	for i in range(j):
		c *= n - i
	for i in range(j):
		c //= j - i
	return c % 1000000007
a = int(input())
b = int(input())
print(scores(a, b))


import math

def choose(n, k):
	return int(math.factorial(n) / (math.factorial(k) * math.factorial(n - k)))

def n_games(a, b):
	if a < b:
		(a, b) = (b, a)
	if a < 25:
		return 0
	if a == 25 and b > 23:
		return 0
	if a > 25 and a - b != 2:
		return 0
	if a == 25:
		return choose(24 + b, 24)
	return choose(48, 24) * 2 ** (b - 24)
import sys
a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
print(n_games(a, b) % 1000000007)


import sys
import math

def c_choose(n, r):
	return math.factorial(n) // math.factorial(r) // math.factorial(n - r)

def num_seq(a, b):
	win = max(a, b)
	lose = min(a, b)
	if win < 25:
		return 0
	if win - lose < 2:
		return 0
	if lose >= 24 and win - lose > 2:
		return 0
	if win == 25:
		return c_choose(24 + lose, 24)
	else:
		return c_choose(48, 24) * 2 ** (lose - 24)
_ = sys.stdin.readlines()
a = int(_[0])
b = int(_[1])
print(num_seq(a, b) % 1000000007)


from math import factorial
a = int(input())
b = int(input())
mod = 10 ** 9 + 7

def comb(n, r):
	return factorial(n) // factorial(r) // factorial(n - r)
if a < b:
	(a, b) = (b, a)
if a < 25:
	print(0)
elif a == 25:
	if b > 23:
		print(0)
	else:
		print(comb(24 + b, b) % mod)
elif b != a - 2:
	print(0)
else:
	res = comb(48, 24) % mod
	res = res * pow(2, b - 24, mod) % mod
	print(res)


def nchoosek(n, k, modulus=-1):
	a = 1
	if n < 0 or k < 0 or n < k:
		return 0
	for i in range(0, k):
		a *= n - i
	for j in range(1, k + 1):
		a //= j
	return a

def bitize(x):
	L = []
	while x > 0:
		L.append(x % 2)
		x //= 2
	return L

def faster_pow_mod(a, b, m):
	a %= m
	b %= m - 1
	bl = bitize(b)
	ans = 1
	cur = a
	for i in range(0, len(bl)):
		if bl[i]:
			ans *= cur
			ans %= m
		cur *= cur
		cur %= m
	return ans
A = int(input())
B = int(input())
if A < 25 and B < 25:
	print(0)
elif A == 25 and B < 24:
	print(nchoosek(A + B - 1, A - 1) % (pow(10, 9) + 7))
elif B == 25 and A < 24:
	print(nchoosek(A + B - 1, B - 1) % (pow(10, 9) + 7))
elif (A >= 25 or B >= 25) and abs(A - B) == 2:
	print(faster_pow_mod(2, min(A - 24, B - 24), pow(10, 9) + 7) * nchoosek(48, 24) % (pow(10, 9) + 7))
else:
	print(0)


a = int(input())
b = int(input())
if a < b:
	(a, b) = (b, a)
mod = 10 ** 9 + 7
if a < 25:
	print(0)
elif a == 25:
	if b in [24, 25]:
		print(0)
	else:
		a -= 1
		n = a + b
		ch = 1
		zn = 1
		for i in range(b):
			ch = ch * (n - i) % mod
			zn = zn * (i + 1) % mod
		print(ch * pow(zn, mod - 2, mod) % mod)
elif a - b != 2:
	print(0)
else:
	n = 48
	ch = 1
	zn = 1
	for i in range(24):
		ch = ch * (n - i) % mod
		zn = zn * (i + 1) % mod
	print(pow(2, a - 26, mod) * ch * pow(zn, mod - 2, mod) % mod)


from functools import reduce
import operator as op

def ncr(n, r):
	r = min(r, n - r)
	if r == 0:
		return 1
	numer = reduce(op.mul, range(n, n - r, -1))
	denom = reduce(op.mul, range(1, r + 1))
	return numer // denom
(a, b) = sorted([int(input()), int(input())], reverse=True)
if a < 25 or (a == 25 and a - b < 2) or (a > 25 and a - b != 2):
	n = 0
elif a == 25:
	n = ncr(a + b - 1, b)
else:
	n = 2 ** (b - 24) * ncr(48, 24)
print(n % 1000000007)


def countSequences(a, b):
	if a < 25 and b < 25 or (a >= 24 and b >= 24 and (abs(a - b) != 2)):
		return 0
	MOD = 1000000007
	totalSeqs = 1
	totalPoints = a + b
	low = a if a < b else b
	if low < 24:
		totalPoints -= 1
		totalSeqs = combination(totalPoints, low)
	else:
		totalSeqs = combination(48, 24)
		totalPoints -= 48 - 2
		slots = low - 24
		postTie = pow(2, slots, MOD)
		totalSeqs *= postTie
	return int(totalSeqs % MOD)

def combination(n, r):
	numerator = 1
	rFactorial = 1
	for i in range(r):
		numerator *= n - i
		rFactorial *= 1 + i
	return numerator // rFactorial
aScore = int(input())
bScore = int(input())
totalSeqs = countSequences(aScore, bScore)
print(totalSeqs)


P = 10 ** 9 + 7

def inv_mod(x):
	return pow(x, P - 2, P)

def binom(n, p):
	b = 1
	for i in range(p):
		b = b * (n - i) * inv_mod(p - i) % P
	return b

def main():
	A = int(input())
	B = int(input())
	if B < A:
		(A, B) = (B, A)
	if A < 24:
		res = 0 if B != 25 else binom(A + 24, A)
	else:
		res = 0 if B != A + 2 else pow(2, A - 24, P) * binom(48, 24) % P
	print(res)
main()


import sys
MOD = 1000000007

def choose(n, k):
	if k < 0 or k > n:
		return 0
	else:
		(p, q) = (1, 1)
		for i in range(1, min(k, n - k) + 1):
			p *= n
			q *= i
			n -= 1
		return p // q
A = int(sys.stdin.readline())
B = int(sys.stdin.readline())
(A, B) = (max(A, B), min(A, B))
if A == 25 and B < 24:
	print(choose(A + B - 1, B) % MOD)
elif B >= 24 and A - B == 2:
	print(pow(2, A - 26, MOD) * choose(48, 24) % MOD)
else:
	print(0)


def get_scores():
	a = int(input())
	b = int(input())
	return (a, b)

def invalid(a, b):
	if a == 25 and a - b >= 2:
		return False
	if a > 25 and abs(a - b) == 2:
		return False
	return True

def is_extended(a, b):
	return a > 25

def different_sequences(A, B):
	if B == 0 or A == 0:
		return 1
	table = [[0 for _ in range(B + 1)] for _ in range(A + 1)]
	for a in range(A):
		table[a + 1][0] = 1
	for b in range(B):
		table[0][b + 1] = 1
	for a in range(A):
		for b in range(B):
			table[a + 1][b + 1] = table[a][b + 1] + table[a + 1][b]
	if A == 25:
		return table[A - 1][B]
	return table[A][B]

def nb_matches(a, b):
	modulate = 1000000007
	(a, b) = (max(a, b), min(a, b))
	if invalid(a, b):
		return 0
	if is_extended(a, b):
		deuce = b - 24
		return different_sequences(24, 24) * 2 ** deuce % modulate
	return different_sequences(a, b) % modulate
(a, b) = get_scores()
print(nb_matches(a, b))


from math import factorial

def numWays(A, B):

	def _realAnswer(A, B):
		winner = max(A, B)
		loser = min(A, B)
		if winner < 25 or winner - loser < 2:
			return 0
		if loser < 24:
			return factorial(24 + loser) // (factorial(24) * factorial(loser))
		if winner - loser > 2:
			return 0
		num = factorial(48) // factorial(24) ** 2
		if loser > 24:
			num *= 2 ** (loser - 24)
		return num
	result = _realAnswer(A, B)
	if result > 10 ** 9 + 7:
		return result % (10 ** 9 + 7)
	return result
A = int(input())
B = int(input())
print(numWays(A, B))


import math
a = int(input())
b = int(input())

def nCr(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)

def Comb(a, b):
	m = min(a, b)
	n = max(a, b)
	if m < 24 and n == 25:
		return int(nCr(m + n - 1, m))
	elif m >= 24 and n - m == 2:
		return int(nCr(48, 24) * 2 ** (m - 24))
	else:
		return 0
print(Comb(a, b) % 1000000007)


from math import factorial
import sys

def count_score(l_scores):
	score_1 = int(l_scores[0])
	score_2 = int(l_scores[1])
	if not (score_1 > 24 or score_2 > 24):
		return 0
	if max(score_1, score_2) > 25:
		if not abs(score_1 - score_2) == 2:
			return 0
	elif max(score_1, score_2) == 25:
		if abs(min(score_1, score_2) - 25) < 2:
			return 0
	least_score = min(score_1, score_2)
	if least_score > 24:
		more_perms = 2 ** (least_score - 24)
		least_score = 24
	else:
		more_perms = 1
	first_perms = factorial(least_score + 24) / (factorial(least_score) * factorial(24))
	ans = int(first_perms) * more_perms
	if ans > 10 ** 9 + 7:
		ans = ans % (10 ** 9 + 7)
	return int(ans)
vals = sys.stdin.read().split('\n')
print(count_score(vals))


from math import factorial
NUM_WAYS_TO_REACH_TIE = 32247603683100

def binom(n, k):
	if n < k:
		return 0
	else:
		return int(factorial(n) / (factorial(k) * factorial(n - k)))

def numSeqs(A, B):
	(A, B) = (min(A, B), max(A, B))
	if B < 25 or B - A < 2:
		return 0
	if A < 24:
		return binom(A + B - 1, A) % (10 ** 9 + 7)
	if B - A != 2:
		return 0
	return NUM_WAYS_TO_REACH_TIE * 2 ** (A - 24) % (10 ** 9 + 7)
A = int(input())
B = int(input())
print(numSeqs(A, B))


import operator as op
import functools
from math import factorial

def ncr(n, r):
	r = min(r, n - r)
	numer = functools.reduce(op.mul, range(n, n - r, -1), 1)
	denom = functools.reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def comb(n, r):
	return factorial(n) / factorial(r) / factorial(n - r)

def n_sequence(a, b):
	if b > a:
		(a, b) = (b, a)
	if a < 25 or a - b < 2:
		return 0
	if a > 25 and a - b != 2:
		return 0
	total = a + b
	if a == 25:
		ways = ncr(total - 1, b)
	else:
		ways = ncr(48, 24) * 2 ** (b - 24)
	return int(ways % 1000000007)
a = int(input())
b = int(input())
res = n_sequence(a, b)
print(res)


from functools import reduce
import operator as op

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
import math

def ncr2(n, r):
	return math.factorial(n) // math.factorial(r) // math.factorial(n - r)

def Combinations(m, n):
	L = max(A, B)
	S = min(A, B)
	finish = 0
	if L < 25:
		finish = 0
	elif L == 25:
		if S >= 24:
			finish = 0
		else:
			finish = 1
	elif L > 25:
		if L - S == 2:
			finish = 2
		else:
			finish = 0
	if finish == 1:
		c = ncr2(L + S - 1, S)
		if c > 1000000007:
			c = c % 1000000007
	elif finish == 2:
		c = ncr2(48, 24) * 2 ** (S - 24)
		if c > 1000000007:
			c = c % 1000000007
	else:
		c = 0
	return c
A = int(input())
B = int(input())
c = Combinations(A, B)
print(c)


from math import factorial
A = int(input().strip())
B = int(input().strip())

def combin(a, b):
	num = 1
	for i in range(1, b + 1):
		num *= (a + i) / i
	return int(num)
num = 0
if B > A:
	(A, B) = (B, A)
if A == 25 and B < 24:
	num = combin(24, B)
elif abs(A - B) == 2 and A >= 24 and (B >= 24):
	num = int(factorial(24 + 24) / (factorial(24) * factorial(24)))
	num *= 2 ** (B - 24)
num = num % (10 ** 9 + 7)
print(int(num))


from math import factorial as f
import sys

def nCr(n, r):
	return f(n) // f(r) // f(n - r)

def numWays(A, B):
	m = 10 ** 9 + 7
	if max(A, B) < 25 or abs(A - B) < 2 or (max(A, B) > 25 and abs(A - B) > 2):
		return 0
	elif max(A, B) == 25:
		return nCr(A + B - 1, min(A, B)) % m
	else:
		return 2 ** (max(A, B) - 26) * nCr(48, 24) % m
s = sys.stdin.read()
s = s.split()
A = int(s[0])
B = int(s[1])
print(numWays(A, B))


import sys
import math
A = int(sys.stdin.readline())
B = int(sys.stdin.readline())

def binom(n, k):
	return int(math.factorial(n) / math.factorial(n - k) / math.factorial(k))
(A, B) = (max(A, B), min(A, B))
if A == 25 and B < 24:
	print(binom(A + B - 1, A - 1) % (10 ** 9 + 7))
elif A > 25 and A - B == 2:
	print(binom(48, 24) * 2 ** (B - 24) % (10 ** 9 + 7))
else:
	print(0)


import math
modBase = 10 ** 9 + 7
winPt = 25
deucePt = winPt - 1

def score_comb(lose):
	comb = [[1] * winPt] + [[1] + [0] * (winPt - 1)] * lose
	for i in range(lose):
		for j in range(1, winPt):
			comb[i + 1][j] = comb[i][j] + comb[i + 1][j - 1]
	return comb[-1][-1]

def legal_comb(A, B):
	if A < 0 or B < 0:
		return 0
	win = max(A, B)
	lose = min(A, B)
	if win == winPt and lose < deucePt:
		return score_comb(lose) % modBase
	elif win > winPt and win - lose == 2:
		return score_comb(deucePt) * 2 ** (lose - deucePt) % modBase
	else:
		return 0
A = int(input())
B = int(input())
print(int(legal_comb(A, B)))


def extendedGCD(a, b):
	(m00, m01, m10, m11) = (1, 0, 0, 1)
	while b != 0:
		k = a // b
		(m00, m01, m10, m11) = (m10, m11, m00 - k * m10, m01 - k * m11)
		(a, b) = (b, a - k * b)
	return (m00, m01, a)

def modinv(x, p):
	(a, b, g) = extendedGCD(x, p)
	return a

def mod_comb(n, k, p):
	k = min(n - k, k)
	numerator = 1
	denominator = 1
	for i in range(k):
		numerator = numerator * (n - i) % p
		denominator = denominator * (i + 1) % p
	result = numerator * modinv(denominator, p) % p
	return result

def numGamesWithScore(A, B, p):
	(A, B) = (max(A, B), min(A, B))
	if A < 25:
		return 0
	if A > 25 and B < 24:
		return 0
	if A == 25 and B < 24:
		return mod_comb(A + B - 1, B, p)
	if A > 23 and B > 23:
		if abs(A - B) != 2:
			return 0
		start = mod_comb(48, 24, p)
		return start * 2 ** (B - 24) % p
	return (A, B)
A = int(input())
B = int(input())
print(numGamesWithScore(A, B, 10 ** 9 + 7))


import sys
MOD = 1000000007

def choose(n, k):
	if k < 0 or k > n:
		return 0
	else:
		(p, q) = (1, 1)
		for i in range(1, min(k, n - k) + 1):
			p *= n
			q *= i
			n -= 1
		return p // q
A = int(sys.stdin.readline())
B = int(sys.stdin.readline())
(A, B) = (max(A, B), min(A, B))
if A == 25 and B < 24:
	print(choose(A + B - 1, B) % MOD)
elif B >= 24 and A - B == 2:
	print(pow(2, A - 26, MOD) * choose(48, 24) % MOD)
else:
	print(0)


import sys
import math

def nchoosek(n, k):
	if n < 0 or k < 0 or n < k:
		return 0
	dl = 0
	for i in range(n - k + 1, n + 1):
		dl += math.log(i)
	nl = 0
	for i in range(1, k + 1):
		nl += math.log(i)
	z = int(round(math.exp(dl - nl)))
	if z > 10 ** 9 + 7:
		z = z % (10 ** 9 + 7)
	return z
a = int(sys.stdin.readline().strip())
b = int(sys.stdin.readline().strip())
w = max(a, b)
l = min(a, b)
if w < 25:
	print(0)
elif w == 25:
	if l >= 24:
		print(0)
	else:
		z = nchoosek(24 + l, l)
		print(z)
elif l != w - 2:
	print('0')
else:
	z0 = nchoosek(48, 24)
	t = 2 ** (l - 24) % (10 ** 9 + 7)
	z = z0 * t % (10 ** 9 + 7)
	print(z)


import math

def choose(n, k):
	return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

def n_games(a, b):
	if a < b:
		(a, b) = (b, a)
	if a < 25:
		return 0
	if a == 25 and b > 23:
		return 0
	if a > 25 and a - b != 2:
		return 0
	if a == 25:
		return choose(24 + b, 24)
	return choose(48, 24) * 2 ** (b - 24)
import sys
a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
print(n_games(a, b) % 1000000007)


import math

def choose(n, k):
	return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

def n_games(a, b):
	if a < b:
		(a, b) = (b, a)
	if a < 25:
		return 0
	if a == 25 and b > 23:
		return 0
	if a > 25 and a - b != 2:
		return 0
	if a == 25:
		return choose(24 + b, 24)
	return choose(48, 24) * 2 ** (b - 24)
import sys
a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
print(n_games(a, b) % 1000000007)


import sys, math
import operator as op

def choose(n, k):
	return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

def n_games(a, b):
	if a < b:
		(a, b) = (b, a)
	if a < 25:
		return 0
	if a == 25 and b > 23:
		return 0
	if a > 25 and a - b != 2:
		return 0
	if a == 25:
		return choose(24 + b, 24)
	return choose(48, 24) % 1000000007 * pow(2, b - 24, 1000000007)
import sys
a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
print(n_games(a, b) % 1000000007)


import math

def choose(n, k):
	return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

def n_games(a, b):
	if a < b:
		(a, b) = (b, a)
	if a < 25:
		return 0
	if a == 25 and b > 23:
		return 0
	if a > 25 and a - b != 2:
		return 0
	if a == 25:
		return choose(24 + b, 24)
	return choose(48, 24) * 2 ** (b - 24)
import sys
a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
print(n_games(a, b) % 1000000007)


import math

def choose(n, k):
	return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

def n_games(a, b):
	if a < b:
		(a, b) = (b, a)
	if a < 25:
		return 0
	if a == 25 and b > 23:
		return 0
	if a > 25 and a - b != 2:
		return 0
	if a == 25:
		return choose(24 + b, 24)
	return choose(48, 24) * 2 ** (b - 24)
import sys
a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
print(n_games(a, b) % 1000000007)


from math import factorial as fac

def nchoosek(n, k):
	return fac(n) // fac(k) // fac(n - k)

def volleyball(scores):
	(W, L) = (max(scores), min(scores))
	if W == 25 and L < 24:
		return nchoosek(24 + L, 24)
	elif W > 25 and W - L == 2:
		return nchoosek(48, 24) * 2 ** (L - 24)
	else:
		return 0
a = int(input())
b = int(input())
print(volleyball([a, b]) % 1000000007)


import math

def choose(n, k):
	return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

def n_games(a, b):
	if a < b:
		(a, b) = (b, a)
	if a < 25:
		return 0
	if a == 25 and b > 23:
		return 0
	if a > 25 and a - b != 2:
		return 0
	if a == 25:
		return choose(24 + b, 24)
	return choose(48, 24) * 2 ** (b - 24)
import sys
a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
print(n_games(a, b) % 1000000007)


import sys
from itertools import combinations
from math import factorial
A = sys.stdin.readline()
B = sys.stdin.readline()

def combi(A, B):
	return factorial(A) // factorial(B) // factorial(abs(A - B))

def howMany(A, B):
	A = int(A)
	B = int(B)
	count = 0
	if A < 25 and B < 25:
		count = 0
	elif A >= 24 and B >= 24:
		tempA = A - 24
		tempB = B - 24
		if abs(tempA - tempB) == 2:
			count = combi(48, 24)
			if tempA > tempB:
				count *= 2 ** tempB
			if tempA < tempB:
				count *= 2 ** tempA
	else:
		total = A + B
		count = combi(total - 1, 24)
	count = count % 1000000007
	return count
print(howMany(A, B))


import operator as op
from functools import reduce
MAX_ALLOWED = 10 ** 9 + 7

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

def find_number_of_ways(n, m):
	if n < m:
		(n, m) = (m, n)
	if n < 25 or n - m <= 1:
		return 0
	if n != 25 and n - m > 2:
		return 0
	ways = 0
	try:
		if n == 25:
			ways = ncr(n + m - 1, m)
		else:
			ways = ncr(25 + 24 - 1, 24) * 2 ** (m - 24)
	except OverflowError:
		pass
	ways = ways % MAX_ALLOWED
	return ways
import sys
n = int(sys.stdin.readline().strip())
m = int(sys.stdin.readline().strip())
print(find_number_of_ways(n, m))


import math
T1 = int(input())
T2 = int(input())
lim = 10 ** 9 + 7
if T1 > T2:
	big = T1
	small = T2
elif T2 > T1:
	big = T2
	small = T1
else:
	print(0)
	exit()
if big - small != 2 and big > 25:
	print(0)
	exit()
elif big - small == 1:
	print(0)
	exit()

def nCr(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)

def vball(T1, T2):
	if T1 < 25 and T2 < 25:
		return 0
	elif T1 >= 24 and T2 >= 24:
		until_24 = nCr(48, 24)
		remaining_possible = 2 ** (small - 24)
		num_ways = until_24 * remaining_possible
		if num_ways > lim:
			return int(num_ways % lim)
		else:
			return int(num_ways)
	n = big + small - 1
	r = small
	num_ways = int(nCr(n, r))
	if num_ways > lim:
		return int(num_ways % lim)
	else:
		return int(num_ways)
print(vball(T1, T2))


from math import factorial as F

def accumulate(scoreA, scoreB):
	if scoreA == 0 or scoreB == 0:
		return 1
	if scoreA >= 25 and scoreA >= scoreB + 2:
		return 0
	if scoreB >= 25 and scoreB >= scoreA + 2:
		return 0
	return accumulate(scoreA - 1, scoreB) + accumulate(scoreA, scoreB - 1)
scoreA = int(input())
scoreB = int(input())
if scoreA > 1000000000 or scoreB > 1000000000 or scoreA < 0 or (scoreB < 0):
	exit()
if scoreA < scoreB:
	(scoreA, scoreB) = (scoreB, scoreA)
if scoreA < 25 and scoreB < 25 or (scoreA == 25 and scoreB >= 24) or (scoreA > 25 and scoreA != scoreB + 2):
	print(0)
	exit()
scoreA -= 1
multiplier = 1
if scoreB >= 24:
	multiplier = 2 ** (scoreB - 24)
	scoreA = 25
	scoreB = 24
n_rounds = 24 + scoreB
N = F(n_rounds) // F(24) // F(scoreB)
N *= multiplier
billion7 = 1000000000 + 7
if N <= billion7:
	print(N)
else:
	print(N % billion7)


import math

def myfunc(a, b):
	if max(a, b) < 25:
		return 0
	if a - b < 2:
		return 0
	if a == 25:
		r = math.factorial(a + b - 1) / (math.factorial(a - 1) * math.factorial(b))
		return int(r) % (10 ** 9 + 7)
	if a > 25:
		if a - b != 2:
			return 0
		else:
			r = math.factorial(48) * 2 ** (b - 24) // (math.factorial(24) * math.factorial(24))
			return int(r) % (10 ** 9 + 7)
x = int(input().strip())
y = int(input().strip())
a = max(x, y)
b = min(x, y)
print(myfunc(a, b))


import math

def nCr(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)

def seqs(arr):
	a = arr[0]
	b = arr[1]
	const = 1000000007
	if a < b:
		(a, b) = (b, a)
	if a < 25 or (b >= 24 and abs(a - b) != 2):
		ans = 0
	elif a == 25:
		ans = nCr(24 + b, 24)
	else:
		ans = nCr(48, 24) * 2 ** (b - 24)
	return ans % const
a = int(input())
b = int(input())
print(seqs([a, b]))


import math

def choose(n, k):
	return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

def n_games(a, b):
	if a < b:
		(a, b) = (b, a)
	if a < 25:
		return 0
	if a == 25 and b > 23:
		return 0
	if a > 25 and a - b != 2:
		return 0
	if a == 25:
		return choose(24 + b, 24)
	return choose(48, 24) * 2 ** (b - 24)
import sys
a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
print(n_games(a, b) % 1000000007)


from math import factorial

def choose(n, k):
	return int(factorial(n) / (factorial(n - k) * factorial(k)))

def num_comb(a, b):
	if a < b:
		(a, b) = (b, a)
	if a < 25:
		return 0
	if a == 25 and b > 23:
		return 0
	if a > 25 and a - b != 2:
		return 0
	if a == 25:
		return choose(24 + b, 24)
	return choose(48, 24) * 2 ** (b - 24)
a = int(input())
b = int(input())
print(num_comb(a, b) % 1000000007)


import math

def choose(n, k):
	return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

def n_games(a, b):
	if a < b:
		(a, b) = (b, a)
	if a < 25:
		return 0
	if a == 25 and b > 23:
		return 0
	if a > 25 and a - b != 2:
		return 0
	if a == 25:
		return choose(24 + b, 24)
	return choose(48, 24) * 2 ** (b - 24)
import sys
a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
print(n_games(a, b) % 1000000007)


hist = {}

def binom(n, k, m):
	if k == 0 or k == n:
		return 1
	q = (n, k)
	if q in hist:
		return hist[q]
	rv = (binom(n - 1, k, m) + binom(n - 1, k - 1, m)) % m
	hist[q] = rv
	return rv

def exp(b, n, m):
	rv = 1
	base = 2
	while n > 0:
		if n % 2 == 1:
			rv = rv * base % m
		base = base * base % m
		n //= 2
	return rv

def count(a, b):
	mod = 1000000007
	if a < b:
		(a, b) = (b, a)
	if a < 25:
		return 0
	if a == b or a == b + 1:
		return 0
	if a == 25:
		return binom(a + b - 1, b, mod)
	if a != b + 2:
		return 0
	x = binom(48, 24, mod)
	y = exp(2, b - 24, mod)
	return x * y % mod
a = int(input())
b = int(input())
print(count(a, b))


def inv_mod(a, n):
	t = n
	x = 1
	xx = 0
	while n != 0:
		q = a // n
		(a, n) = (n, a % n)
		(xx, x) = (x - q * xx, xx)
	if a != 1:
		return 0
	return x % t
f = [1, 1]
for i in range(2, 49):
	f.append(f[i - 1] * i)
mod = 10 ** 9 + 7
mx = f[48] // f[24] // f[24] % mod
a = int(input())
b = int(input())
(a, b) = (max(a, b), min(a, b))
if a - b > 1 and a == 25 or (a > 25 and a - b == 2):
	if a - b > 1 and a == 25:
		print(f[a - 1 + b] // f[a - 1] // f[b] % mod)
	else:
		print(mx * pow(2, b - 24, mod) % mod)
else:
	print(0)


import math

def choose(n, k):
	return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

def n_games(a, b):
	if a < b:
		(a, b) = (b, a)
	if a < 25:
		return 0
	if a == 25 and b > 23:
		return 0
	if a > 25 and a - b != 2:
		return 0
	if a == 25:
		return choose(24 + b, 24)
	return choose(48, 24) * 2 ** (b - 24)
import sys
a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
print(n_games(a, b) % 1000000007)


import math

def choose(n, k):
	return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

def n_games(a, b):
	if a < b:
		(a, b) = (b, a)
	if a < 25:
		return 0
	if a == 25 and b > 23:
		return 0
	if a > 25 and a - b != 2:
		return 0
	if a == 25:
		return choose(24 + b, 24)
	return choose(48, 24) * 2 ** (b - 24)
import sys
a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
print(n_games(a, b) % 1000000007)


import math

def choose(n, k):
	return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

def n_games(a, b):
	if a < b:
		(a, b) = (b, a)
	if a < 25:
		return 0
	if a == 25 and b > 23:
		return 0
	if a > 25 and a - b != 2:
		return 0
	if a == 25:
		return choose(24 + b, 24)
	return choose(48, 24) * 2 ** (b - 24)
import sys
a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
print(n_games(a, b) % 1000000007)


import sys
import math

def nchoosek(n, k):
	return math.factorial(n) // math.factorial(k) // math.factorial(n - k)
A = int(sys.stdin.readline())
B = int(sys.stdin.readline())
winner = loser = res = 0
if A > B:
	winner = A
	loser = B
else:
	winner = B
	loser = A
if winner < 25 or winner - loser < 2:
	sys.stdout.write(str(0))
elif winner - loser != 2 and winner > 25:
	sys.stdout.write(str(0))
else:
	if winner == 25:
		res = nchoosek(24 + loser, 24)
	else:
		res = nchoosek(48, 24) * 2 ** (loser - 24)
	sys.stdout.write(str(int(res % 1000000007)))


store_result = {}

def sim(a, b):
	a_score = b_score = 0
	if a > 0 and (max(a, b) < 25 or a >= b):
		try:
			a_score = store_result[str(max(a - 1, b)) + '_' + str(min(a - 1, b))]
		except:
			a_score = sim(a - 1, b)
			store_result[str(max(a - 1, b)) + '_' + str(min(a - 1, b))] = a_score
	if b > 0 and (max(a, b) < 25 or b >= a):
		try:
			b_score = store_result[str(max(a, b - 1)) + '_' + str(min(a, b - 1))]
		except:
			b_score = sim(a, b - 1)
			store_result[str(max(a, b - 1)) + '_' + str(min(a, b - 1))] = b_score
	if a == 0 and b == 0:
		return 1
	return a_score + b_score
a = int(input())
b = int(input())
if max(a, b) < 25:
	print(0)
elif min(a, b) >= 24 and abs(a - b) != 2:
	print(0)
else:
	print(int(1 << max(min(a, b) - 24, 0)) * sim(min(24, max(a, b) - 1), min(24, min(a, b))) % 1000000007)


def choose(n, k):
	import math
	return math.factorial(n) // math.factorial(n - k) // math.factorial(k)

def count_sequence(A, B):
	import math
	if A < B:
		(A, B) = (B, A)
	if A < 25:
		return 0
	if A > 25 and A - B != 2:
		return 0
	if A == 25 and B > 23:
		return 0
	if A == 25:
		return choose(24 + B, B)
	return choose(48, 24) * 2 ** (B - 24)
import sys
A = int(sys.stdin.readline())
B = int(sys.stdin.readline())
print(count_sequence(A, B) % 1000000007)


import sys
from math import factorial

def n_choose_k(n, k):
	return factorial(n) // factorial(k) // factorial(n - k)

def num_games(a, b):
	A = max(a, b)
	B = min(a, b)
	if A < 25:
		return 0
	elif A == 25 and B > 23:
		return 0
	elif A > 25 and A - B != 2:
		return 0
	if A == 25:
		return n_choose_k(24 + B, B)
	if A > 25:
		return n_choose_k(48, 24) * 2 ** (B - 24)
A = int(sys.stdin.readline())
B = int(sys.stdin.readline())
print(num_games(A, B) % (10 ** 9 + 7))


store_result = {}

def sim(a, b):
	a_score = b_score = 0
	if a > 0 and (max(a, b) < 25 or a >= b):
		try:
			a_score = store_result[str(max(a - 1, b)) + '_' + str(min(a - 1, b))]
		except:
			a_score = sim(a - 1, b)
			store_result[str(max(a - 1, b)) + '_' + str(min(a - 1, b))] = a_score
	if b > 0 and (max(a, b) < 25 or b >= a):
		try:
			b_score = store_result[str(max(a, b - 1)) + '_' + str(min(a, b - 1))]
		except:
			b_score = sim(a, b - 1)
			store_result[str(max(a, b - 1)) + '_' + str(min(a, b - 1))] = b_score
	if a == 0 and b == 0:
		return 1
	return a_score + b_score
a = int(input())
b = int(input())
if max(a, b) < 25:
	print(0)
elif min(a, b) >= 24 and abs(a - b) != 2:
	print(0)
else:
	print(int(1 << max(min(a, b) - 24, 0)) * sim(min(24, max(a, b) - 1), min(24, min(a, b))) % 1000000007)


A = int(input())
B = int(input())
if A < B:
	(A, B) = (B, A)
import operator as op
from functools import reduce

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
if A < 25:
	print(0)
elif A > 25 and A - B != 2:
	print(0)
elif A == 25 and B > 23:
	print(0)
elif A == 25:
	print(ncr(24 + B, 24) % 1000000007)
else:
	print(ncr(48, 24) * 2 ** (B - 24) % 1000000007)


from math import factorial as fac

def ncr(n, r):
	return fac(n) // fac(r) // fac(n - r)
MOD = 10 ** 9 + 7
TIE_PATTERN = ncr(48, 24) % MOD

def solve(a, b):
	if a < b:
		(b, a) = (a, b)
	if a < 25 or (a == 25 and b >= 24) or (a > 25 and a - b != 2):
		return 0
	if a == 25:
		return ncr(24 + b, b) % MOD
	else:
		return TIE_PATTERN * 2 ** (b - 24) % MOD
(a, b) = [int(input().strip()) for _ in range(2)]
print(solve(a, b))


M = 10 ** 9 + 7
(A, B) = (int(input()), int(input()))
if A > B:
	(A, B) = (B, A)

def powM(b, e):
	if e == 0:
		return 1
	if e == 1:
		return b
	r = powM(b, e >> 1) ** 2
	if e & 1:
		r = r * b
	return r % M

def C(n, m):
	if n <= m:
		return 1
	if n >= M or m >= M:
		return C(n // M, m // M) * C(n % M, m % M) % M
	(r1, r2, m) = (1, 1, min(m, n - m))
	for j in range(1, m + 1):
		(r1, r2) = (r1 * (n - j + 1) % M, r2 * j % M)
	return r1 * powM(r2, M - 2) % M

def solution(a, b):
	if b < 25:
		return 0
	if a > 23 and b - a != 2:
		return 0
	if a > 23:
		return powM(2, a - 24) * C(48, 24) % M
	else:
		return C(a + b - 1, a)
print(solution(A, B))


n = int(input())
m = int(input())
p = 10 ** 9 + 7
Scores = [[0 for i in range(25)] for j in range(25)]
Scores[0][0] = 1
for i in range(25):
	for j in range(25):
		if i > 0:
			Scores[i][j] += Scores[i - 1][j]
		if j > 0:
			Scores[i][j] += Scores[i][j - 1]
(n, m) = (min(n, m), max(n, m))
if m == 25 and n <= 23:
	print(Scores[n][24] % p)
elif m < 25:
	print(0)
elif m - n != 2:
	print(0)
else:
	print(Scores[24][24] * pow(2, m - 26, p) % p)


def score(a, b):
	n = 25
	if a < 25 and b < 25:
		return 0
	elif abs(a - b) < 2 or abs(a - b) > 25:
		return 0
	elif (a > 25 and b > 25) and abs(a - b) > 2:
		return 0
	else:
		L_0 = [1] * n
		for i in range(n - 1):
			L_i = [0] * n
			L_i[0] = 1
			for j in range(n - 1):
				L_i[j + 1] = L_i[j] + L_0[j + 1]
			L_0 = L_i
		if min(a, b) - 24 > 0:
			nbr = 2 ** (min(a, b) - 24) * L_0[24]
		else:
			nbr = L_0[min(a, b)]
		if nbr > 10 ** 9 + 7:
			return nbr % (10 ** 9 + 7)
		else:
			return nbr
a = int(input())
b = int(input())
print(score(a, b))


import math

def choose(n, k):
	return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

def n_games(a, b):
	if a > b:
		(a, b) = (a, b)
	else:
		(a, b) = (b, a)
	if a < 25:
		return 0
	if a - b == 1:
		return 0
	if a == b:
		return 0
	if a > 25 and a - b != 2:
		return 0
	if a == 25 and a - b >= 2:
		return choose(24 + b, 24)
	return choose(48, 24) * 2 ** (b - 24)
import sys
a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
print(n_games(a, b) % 1000000007)


import math

def choose(n, k):
	return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

def n_games(a, b):
	if a < b:
		(a, b) = (b, a)
	if a < 25:
		return 0
	if a == 25 and b > 23:
		return 0
	if a > 25 and a - b != 2:
		return 0
	if a == 25:
		return choose(24 + b, 24)
	return choose(48, 24) * 2 ** (b - 24)
import sys
a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
print(n_games(a, b) % 1000000007)


store_result = {}

def sim(a, b):
	a_score = b_score = 0
	if a > 0 and (max(a, b) < 25 or a >= b):
		try:
			a_score = store_result[str(max(a - 1, b)) + '_' + str(min(a - 1, b))]
		except:
			a_score = sim(a - 1, b)
			store_result[str(max(a - 1, b)) + '_' + str(min(a - 1, b))] = a_score
	if b > 0 and (max(a, b) < 25 or b >= a):
		try:
			b_score = store_result[str(max(a, b - 1)) + '_' + str(min(a, b - 1))]
		except:
			b_score = sim(a, b - 1)
			store_result[str(max(a, b - 1)) + '_' + str(min(a, b - 1))] = b_score
	if a == 0 and b == 0:
		return 1
	return a_score + b_score
a = int(input())
b = int(input())
if max(a, b) < 25:
	print(0)
elif min(a, b) >= 24 and abs(a - b) != 2:
	print(0)
else:
	print(int(1 << max(min(a, b) - 24, 0)) * sim(min(24, max(a, b) - 1), min(24, min(a, b))) % 1000000007)


import math
a = int(input())
b = int(input())
if a < b:
	(a, b) = (b, a)
if a == 25:
	if b < 24:
		ans = math.factorial(24 + b) // math.factorial(24) // math.factorial(b)
	else:
		ans = 0
elif a > 25:
	if a - b == 2:
		full_match_combinations = math.factorial(48) // math.factorial(24) // math.factorial(24)
		ans = full_match_combinations * 2 ** (b - 24)
	else:
		ans = 0
else:
	ans = 0
print(ans % 1000000007)


def memoize(func):
	func.input_cache = {}

	def memoize_wrapper(*args, **kwargs):
		str_input = str(args) + str(kwargs)
		if str_input not in func.input_cache.keys():
			func.input_cache[str_input] = func(*args, **kwargs)
		return func.input_cache[str_input]
	return memoize_wrapper

@memoize
def _findWays(score):
	if min(score) == 0:
		return 1
	num_ways = _findWays([score[0] - 1, score[1]]) + _findWays([score[0], score[1] - 1])
	return num_ways

def findWays(score):
	score = sorted(score)
	if max(score) < 25:
		return 0
	elif max(score) - min(score) <= 1:
		return 0
	elif max(score) > 25 and max(score) - min(score) != 2:
		return 0
	elif max(score) > 25 and max(score) - min(score) == 2:
		num_ways = _findWays([24, 24]) * 2 ** (score[0] - 24)
	else:
		num_ways = _findWays([score[0], score[1] - 1])
	return num_ways % (10 ** 9 + 7)
score = [int(input()), int(input())]
print(findWays(score))


import math

def choose(n, k):
	return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

def n_games(a, b):
	if a < b:
		(a, b) = (b, a)
	if a < 25:
		return 0
	if a == 25 and b > 23:
		return 0
	if a > 25 and a - b != 2:
		return 0
	if a == 25:
		return choose(24 + b, 24)
	return choose(48, 24) * 2 ** (b - 24)
import sys
a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
print(n_games(a, b) % 1000000007)


import math

def choose(n, k):
	return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

def n_games(a, b):
	if a < b:
		(a, b) = (b, a)
	if a < 25:
		return 0
	if a == 25 and b > 23:
		return 0
	if a > 25 and a - b != 2:
		return 0
	if a == 25:
		return choose(24 + b, 24)
	return choose(48, 24) * 2 ** (b - 24)
import sys
a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
print(n_games(a, b) % 1000000007)


import math

def choose(n, k):
	return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

def n_games(a, b):
	if a < b:
		(a, b) = (b, a)
	if a < 25:
		return 0
	if a == 25 and b > 23:
		return 0
	if a > 25 and a - b != 2:
		return 0
	if a == 25:
		return choose(24 + b, 24)
	return choose(48, 24) * 2 ** (b - 24)
import sys
a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
print(n_games(a, b) % 1000000007)