#include <bits/stdc++.h>
#include<algorithm>
#define int long long
using namespace std;
typedef pair<int,int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000000000
int MOD=1000000007;
int modpow(int a,int x){
  int ans=1;
  while(x>0){
    if(x&1) ans=ans*a%MOD;
      a=a*a%MOD;
      x>>=1;
  }
  return ans;
}
int gyaku(int n){
    return modpow(n,MOD-2);
}
signed main() {
  int x,y,a,b;
  cin>>a>>b;
  x=(2*b-a)/3;
  y=(2*a-b)/3;
  if((a+b)%3!=0||x<0||y<0){cout<<0<<endl;exit(0);}
  int ans=1;
  rep(i,x+y){
    ans=ans*(i+1)%MOD;
  }
  rep(i,x){
    ans=ans*gyaku(i+1)%MOD;
  }
  rep(i,y){
    ans=ans*gyaku(i+1)%MOD;
  }
  cout<<ans<<endl;
}

### 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>
#include<algorithm>
#define int long long
using namespace std;
typedef pair<int,int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000000000
int MOD=1000000007;
int modpow(int a,int x){
  int ans=1;
  while(x>0){
    if(x&1) ans=ans*a%MOD;
      a=a*a%MOD;
      x>>=1;
  }
  return ans;
}
int gyaku(int n){
    return modpow(n,MOD-2);
}
signed main() {
  int x,y,a,b;
  cin>>a>>b;
  x=(2*b-a)/3;
  y=(2*a-b)/3;
  if((a+b)%3!=0||x<0||y<0){cout<<0<<endl;exit(0);}
  int ans=1;
  rep(i,x+y){
    ans=ans*(i+1)%MOD;
  }
  rep(i,x){
    ans=ans*gyaku(i+1)%MOD;
  }
  rep(i,y){
    ans=ans*gyaku(i+1)%MOD;
  }
  cout<<ans<<endl;
}

```