#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

typedef long long LL;
const int MO=1e9+7;

// a+2b=X
// 2a+b=Y
// 2a+4b=2X
// 3b=2X-Y -> b
// a=X-2b

LL qp(LL a,LL n)
{
	LL ans=1;
	while(n)
	{
		if(n&1) ans=ans*a%MO;
		a=a*a%MO;
		n>>=1;
	}
	return ans;
}

// (a+b)!/a!/b!

int main()
{
	LL x,y;
	cin>>x>>y;
	LL b=2*x-y;
	if(b<0||b%3)
	{
		printf("0\n");
		return 0;
	}
	b/=3;
	LL a=x-2*b;
	if(a<0)
	{
		printf("0\n");
		return 0;
	}
	LL ans=1;
	LL tmp=1;
	for(int i=1;i<=(a+b);i++)
		ans=ans*i%MO;
	for(int i=1;i<=a;i++)
		tmp=tmp*i%MO;
	for(int i=1;i<=b;i++)
		tmp=tmp*i%MO;
	cout<< (ans*qp(tmp,MO-2)%MO) <<endl;
	return 0;
}
### Prompt

Please provide a Cpp coded solution to the problem described below:

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 <stdio.h>
#include <algorithm>
using namespace std;

typedef long long LL;
const int MO=1e9+7;

// a+2b=X
// 2a+b=Y
// 2a+4b=2X
// 3b=2X-Y -> b
// a=X-2b

LL qp(LL a,LL n)
{
	LL ans=1;
	while(n)
	{
		if(n&1) ans=ans*a%MO;
		a=a*a%MO;
		n>>=1;
	}
	return ans;
}

// (a+b)!/a!/b!

int main()
{
	LL x,y;
	cin>>x>>y;
	LL b=2*x-y;
	if(b<0||b%3)
	{
		printf("0\n");
		return 0;
	}
	b/=3;
	LL a=x-2*b;
	if(a<0)
	{
		printf("0\n");
		return 0;
	}
	LL ans=1;
	LL tmp=1;
	for(int i=1;i<=(a+b);i++)
		ans=ans*i%MO;
	for(int i=1;i<=a;i++)
		tmp=tmp*i%MO;
	for(int i=1;i<=b;i++)
		tmp=tmp*i%MO;
	cout<< (ans*qp(tmp,MO-2)%MO) <<endl;
	return 0;
}
```