#include<stdio.h>
#define N 1000000
const int MOD=(int)1e9+7; //which is prime
int x,y;
int min(int a,int b){
	return a<b?a:b;
}
long long fac(int n){
	long long f=1;
	while(n>0){
		f*=n--;
		f%=MOD;
	}
	return f;
}
long long calc(long long x,long long cnt){
	long long ans=1;
	while(cnt>0){
		if((cnt%2)!=0){
			ans*=x;
			ans%=MOD;
		}
		x*=x;
		x%=MOD;
		cnt/=2;
	}
	return ans;
}
long long solve(){
	if((2*x-y)%3||y>2*x||x>2*y)
		return 0;
	int a=(2*x-y)/3,b=(-x+2*y)/3;
	int n=a+b,r=min(a,b);
	long long x1,x2,x3;
	x1=fac(n);
	x2=fac(r)*fac(n-r);
	x2%=MOD;
	x3=calc(x2,MOD-2);
	long long ans;
	ans=x1*x3;
	ans%=MOD;
	return ans;
}
int main(){
	scanf("%d%d",&x,&y);
	printf("%lld",solve());
}
### Prompt

Generate 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<stdio.h>
#define N 1000000
const int MOD=(int)1e9+7; //which is prime
int x,y;
int min(int a,int b){
	return a<b?a:b;
}
long long fac(int n){
	long long f=1;
	while(n>0){
		f*=n--;
		f%=MOD;
	}
	return f;
}
long long calc(long long x,long long cnt){
	long long ans=1;
	while(cnt>0){
		if((cnt%2)!=0){
			ans*=x;
			ans%=MOD;
		}
		x*=x;
		x%=MOD;
		cnt/=2;
	}
	return ans;
}
long long solve(){
	if((2*x-y)%3||y>2*x||x>2*y)
		return 0;
	int a=(2*x-y)/3,b=(-x+2*y)/3;
	int n=a+b,r=min(a,b);
	long long x1,x2,x3;
	x1=fac(n);
	x2=fac(r)*fac(n-r);
	x2%=MOD;
	x3=calc(x2,MOD-2);
	long long ans;
	ans=x1*x3;
	ans%=MOD;
	return ans;
}
int main(){
	scanf("%d%d",&x,&y);
	printf("%lld",solve());
}
```