#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long mpow(long long a, int b) {
	if (b == 0) return 1;
	if (b % 2 == 1) return mpow(a, b - 1) * a % mod;
	long long z = mpow(a, b / 2);
	return z * z % mod;
}
int main() {
	int X, Y;
	scanf("%d%d", &X, &Y);
	vector<long long> F(X + Y);
	F[0] = 1;
	for (int i = 1; i < (int) F.size(); ++i) F[i] = F[i - 1] * i % mod;
	long long r = 0;
	for (int j = 0; j <= X; ++j) {
		int xa = j;
		if ((X - xa) % 2 != 0) continue;
		int ya = (X - xa) / 2;
		if (xa + ya * 2 == X && xa * 2 + ya == Y) {
			r += F[xa + ya] * mpow(F[xa], mod - 2) % mod * mpow(F[ya], mod - 2);
			r %= mod;
		}
	}
	printf("%lld\n", r);
}

### 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>
using namespace std;
const long long mod = 1e9 + 7;
long long mpow(long long a, int b) {
	if (b == 0) return 1;
	if (b % 2 == 1) return mpow(a, b - 1) * a % mod;
	long long z = mpow(a, b / 2);
	return z * z % mod;
}
int main() {
	int X, Y;
	scanf("%d%d", &X, &Y);
	vector<long long> F(X + Y);
	F[0] = 1;
	for (int i = 1; i < (int) F.size(); ++i) F[i] = F[i - 1] * i % mod;
	long long r = 0;
	for (int j = 0; j <= X; ++j) {
		int xa = j;
		if ((X - xa) % 2 != 0) continue;
		int ya = (X - xa) / 2;
		if (xa + ya * 2 == X && xa * 2 + ya == Y) {
			r += F[xa + ya] * mpow(F[xa], mod - 2) % mod * mpow(F[ya], mod - 2);
			r %= mod;
		}
	}
	printf("%lld\n", r);
}

```