#include <bits/stdc++.h>
using namespace std;

const int64_t C = 1000000007;

int64_t inv(int64_t N){
  int64_t res = 1;
  int64_t pow = C-2;

  while(pow > 0){
    if (pow & 1){
      res = (res * N) % C;
    }
    N = (N * N) % C;
    pow /= 2;
  }
  return res;
}

int64_t comb(int N, int M){
  int64_t A=1, B=1;
  for(int i=0; i<M; i++){
    A = (A * (N-i)) % C;
    B = (B * (M-i)) % C;
  }

  return  (A * inv(B)) % C;
}


int main(){
  int X, Y;
  cin >> X >> Y;

  int A = 2*Y - X, B = 2*X - Y;

  if (A < 0 || B < 0 || A % 3 != 0 || B % 3 != 0){
    cout << 0 << endl;
    return 0;
  }

  A /= 3; B /= 3;

  cout << comb(A+B, min(A,B)) << endl;
}
### 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 <bits/stdc++.h>
using namespace std;

const int64_t C = 1000000007;

int64_t inv(int64_t N){
  int64_t res = 1;
  int64_t pow = C-2;

  while(pow > 0){
    if (pow & 1){
      res = (res * N) % C;
    }
    N = (N * N) % C;
    pow /= 2;
  }
  return res;
}

int64_t comb(int N, int M){
  int64_t A=1, B=1;
  for(int i=0; i<M; i++){
    A = (A * (N-i)) % C;
    B = (B * (M-i)) % C;
  }

  return  (A * inv(B)) % C;
}


int main(){
  int X, Y;
  cin >> X >> Y;

  int A = 2*Y - X, B = 2*X - Y;

  if (A < 0 || B < 0 || A % 3 != 0 || B % 3 != 0){
    cout << 0 << endl;
    return 0;
  }

  A /= 3; B /= 3;

  cout << comb(A+B, min(A,B)) << endl;
}
```