#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ULL;
const int nMax=2000001, MOD=1e9+7;
ULL inv[nMax], Fact[nMax], invF[nMax];
ULL Comb(int n, int r){ return (((Fact[n]*invF[r])%MOD)*invF[n-r])%MOD; }

int main(){
inv[1]=Fact[0]=Fact[1]=invF[0]=invF[1]=1;
for(int i=2; i<nMax; i++){ 
  inv[i]=((MOD-MOD/i)*inv[MOD%i])%MOD;
  Fact[i]=(Fact[i-1]*i)%MOD; invF[i]=(invF[i-1]*inv[i])%MOD;
}
int X, Y, A, B, ans=0; cin >> X >> Y; int K=abs(Y-X);
if(X<=Y){ A=X-K; B=Y-2*K; }else{ A=Y-K; B=X-2*K; }
if(A==B&&A%3==0&&A>=0){ ans=Comb(2*A/3+K, A/3); }
cout << ans << "\n";  
}

### Prompt

Please formulate 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;
typedef unsigned long long ULL;
const int nMax=2000001, MOD=1e9+7;
ULL inv[nMax], Fact[nMax], invF[nMax];
ULL Comb(int n, int r){ return (((Fact[n]*invF[r])%MOD)*invF[n-r])%MOD; }

int main(){
inv[1]=Fact[0]=Fact[1]=invF[0]=invF[1]=1;
for(int i=2; i<nMax; i++){ 
  inv[i]=((MOD-MOD/i)*inv[MOD%i])%MOD;
  Fact[i]=(Fact[i-1]*i)%MOD; invF[i]=(invF[i-1]*inv[i])%MOD;
}
int X, Y, A, B, ans=0; cin >> X >> Y; int K=abs(Y-X);
if(X<=Y){ A=X-K; B=Y-2*K; }else{ A=Y-K; B=X-2*K; }
if(A==B&&A%3==0&&A>=0){ ans=Comb(2*A/3+K, A/3); }
cout << ans << "\n";  
}

```