#include <bits/stdc++.h>
typedef long long ll;
#define MOD 1000000007

using namespace std;

ll modx(ll a)
{
    return (a%MOD+MOD)%MOD;
}

ll inv(ll a, ll b = MOD)
{
    ll x = 0, y = 1, u = 1, v = 0;
    while(a!=0)
    {
        ll q = b/a, r = b%a, m = x-u*q, n = y-v*q;
        b = a, a = r, x = u, y = v, u = m, v = n;
    }
    return modx(x);
}

ll ncr(ll a, ll b)
{
    ll ret = 1;
    for(ll i = a; i>a-b; i--)
        ret = modx(ret*i);
    for(ll i = 1; i<=b; i++)
        ret = modx(ret*inv(i));
    return ret;
}

ll x, y;

int main()
{
    cin >> x >> y;
    if(((x+y)%3)||((2*x-y)%3)||(2*x<y)||(2*y<x))
        cout << 0 << endl;
    else
        cout << ncr((x+y)/3,(2*x-y)/3) << endl;
}
### Prompt

Generate a CPP solution to the following problem:

There is a knight - the chess piece - at the origin (0, 0) of a two-dimensional grid.

When the knight is at the square (i, j), it can be moved to either (i+1,j+2) or (i+2, j+1).

In how many ways can the knight reach the square (X, Y)?

Find the number of ways modulo 10^9 + 7.

Constraints

* 1 \leq X \leq 10^6
* 1 \leq Y \leq 10^6
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


X Y


Output

Print the number of ways for the knight to reach (X, Y) from (0, 0), modulo 10^9 + 7.

Examples

Input

3 3


Output

2


Input

2 2


Output

0


Input

999999 999999


Output

151840682

### Response

```cpp
#include <bits/stdc++.h>
typedef long long ll;
#define MOD 1000000007

using namespace std;

ll modx(ll a)
{
    return (a%MOD+MOD)%MOD;
}

ll inv(ll a, ll b = MOD)
{
    ll x = 0, y = 1, u = 1, v = 0;
    while(a!=0)
    {
        ll q = b/a, r = b%a, m = x-u*q, n = y-v*q;
        b = a, a = r, x = u, y = v, u = m, v = n;
    }
    return modx(x);
}

ll ncr(ll a, ll b)
{
    ll ret = 1;
    for(ll i = a; i>a-b; i--)
        ret = modx(ret*i);
    for(ll i = 1; i<=b; i++)
        ret = modx(ret*inv(i));
    return ret;
}

ll x, y;

int main()
{
    cin >> x >> y;
    if(((x+y)%3)||((2*x-y)%3)||(2*x<y)||(2*y<x))
        cout << 0 << endl;
    else
        cout << ncr((x+y)/3,(2*x-y)/3) << endl;
}
```