#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

const ll m = 1e9+7;
ll sm[1000000];

ll mod_pow(ll x, ll a) {
	ll u = x, an = 1;
	while(a > 0) {
		if (a&1) an = an * u % m;
		u = u * u % m; a >>= 1;
	}
	return an;
}
ll ncr(ll n, ll r) {
  return sm[n] * mod_pow(sm[n-r], m-2) % m * mod_pow(sm[r], m-2) % m;
}

int main(){
  sm[0] = sm[1] = 1;
  for(int i=2; i<1e6; i++) sm[i] = sm[i-1] * i % m;
  
  int x, y; cin >> x >> y; ll nm1=0, nm2=0, an=0;
  while(x >= 0) {
    if (x==y*2) {
      nm2 = y;
      an = (an + ncr(nm1+nm2, nm2))%m;
    }
    x-=1; y-=2; nm1++;
  }
  cout << an << endl;
}

### Prompt

Construct a CPP code solution to the problem outlined:

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>
#include <vector>
using namespace std;
typedef long long ll;

const ll m = 1e9+7;
ll sm[1000000];

ll mod_pow(ll x, ll a) {
	ll u = x, an = 1;
	while(a > 0) {
		if (a&1) an = an * u % m;
		u = u * u % m; a >>= 1;
	}
	return an;
}
ll ncr(ll n, ll r) {
  return sm[n] * mod_pow(sm[n-r], m-2) % m * mod_pow(sm[r], m-2) % m;
}

int main(){
  sm[0] = sm[1] = 1;
  for(int i=2; i<1e6; i++) sm[i] = sm[i-1] * i % m;
  
  int x, y; cin >> x >> y; ll nm1=0, nm2=0, an=0;
  while(x >= 0) {
    if (x==y*2) {
      nm2 = y;
      an = (an + ncr(nm1+nm2, nm2))%m;
    }
    x-=1; y-=2; nm1++;
  }
  cout << an << endl;
}

```