#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
ll modinv(ll a){
  ll b = mod,u = 1,v = 0,t;
  while(b){
    t = a/b;
    a -= t*b;swap(a,b);
    u -= t*v;swap(u,v);
  }
  u %= mod;
  if(u < 0) u += mod;
  return u;
}
int main(){
  ll X,Y,l,i;scanf("%lld%lld",&X,&Y);
  if((X+Y)%3 != 0){
    printf("0\n");return 0;
  }
  l = (X+Y)/3;
  X -= l;Y -= l;
  if(X < 0 || Y < 0){
    printf("0\n");return 0;
  }
  ll B[X+Y+1];B[0] = B[1] = 1;
  for(i=2;i<=X+Y;i++) B[i] = B[i-1]*i%mod;
  printf("%lld\n",B[X+Y]*modinv(B[X])%mod*modinv(B[Y])%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>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
ll modinv(ll a){
  ll b = mod,u = 1,v = 0,t;
  while(b){
    t = a/b;
    a -= t*b;swap(a,b);
    u -= t*v;swap(u,v);
  }
  u %= mod;
  if(u < 0) u += mod;
  return u;
}
int main(){
  ll X,Y,l,i;scanf("%lld%lld",&X,&Y);
  if((X+Y)%3 != 0){
    printf("0\n");return 0;
  }
  l = (X+Y)/3;
  X -= l;Y -= l;
  if(X < 0 || Y < 0){
    printf("0\n");return 0;
  }
  ll B[X+Y+1];B[0] = B[1] = 1;
  for(i=2;i<=X+Y;i++) B[i] = B[i-1]*i%mod;
  printf("%lld\n",B[X+Y]*modinv(B[X])%mod*modinv(B[Y])%mod);
}
```