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

//  a^b % m
long long powmod(long long a, long long b, long long m)
{
    long long r = 1;
    for (; b>0; b>>=1, a=a*a%m)
        if (b&1)
            r = r*a%m;
    return r;
}

int main()
{
    long long X, Y;
    cin>>X>>Y;

    long long M = 1000000007;
    vector<long long> F(1000001);
    F[0] = 1;
    for (long long i=1; i<=1000000; i++)
        F[i] = F[i-1]*i%M;

    long long ans = 0;
    for (long long a=0; a<=X; a++)
    {
        long long b = (X-a)/2;
        if (a+2*b==X && a*2+b==Y)
            ans += F[a+b]*powmod(F[a],M-2,M)%M*powmod(F[b],M-2,M)%M,
            ans %= M;
    }
    cout<<ans<<endl;
}

### Prompt

Create a solution in CPP for 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 <iostream>
#include <vector>
using namespace std;

//  a^b % m
long long powmod(long long a, long long b, long long m)
{
    long long r = 1;
    for (; b>0; b>>=1, a=a*a%m)
        if (b&1)
            r = r*a%m;
    return r;
}

int main()
{
    long long X, Y;
    cin>>X>>Y;

    long long M = 1000000007;
    vector<long long> F(1000001);
    F[0] = 1;
    for (long long i=1; i<=1000000; i++)
        F[i] = F[i-1]*i%M;

    long long ans = 0;
    for (long long a=0; a<=X; a++)
    {
        long long b = (X-a)/2;
        if (a+2*b==X && a*2+b==Y)
            ans += F[a+b]*powmod(F[a],M-2,M)%M*powmod(F[b],M-2,M)%M,
            ans %= M;
    }
    cout<<ans<<endl;
}

```