#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
int mypow(int a,int b,int c){
	if(b==0)return 1;
	if(b%2)return mypow(a,b-1,c)*a%c;
	int z=mypow(a,b/2,c);
	return z*z%c;
}
int mutu(int a,int b){
	int z=1;
	for(int i=a;i>a-b;i--){
		z*=i;
		z%=mod;
	}
	f(i,b){
		z*=mypow(i+1,mod-2,mod);
		z%=mod;
	}
	return z;
}
signed main(){
	int a,b;
	cin>>a>>b;
	if((a+b)%3||a>b*2||b>a*2)puts("0");
	else{
		int z=(a+b)/3;
		cout<<mutu(z,min(a-z,b-z))<<endl;
	}
}

### Prompt

Your challenge is to write 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 <bits/stdc++.h>
using namespace std;
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
int mypow(int a,int b,int c){
	if(b==0)return 1;
	if(b%2)return mypow(a,b-1,c)*a%c;
	int z=mypow(a,b/2,c);
	return z*z%c;
}
int mutu(int a,int b){
	int z=1;
	for(int i=a;i>a-b;i--){
		z*=i;
		z%=mod;
	}
	f(i,b){
		z*=mypow(i+1,mod-2,mod);
		z%=mod;
	}
	return z;
}
signed main(){
	int a,b;
	cin>>a>>b;
	if((a+b)%3||a>b*2||b>a*2)puts("0");
	else{
		int z=(a+b)/3;
		cout<<mutu(z,min(a-z,b-z))<<endl;
	}
}

```