#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N= 1e7 + 5;
const ll mod=1e9 + 7;
ll fct[N],inv[N],invfct[N];
void init(){
    fct[0]=fct[1]=1;
	inv[1]=1;
	invfct[0]=invfct[1]=1;
	for(ll i=2;i<N;i++){
		fct[i]=i*fct[i-1]%mod;
		inv[i]=ll(mod-inv[mod%i])*(mod/i)%mod;
		invfct[i]=ll(inv[i])*invfct[i-1]%mod;
	}
}


int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    init();
    ll x,y;
    cin>>x>>y;
    if((x+y)%3)return cout<<0 , 0;
    if(x>y)swap(x,y);
    ll n = (x+y)/3;
    ll r = (2*x-y)/3;
    if(r>n || r<0)return cout<<0 , 0;
    cout<<( (fct[n]*invfct[r])%mod * invfct[n-r] )%mod;

}


### Prompt

Please provide a cpp coded solution to the problem described below:

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;
typedef long long ll;
const ll N= 1e7 + 5;
const ll mod=1e9 + 7;
ll fct[N],inv[N],invfct[N];
void init(){
    fct[0]=fct[1]=1;
	inv[1]=1;
	invfct[0]=invfct[1]=1;
	for(ll i=2;i<N;i++){
		fct[i]=i*fct[i-1]%mod;
		inv[i]=ll(mod-inv[mod%i])*(mod/i)%mod;
		invfct[i]=ll(inv[i])*invfct[i-1]%mod;
	}
}


int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    init();
    ll x,y;
    cin>>x>>y;
    if((x+y)%3)return cout<<0 , 0;
    if(x>y)swap(x,y);
    ll n = (x+y)/3;
    ll r = (2*x-y)/3;
    if(r>n || r<0)return cout<<0 , 0;
    cout<<( (fct[n]*invfct[r])%mod * invfct[n-r] )%mod;

}


```