#lにa回、rにb回進む

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

#x = a +2b

#y = 2a+b

#x+y = 3a+3b

#a+b = (x+y)/3

#b=x-a+b

b = x-(x+y)/3

a = (x-2*b)

ans = 0

#print("a:{} b:{}".format(a,b))

if a<0 or b<0 or b-int(b)>0.00001 or a-int(a)>0.00001:

  print(ans)

  exit()

 

MAX = 1000000;

MOD = 1000000007;

 

fac = [0 for i in range(MAX)]

finv = [0 for i in range(MAX)]

inv = [0 for i in range(MAX)]

 

#テーブルを作る前処理

def COMinit():

    fac[0],fac[1] = 1,1

    finv[0],finv[1] = 1,1

    inv[1] = 1

    for i in range(2,MAX):

      fac[i] = fac[i - 1] * i % MOD

      inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD

      finv[i] = finv[i - 1] * inv[i] % MOD

 

#二項係数計算

def COM(n,k):

  if n < k:

    return 0

  if n < 0 or k < 0:

    return 0

  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD

 

COMinit()

print((COM(int(a+b),int(a))))
#lにa回、rにb回進む

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

#x = a +2b

#y = 2a+b

#x+y = 3a+3b

#a+b = (x+y)/3

#b=x-a+b

b = x-(x+y)/3

a = (x-2*b)

ans = 0

#print("a:{} b:{}".format(a,b))

if a<0 or b<0 or b-int(b)>0.00001 or a-int(a)>0.00001:

  print(ans)

  exit()



MAX = int(a+b)+1

MOD = 1000000007



fac = [0 for i in range(MAX)]

finv = [0 for i in range(MAX)]

inv = [0 for i in range(MAX)]



#テーブルを作る前処理

def COMinit():

    fac[0],fac[1] = 1,1

    finv[0],finv[1] = 1,1

    inv[1] = 1

    for i in range(2,MAX):

      fac[i] = fac[i - 1] * i % MOD

      inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD

      finv[i] = finv[i - 1] * inv[i] % MOD



#二項係数計算

def COM(n,k):

  if n < k:

    return 0

  if n < 0 or k < 0:

    return 0

  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD



COMinit()

print((COM(int(a+b),int(a))))
# lにa回、rにb回進む
x, y = list(map(int, input().split()))
# x = a +2b
# y = 2a+b
# x+y = 3a+3b
# a+b = (x+y)/3
# b=x-a+b
b = x - (x + y) / 3
a = x - 2 * b
ans = 0
# print("a:{} b:{}".format(a,b))
if a < 0 or b < 0 or b - int(b) > 0.00001 or a - int(a) > 0.00001:
    print(ans)
    exit()
MAX = 1000000
MOD = 1000000007
fac = [0 for i in range(MAX)]
finv = [0 for i in range(MAX)]
inv = [0 for i in range(MAX)]
# テーブルを作る前処理
def COMinit():
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD


# 二項係数計算
def COM(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD


COMinit()
print((COM(int(a + b), int(a))))

# lにa回、rにb回進む
x, y = list(map(int, input().split()))
# x = a +2b
# y = 2a+b
# x+y = 3a+3b
# a+b = (x+y)/3
# b=x-a+b
b = x - (x + y) / 3
a = x - 2 * b
ans = 0
# print("a:{} b:{}".format(a,b))
if a < 0 or b < 0 or b - int(b) > 0.00001 or a - int(a) > 0.00001:
    print(ans)
    exit()
MAX = int(a + b) + 1
MOD = 1000000007
fac = [0 for i in range(MAX)]
finv = [0 for i in range(MAX)]
inv = [0 for i in range(MAX)]
# テーブルを作る前処理
def COMinit():
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD


# 二項係数計算
def COM(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD


COMinit()
print((COM(int(a + b), int(a))))

-MAX = 1000000 +MAX = int(a + b) + 1