#include<bits/stdc++.h>
using namespace std;
#define P 1000000007
long mypow(long x,long p){
  if(p==0)return 1;
  if(p%2)return mypow(x,p-1)*x%P;
  else {long a=mypow(x,p/2)%P;return a*a%P;}
}
long inv(long x){
  return mypow(x,P-2);
}
long com(long x,long y){
  long ans=1;
  for(int i=0;i<y;i++)ans=ans*(x-i)%P;
  for(int i=1;i<=y;i++){ans=ans*inv(i)%P;}
  return ans;
}

int main(){
  long X,Y;cin>>X>>Y;
  if((X+Y)%3!=0){cout<<0;return 0;}
  if(Y>X*2||X>Y*2){cout<<0;return 0;}
  cout<<com((X+Y)/3,(Y*2-X)/3)<<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;
#define P 1000000007
long mypow(long x,long p){
  if(p==0)return 1;
  if(p%2)return mypow(x,p-1)*x%P;
  else {long a=mypow(x,p/2)%P;return a*a%P;}
}
long inv(long x){
  return mypow(x,P-2);
}
long com(long x,long y){
  long ans=1;
  for(int i=0;i<y;i++)ans=ans*(x-i)%P;
  for(int i=1;i<=y;i++){ans=ans*inv(i)%P;}
  return ans;
}

int main(){
  long X,Y;cin>>X>>Y;
  if((X+Y)%3!=0){cout<<0;return 0;}
  if(Y>X*2||X>Y*2){cout<<0;return 0;}
  cout<<com((X+Y)/3,(Y*2-X)/3)<<endl;
}
```