#include <algorithm>
#include <cstdio>

using namespace std ;

typedef long long LL ;
const int N=1e6+10 ;
const LL P=1e9+7 ;

LL fac[N] , inv[N] ;
inline LL qpow ( LL a , LL b , LL p )
{
	LL res ;
	for ( res=1 ; b ; a=a*a%p,b>>=1 )
		if ( b&1 ) res=res*a%p;
	return res ;
}
inline void init ( int n )
{
	int i ;
	fac[0]=1;
	for ( i=1 ; i<=n ; i++ ) fac[i]=fac[i-1]*i%P;
	inv[n]=qpow(fac[n],P-2,P);
	for ( i=n ; i>=1 ; i-- ) inv[i-1]=inv[i]*i%P;
}

int X , Y ;
int main ()
{
	int i ;
	scanf("%d%d",&X,&Y),init(max(X,Y));
	LL res=0 ;
	for ( i=0 ; i<=X && 2*i<=Y ; i++ )
	{
		int x=X-i , y=Y-2*i ;
		if ( x==y*2 )
			(res+=fac[i+y]*inv[i]%P*inv[y])%=P;
	}
	printf("%lld\n",res);
	return 0 ;
}

### Prompt

In CPP, your task is to solve 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 <cstdio>

using namespace std ;

typedef long long LL ;
const int N=1e6+10 ;
const LL P=1e9+7 ;

LL fac[N] , inv[N] ;
inline LL qpow ( LL a , LL b , LL p )
{
	LL res ;
	for ( res=1 ; b ; a=a*a%p,b>>=1 )
		if ( b&1 ) res=res*a%p;
	return res ;
}
inline void init ( int n )
{
	int i ;
	fac[0]=1;
	for ( i=1 ; i<=n ; i++ ) fac[i]=fac[i-1]*i%P;
	inv[n]=qpow(fac[n],P-2,P);
	for ( i=n ; i>=1 ; i-- ) inv[i-1]=inv[i]*i%P;
}

int X , Y ;
int main ()
{
	int i ;
	scanf("%d%d",&X,&Y),init(max(X,Y));
	LL res=0 ;
	for ( i=0 ; i<=X && 2*i<=Y ; i++ )
	{
		int x=X-i , y=Y-2*i ;
		if ( x==y*2 )
			(res+=fac[i+y]*inv[i]%P*inv[y])%=P;
	}
	printf("%lld\n",res);
	return 0 ;
}

```