#include <algorithm>
#include <iostream>
using namespace std;

const long mod=1e9+7;

long mpow(long x, long n)
{
    long res=1;
    for(; n>0; n>>=1) {
        if (n%2) res=res*x%mod;
        x=x*x%mod;
    }
    return res;
}

long mfac(long x)
{
    long res=1;
    while (x>0) res=res*x--%mod;
    return res;
}

long inv(long x)
{
    return mpow(x, mod-2);
}

int main()
{
    int x, y; cin>>x>>y;
    int a=min(x, y), b=max(x, y), c=0;
    for(; 2*a>b; ++c) --a, ++b;

    if (2*a!=b) {
        cout<<0<<endl;
    }
    else {
        cout<<mfac(a)*inv(mfac(c))%mod*inv(mfac(a-c))%mod<<endl;
    }
}

### Prompt

Please formulate 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 <algorithm>
#include <iostream>
using namespace std;

const long mod=1e9+7;

long mpow(long x, long n)
{
    long res=1;
    for(; n>0; n>>=1) {
        if (n%2) res=res*x%mod;
        x=x*x%mod;
    }
    return res;
}

long mfac(long x)
{
    long res=1;
    while (x>0) res=res*x--%mod;
    return res;
}

long inv(long x)
{
    return mpow(x, mod-2);
}

int main()
{
    int x, y; cin>>x>>y;
    int a=min(x, y), b=max(x, y), c=0;
    for(; 2*a>b; ++c) --a, ++b;

    if (2*a!=b) {
        cout<<0<<endl;
    }
    else {
        cout<<mfac(a)*inv(mfac(c))%mod*inv(mfac(a-c))%mod<<endl;
    }
}

```