#ABC145D



MOD = 10 ** 9 + 7

import math

x,y = list(map(int,input().split()))

a,b = -1,-1



for i in range(x+1):

    m = 0

    if (x-i) % 2 == 0:

        m = (x-i) // 2

        if 2*i + m == y:

            if i >= 0 and m >= 0:

                a = i

                b = m

                break

    else:

        continue

        

MAX_N = 10**6



fact = [1]

fact_inv = [0]*(MAX_N+4)

for i in range(MAX_N+3):

    fact.append(fact[-1]*(i+1)%MOD)



fact_inv[-1] = pow(fact[-1],MOD-2,MOD)

for i in range(MAX_N+2,-1,-1):

    fact_inv[i] = fact_inv[i+1]*(i+1)%MOD



def com(n,k,mod):

    return fact[n] * fact_inv[k] % mod * fact_inv[n-k] %mod  

        

        

if a == -1 and b == -1:

    print((0))

else:

    print((com(a+b,a,MOD)))
#ABC145D



MOD = 10 ** 9 + 7

import math

x,y = list(map(int,input().split()))

a,b = -1,-1



for i in range(x+1):

    m = 0

    if (x-i) % 2 == 0:

        m = (x-i) // 2

        if 2*i + m == y:

            if i >= 0 and m >= 0:

                a = i

                b = m

                break

    else:

        continue

        

def kai(x):

    an = 1

    for i in range(1,x+1):

        an = an * i % MOD

        

    return an



def pow_k(x, n):

    if n == 0:

        return 1



    K = 1

    while n > 1:

        if n % 2 != 0:

            K = K * x % MOD

        x = x ** 2 % MOD

        n //= 2



    return K * x % MOD



al = kai(a)

be = kai(b)



if a == -1 and b == -1:

    print((0))

else:

    print((( kai(a+b) * pow_k(al,MOD-2)) % MOD * pow_k(be,MOD-2) % MOD ))
# ABC145D
MOD = 10**9 + 7
import math

x, y = list(map(int, input().split()))
a, b = -1, -1
for i in range(x + 1):
    m = 0
    if (x - i) % 2 == 0:
        m = (x - i) // 2
        if 2 * i + m == y:
            if i >= 0 and m >= 0:
                a = i
                b = m
                break
    else:
        continue
MAX_N = 10**6
fact = [1]
fact_inv = [0] * (MAX_N + 4)
for i in range(MAX_N + 3):
    fact.append(fact[-1] * (i + 1) % MOD)
fact_inv[-1] = pow(fact[-1], MOD - 2, MOD)
for i in range(MAX_N + 2, -1, -1):
    fact_inv[i] = fact_inv[i + 1] * (i + 1) % MOD


def com(n, k, mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n - k] % mod


if a == -1 and b == -1:
    print((0))
else:
    print((com(a + b, a, MOD)))

# ABC145D
MOD = 10**9 + 7
import math

x, y = list(map(int, input().split()))
a, b = -1, -1
for i in range(x + 1):
    m = 0
    if (x - i) % 2 == 0:
        m = (x - i) // 2
        if 2 * i + m == y:
            if i >= 0 and m >= 0:
                a = i
                b = m
                break
    else:
        continue


def kai(x):
    an = 1
    for i in range(1, x + 1):
        an = an * i % MOD
    return an


def pow_k(x, n):
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K = K * x % MOD
        x = x**2 % MOD
        n //= 2
    return K * x % MOD


al = kai(a)
be = kai(b)
if a == -1 and b == -1:
    print((0))
else:
    print(((kai(a + b) * pow_k(al, MOD - 2)) % MOD * pow_k(be, MOD - 2) % MOD))

-MAX_N = 10**6 -fact = [1] -fact_inv = [0] * (MAX_N + 4) -for i in range(MAX_N + 3): -    fact.append(fact[-1] * (i + 1) % MOD) -fact_inv[-1] = pow(fact[-1], MOD - 2, MOD) -for i in range(MAX_N + 2, -1, -1): -    fact_inv[i] = fact_inv[i + 1] * (i + 1) % MOD -def com(n, k, mod): -    return fact[n] * fact_inv[k] % mod * fact_inv[n - k] % mod +def kai(x): +    an = 1 +    for i in range(1, x + 1): +        an = an * i % MOD +    return an +def pow_k(x, n): +    if n == 0: +        return 1 +    K = 1 +    while n > 1: +        if n % 2 != 0: +            K = K * x % MOD +        x = x**2 % MOD +        n //= 2 +    return K * x % MOD + + +al = kai(a) +be = kai(b) -    print((com(a + b, a, MOD))) +    print(((kai(a + b) * pow_k(al, MOD - 2)) % MOD * pow_k(be, MOD - 2) % MOD))