#include <cstdio>
const int N=2000005,mo=1000000007;
long long fac[N],inv[N];
int ksm(int x,int y){
	int i=1;
	for (;y;y>>=1,x=1ll*x*x%mo)
		if (y&1) i=1ll*i*x%mo;
	return i;
}
void Pre(int n){
	fac[0]=1;
	for (int i=1;i<=n;i++) fac[i]=fac[i-1]*i%mo;
	inv[n]=ksm(fac[n],mo-2);
	for (int i=n;i>=1;i--) inv[i-1]=inv[i]*i%mo;
}
long long C(int n,int m){
	return fac[n]*inv[m]%mo*inv[n-m]%mo;
}
int main(){
	int a,b,s,t,ans=0;
	scanf("%d%d%d%d",&s,&t);
    a=(int)((2*t-s)/3);
    b=(int)((2*s-t)/3);
	if((2*t-s)%3!=0 or (2*s-t)%3!=0 or a<0 or b<0){
	    printf("%d\n",0);
	}else{
    	Pre(a+b+2);
    	ans=C(a+b,a)%mo;
    	printf("%d\n",ans);    
	}
}

### Prompt

Please create a solution in CPP 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 <cstdio>
const int N=2000005,mo=1000000007;
long long fac[N],inv[N];
int ksm(int x,int y){
	int i=1;
	for (;y;y>>=1,x=1ll*x*x%mo)
		if (y&1) i=1ll*i*x%mo;
	return i;
}
void Pre(int n){
	fac[0]=1;
	for (int i=1;i<=n;i++) fac[i]=fac[i-1]*i%mo;
	inv[n]=ksm(fac[n],mo-2);
	for (int i=n;i>=1;i--) inv[i-1]=inv[i]*i%mo;
}
long long C(int n,int m){
	return fac[n]*inv[m]%mo*inv[n-m]%mo;
}
int main(){
	int a,b,s,t,ans=0;
	scanf("%d%d%d%d",&s,&t);
    a=(int)((2*t-s)/3);
    b=(int)((2*s-t)/3);
	if((2*t-s)%3!=0 or (2*s-t)%3!=0 or a<0 or b<0){
	    printf("%d\n",0);
	}else{
    	Pre(a+b+2);
    	ans=C(a+b,a)%mo;
    	printf("%d\n",ans);    
	}
}

```