#include <bits/stdc++.h>
using namespace std;
using ll=long long;
ll mod =1000000007;
#define rep(i,n) for(int i=0;i<n;i++)

ll exp(ll a,ll n){
  if(n==0) return 1;
  else if(n%2==0) return (exp(a,n/2)*exp(a,n/2))%mod;
  else return (a*exp(a,n-1))%mod;
}

int main() {
  ll x,y;
  cin>>x>>y;
  ll ans;
  ll a=2*y-x;
  ll b=2*x-y;
  if((a>=0 && a%3==0) && (b>=0 && b%3==0)){
    a/=3;
    b/=3;
    ll p=1;
    ll q=1;
    for(int i=0;i<b;i++){
      p*=a+b-i;
      p%=mod;
      q*=i+1;
      q%=mod;
    }
    ll qq=exp(q,mod-2);
    ans=p*qq;
    ans%=mod;
  }
  else ans=0;
  cout<<ans<<endl;
}
### Prompt

Create a solution in CPP for 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;
using ll=long long;
ll mod =1000000007;
#define rep(i,n) for(int i=0;i<n;i++)

ll exp(ll a,ll n){
  if(n==0) return 1;
  else if(n%2==0) return (exp(a,n/2)*exp(a,n/2))%mod;
  else return (a*exp(a,n-1))%mod;
}

int main() {
  ll x,y;
  cin>>x>>y;
  ll ans;
  ll a=2*y-x;
  ll b=2*x-y;
  if((a>=0 && a%3==0) && (b>=0 && b%3==0)){
    a/=3;
    b/=3;
    ll p=1;
    ll q=1;
    for(int i=0;i<b;i++){
      p*=a+b-i;
      p%=mod;
      q*=i+1;
      q%=mod;
    }
    ll qq=exp(q,mod-2);
    ans=p*qq;
    ans%=mod;
  }
  else ans=0;
  cout<<ans<<endl;
}
```