#include <iostream>
using namespace std;

const int mod=int(1e9)+7;

int fact(int n){
  if(n==0)return 1;
  return ((long)n*(long)fact(n-1))%mod;
}

int pow(int n, int i){
  if(i==0)return 1;
  long s = pow(n, i/2);
  if(i%2==0){
    return (s*s)%mod;
  }
  else {
    return (((s*s)%mod)*(long)n)%mod;
  }
}

int comb(int n, int r){
  if(r<0 || r>n)return 0;
  long nf=fact(n), rf=fact(r), rnf=fact(n-r);
  return (((nf*pow(rf, mod-2))%mod)*pow(rnf, mod-2))%mod;
}

int main(){
  int x, y;
  cin >> x >> y;
  if((x+y)%3!=0){
    cout << 0;
    return 0;
  }
  int n=(x+y)/3;
  cout << comb(n, x-n);
  return 0;
}

### Prompt

In cpp, your task is to solve 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 <iostream>
using namespace std;

const int mod=int(1e9)+7;

int fact(int n){
  if(n==0)return 1;
  return ((long)n*(long)fact(n-1))%mod;
}

int pow(int n, int i){
  if(i==0)return 1;
  long s = pow(n, i/2);
  if(i%2==0){
    return (s*s)%mod;
  }
  else {
    return (((s*s)%mod)*(long)n)%mod;
  }
}

int comb(int n, int r){
  if(r<0 || r>n)return 0;
  long nf=fact(n), rf=fact(r), rnf=fact(n-r);
  return (((nf*pow(rf, mod-2))%mod)*pow(rnf, mod-2))%mod;
}

int main(){
  int x, y;
  cin >> x >> y;
  if((x+y)%3!=0){
    cout << 0;
    return 0;
  }
  int n=(x+y)/3;
  cout << comb(n, x-n);
  return 0;
}

```