#include <algorithm>
#include <iostream>

using namespace std;

typedef long long ll;

const ll M = 1e9+7;

ll x, y, ans;
ll fact[2200000];

ll mpow(ll a, ll n)
{
  if (n == 0) return 1;
  if (n % 2) return mpow(a, n-1) * a % M;
  return mpow(a * a % M, n/2);
}

ll cmb(ll n, ll r)
{
  return fact[n] * mpow(fact[r], M-2) % M * mpow(fact[n-r], M-2) % M;
}

int main()
{
  cin >> x >> y;
  
  fact[0] = 1;
  for (int i = 1; i <= 2100000; ++i) {
    fact[i] = fact[i-1] * i % M;
  }

  ll n = x + y;
  
  if (n % 3 or x * 2 < y or y * 2 < x) {
    cout << 0 << endl;
    return 0;
  }
  
  x -= n/3;
  y -= n/3;
  
  ans = cmb(x+y, x);
  cout << ans << endl;
  return 0;
}
### 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 <algorithm>
#include <iostream>

using namespace std;

typedef long long ll;

const ll M = 1e9+7;

ll x, y, ans;
ll fact[2200000];

ll mpow(ll a, ll n)
{
  if (n == 0) return 1;
  if (n % 2) return mpow(a, n-1) * a % M;
  return mpow(a * a % M, n/2);
}

ll cmb(ll n, ll r)
{
  return fact[n] * mpow(fact[r], M-2) % M * mpow(fact[n-r], M-2) % M;
}

int main()
{
  cin >> x >> y;
  
  fact[0] = 1;
  for (int i = 1; i <= 2100000; ++i) {
    fact[i] = fact[i-1] * i % M;
  }

  ll n = x + y;
  
  if (n % 3 or x * 2 < y or y * 2 < x) {
    cout << 0 << endl;
    return 0;
  }
  
  x -= n/3;
  y -= n/3;
  
  ans = cmb(x+y, x);
  cout << ans << endl;
  return 0;
}
```