### BUGGY CODE ###

import numpy as np
i8 = np.int64
MOD = 1000000007


def init(fac, inv, finv):
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, fac.shape[0]):
        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, fac, finv):
    if n < k:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD

def main2():
    stdin = open('/dev/stdin')
    X, Y = map(int, stdin.readline().split())
    a = X + Y
    if a % 3:
        print(0)
    else:
        d = a // 3
        if X < d or Y < d:
            print(0)
        else:
            fac = np.empty(d + 1, i8)
            inv = np.empty(d + 1, i8)
            finv = np.empty(d + 1, i8)
            init(fac, inv, finv)
            ans = com(d, X - d, fac, finv)
            print(ans)

main2()

### FIXED CODE ###

import subprocess
import gzip, base64, os
import stat

gz = b'H4sIAEMB0F0C/+19C3gUVbZudTqPBkK6QdTwkoBBggwhnQRIdNSEpKFaOhAJID6wSDodEu2k86WrMfjESeLYNlGOx+s4zpwZ7sxcRz0zZ/AxDHpGCILEx4iIiCgiERGrCQqoQEShz1p77+rsqq6KMDP3ft/9vmklu9dfa++91tprr/2o6tr3ujyzkywWQf0kCVcLSD07uoTQJQx/wBtnAaxIGAR/xwljhFSgUzi+EqFEk/axotXUxvis8C8Z/hUlUbooqUSTjmF8amrh0hSB/5RoUtv1giYVhKx4PpR1z1KK7lm6TJM6kimel6bNl8Ty9bF8fYxfTYUkQZOq+iWzfwsZvpDppabljK+c48dP5WdyLbHLdcwu15Vo0rsY3126fNdBvlTh3D8Oli5g9ZnZJYfJr6ZqO0zzN9TMKJzmr53qb2gKtU5tLZoxdUZhbjCQm09kcjDeOfMWaeyYyWQewXwAr5+xV/zp+p8cv+vsjzemT5p344y7jjt78Foxy4dN0tHkqE8ePyjJIhQKq6BovPZj+FcK/577qOC9wfetkf7D+/KrDzXGXnugw3vRrqq1batvKDk+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66l1Je0yyXrvEA4b1KtYEg5y7xM/Y1hd0bgfvlpRwh8cmHhdsGGISzg5OLER7vrJRKdrDy7UlGB55bnJSuC4ukzN2DaLH33diti4u+AJ1eneKnyuu1YAM9H/fqdW6OsmPQBNc6JwPjTYYsw1OcjeLBSYHchu1J3eit84U5Okqo6O4E93mn3DktMGoaaBd/Lx33TXNOc9wjZ27rD/GPdGq6oncBtMfeqa2gRD6A8cTXbl5ZX/LOwsTz63WT0oamgQa1/4HvgJuIEeKAAA='
bin = gzip.decompress(base64.b64decode(gz))
p = os.path.dirname(__file__)
pymain = os.path.join(p, "a.out")
with open(pymain, "wb") as f:
    f.write(bin)
os.chmod(pymain, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
if p == "":
    pymain = "./" + pymain
subprocess.call(pymain)


# compiled by pythran
'''
#pythran export main2()
import numpy as np
i8 = np.int64
MOD = 1000000007


def init(fac, inv, finv):
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, fac.shape[0]):
        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, fac, finv):
    if n < k:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD

def main2():
    stdin = open('/dev/stdin')
    X, Y = map(int, stdin.readline().split())
    a = X + Y
    if a % 3:
        print(0)
    else:
        d = a // 3
        if X < d or Y < d:
            print(0)
        else:
            fac = np.empty(d + 1, i8)
            inv = np.empty(d + 1, i8)
            finv = np.empty(d + 1, i8)
            init(fac, inv, finv)
            ans = com(d, X - d, fac, finv)
            print(ans)
'''