#include<bits/stdc++.h>

using namespace std;
const int mod = 1e9+7;
const int N = 2000005;
long long fact[N],inv[N],factinv[N];
void init(){
    fact[0]=inv[1]=factinv[0]=inv[0]=fact[1]=factinv[1]=1;
    for(int i=2;i<=N-1;i++){
        fact[i]=(fact[i-1]%mod*i%mod)%mod;
        inv[i]=(mod-mod/i)*inv[mod%i]%mod;
        factinv[i]=factinv[i-1]*inv[i]%mod;
    }
}
int main(){
	init();
	long long x,y;
	cin>>x>>y;
	if((x+y)%3){
		cout<<0<<endl;	
		return 0;	
	}
	long long k=(x+y)/3;
	long long ans=0;
	for(long long l=0;l<=k;l++){
		if(l+(k-l)*2==x&&l*2+(k-l)==y){
			long long now=((fact[k]*factinv[l])%mod*factinv[k-l])%mod;
			ans+=now;
			ans%=mod;
		}
	}
	cout<<ans<<endl;
}

### Prompt

Your task is to create 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<bits/stdc++.h>

using namespace std;
const int mod = 1e9+7;
const int N = 2000005;
long long fact[N],inv[N],factinv[N];
void init(){
    fact[0]=inv[1]=factinv[0]=inv[0]=fact[1]=factinv[1]=1;
    for(int i=2;i<=N-1;i++){
        fact[i]=(fact[i-1]%mod*i%mod)%mod;
        inv[i]=(mod-mod/i)*inv[mod%i]%mod;
        factinv[i]=factinv[i-1]*inv[i]%mod;
    }
}
int main(){
	init();
	long long x,y;
	cin>>x>>y;
	if((x+y)%3){
		cout<<0<<endl;	
		return 0;	
	}
	long long k=(x+y)/3;
	long long ans=0;
	for(long long l=0;l<=k;l++){
		if(l+(k-l)*2==x&&l*2+(k-l)==y){
			long long now=((fact[k]*factinv[l])%mod*factinv[k-l])%mod;
			ans+=now;
			ans%=mod;
		}
	}
	cout<<ans<<endl;
}

```