#include<bits/stdc++.h>
#define ll long long
#define MOD 1000000007
using namespace std;
ll int nf[2000001];
ll int inv[2000001];
int main(){
	//ios_base::sync_with_stdio(0); cin.tie(0);
	ll int N=1000000;
	nf[0]=1; nf[1]=1;
	for(ll int i=2;i<=N;i++)
		nf[i]=(nf[i-1]*i)%MOD;
	ll int k=1000000005,invN=1,now=nf[N];
	for(ll int i=0;i<=30;i++){
		if(k&(1<<i)){
			k-=(k&(1<<i));
			invN=(invN*now)%MOD;
		}
		now=(now*now)%MOD;
	}
	inv[N]=invN;
	for(ll int i=N-1;i>=1;i--){
		inv[i]=((i+1)*inv[i+1])%MOD;
	}
	inv[0]=1;
	ll int X,Y,U,R;
	cin>>X>>Y;
	if((X+Y)%3 || 2*Y<X || 2*X<Y){
		cout<<0; return 0;
	}
	U=(2*Y-X)/3; R=(2*X-Y)/3;
	cout<<(((nf[U+R]*inv[U])%MOD)*inv[R])%MOD;
}
### 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<bits/stdc++.h>
#define ll long long
#define MOD 1000000007
using namespace std;
ll int nf[2000001];
ll int inv[2000001];
int main(){
	//ios_base::sync_with_stdio(0); cin.tie(0);
	ll int N=1000000;
	nf[0]=1; nf[1]=1;
	for(ll int i=2;i<=N;i++)
		nf[i]=(nf[i-1]*i)%MOD;
	ll int k=1000000005,invN=1,now=nf[N];
	for(ll int i=0;i<=30;i++){
		if(k&(1<<i)){
			k-=(k&(1<<i));
			invN=(invN*now)%MOD;
		}
		now=(now*now)%MOD;
	}
	inv[N]=invN;
	for(ll int i=N-1;i>=1;i--){
		inv[i]=((i+1)*inv[i+1])%MOD;
	}
	inv[0]=1;
	ll int X,Y,U,R;
	cin>>X>>Y;
	if((X+Y)%3 || 2*Y<X || 2*X<Y){
		cout<<0; return 0;
	}
	U=(2*Y-X)/3; R=(2*X-Y)/3;
	cout<<(((nf[U+R]*inv[U])%MOD)*inv[R])%MOD;
}
```