/*#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<string>
#include<map>
#include<set>
using namespace std;

#define INF 99999999
#define max(a,b) (a > b?a:b)
#define min(a,b) (a < b?a:b)
int const nMax = 110;
vector<int> ans[nMax];
int mark[20000];
int main()
{
    int n;
    scanf("%d",&n);
    memset(mark,0,sizeof(mark));
    int temp = (n*n+1)/2;
    int x = temp,y = temp+1;
    for(int i = 1;i <= n;i++){
        int total = n/2;
        while(total){
            ans[i].push_back(x);
            ans[i].push_back(y);
            x--;
            y++;
            total--;
        }
    }
    for(int i = 1;i <= n;i++){
        for(int j = 0;j < n;j++)
            printf("%d ",ans[i][j]);
        puts("");
    }
    return 0;
}
*/
/*
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<string>
#include<map>
#include<set>
using namespace std;

#define INF 99999999
#define max(a,b) (a > b?a:b)
#define min(a,b) (a < b?a:b)
int const nMax = 1e5+10;
double ans[nMax];
int main()
{
    double n,a,d;
    scanf("%lf%lf%lf",&n,&a,&d);
    double ans = 0;
    double t,v;
    double cmp = sqrt(2*d/a);
    for(int i = 1;i <= n;i++){
        scanf("%lf%lf",&t,&v);
        double tmp;
        if( v/a > cmp ){
            tmp = t+cmp;
        }
        else
            tmp = (d-v*v/2/a)/v+t+v/a;
        printf("%.6lf\n",ans = max(ans,tmp));
    }
}
*/
/*
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<string>
#include<map>
#include<set>
using namespace std;

#define INF 99999999
#define max(a,b) (a > b?a:b)
#define min(a,b) (a < b?a:b)
int const nMax = 2000;
int mark[nMax];
int main()
{
    int n,x;
    scanf("%d",&n);
    memset(mark,0,sizeof(mark));
    for(int i = 1;i <= n;i++){
        scanf("%d",&x);
        mark[x]++;
    }
    int total = 0;
    int maxans = 0;
    for(int i = 1;i < 2000;i++){
        if( mark[i] )
            total++;
        maxans = max(maxans,mark[i]);
    }
    cout << maxans << " " << total<<endl;
}

*/
/*
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<map>
#include<set>
using namespace std;

#define INF 99999999
#define max(a,b) (a > b?a:b)
#define min(a,b) (a < b?a:b)
#define Low_bit(x) (x&(-x))
#define Get_bit(x,n) (1&(x>>n))
int const nMax = 2000;
double const eps = 1e-8;
int n,m;
struct Node{
    int num,pen;
}node[60];
int cmp(Node a,Node b)
{
    if( a.num == b.num ){
        return a.pen < b.pen;
    }
    else
        return a.num > b.num;
}
int main()
{
    int k;
    scanf("%d%d",&n,&k);
    for(int i = 1;i <= n;i++){
        scanf("%d%d",&node[i].num,&node[i].pen);
    }
    sort(node+1,node+1+n,cmp);
    int ans = 0;
    for(int i = 1;i <= n;i++){
        if( node[i].num == node[k].num && node[i].pen == node[k].pen )
            ans++;
    }
    cout<<ans<<endl;
    return 0;
}
*/
/*
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<map>
#include<set>
using namespace std;

#define INF 99999999
#define max(a,b) (a > b?a:b)
#define min(a,b) (a < b?a:b)
#define Low_bit(x) (x&(-x))
#define Get_bit(x,n) (1&(x>>n))
int const nMax = 200;
double const eps = 1e-8;
int num[nMax];
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i = 1;i <= n;i++){
        scanf("%d",&num[i]);
    }
    int ans = 0;
    for(int i = 1;i <= n;i++){
        if( num[i] > 0 && num[i] >= num[k] )
            ans++;
    }
    cout<<ans<<endl;
}
*/
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<map>
#include<set>
using namespace std;
#define mod 1000000007
const int nMax = 5e5+10;
long long fac[nMax];
long long inv[nMax];
long long extend_gcd(long long a,long long b,long long &x,long long &y)
{
    if( b == 0 ){
        x = 1,y = 0;
        return a;
    }else{
        long long r = extend_gcd(b,a%b,y,x);
        y-=x*(a/b);
        return r;
    }
}
long long C(long long a,long long b)
{
    long long ret = fac[b];
    ret*=inv[a],ret%=mod;
    ret*=inv[b-a],ret%=mod;
    return ret;
}
int main()
{
    long long n,m,g;
    long long ans = 0;
    fac[1] = inv[1] = 1;
    fac[0] = inv[0] = 1;
    for(long long i = 2;i < nMax;i++){
        fac[i] = (fac[i-1]*i)%mod;
        long long x,y;
        extend_gcd(mod,i,x,y);
        y%=mod;
        y+=mod;
        y%=mod;
        inv[i] = (inv[i-1]*y)%mod;
    }
    for(int i = 1;i <= 200000;i++){
        if( (fac[i]*inv[i])%mod != 1 )
            cout<<i<<endl;
    }
    scanf("%I64d%I64d%I64d",&n,&m,&g);
    long long total = n+m;
	if( m == 0 ) {
        if( n%2 == 1-g )
            cout << 1;
        else
            cout << 0;
        return 0;
    }
	if( n == 0 ) {
        if( m > 1 )
            cout << 1-g;
        else
            cout << g;
        return 0;
    }
	ans = 0;
	for(int k = m-1;k < n+m;k++){
		if(k == 0) {
		    if((n+m-1)%2 != g)
                ans = (ans + 1) % mod;
        }
		else if((n+m-k-1)%2 == g)
            ans = (ans + C(m-1, k)) % mod;
	}
    cout<<ans<<endl;
}

#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>

using namespace std;

typedef long long ll;
char IN[1<<17],*SS=IN,*TT=IN;
inline char gc(){return (SS==TT&&(TT=(SS=IN)+fread(IN,1,1<<17,stdin),SS==TT)?EOF:*SS++);}
inline int read()
{
	int now=0,f=1;register char c=gc();
    for(;!isdigit(c);c=='-'&&(f=-1),c=gc());
    for(;isdigit(c);now=now*10+c-'0',c=gc());
    return now*f;
}

const int maxn=1e6+50;
const int mod=1000000007;
ll fc[maxn];
ll inv[maxn];

ll ksm(ll n,int m)
{
	ll ans=1;
	for(int i=m;i;i>>=1){if(i&1)(ans*=n)%=mod;(n*=n)%=mod;}
	return ans;
}

ll c(ll n,ll m)
{
	return fc[n]*inv[n-m]%mod*inv[m]%mod;
}

ll slove(int n,int m,bool flag)
{
	if(n<0||m<0)return 0;
	if(flag&&!n&&m)return 0;
	if(!n&&!m)return 1;
	ll temp=0;
	for(int i=0;i*2<=n;++i)//00个数
	{
		int j=n-i*2;//01个数
		int k=m-j;//填1的个数
		if(j<0||k<0)continue;
		(temp+=c(i+j,i)*c(i+j+k-flag,k)%mod)%=mod;
	}
	return temp;
}

int main()
{
	int n=read(),m=read(),g=read();
	fc[0]=1;
	inv[0]=1;
	for(int i=1;i<=300010;++i)fc[i]=fc[i-1]*i%mod,inv[i]=ksm(fc[i],mod-2);
	n--;
	if(g)n--;
	printf("%lld\n",(slove(n,m,0)+slove(n+2,m-1,1))%mod);
	return 0;
}

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;

int n,m,g;
long long fac[200010];

void init()
{
    fac[0]=fac[1]=1;
    for(int i=2;i<=200000;i++)
        fac[i]=fac[i-1]*i%mod;
    return;
}

long long quick_pow(long long base, long long pow)
{
    long long ret=1;
    while(pow)
    {
        if(pow&1)
            ret=(ret*base)%mod;
        base=base*base%mod;
        pow>>=1;
    }
    return ret;
}

long long C(int r,int k)
{
    return fac[r]*quick_pow(fac[k]*fac[r-k]%mod,mod-2)%mod;
}

int main()
{
    cin>>n>>m>>g;

       if(m == 0)
    {
        if(g == 0)
        {
            if(n%2==1)
               cout<<1<<endl;
            else
               cout<<0<<endl;
        }
        else
        {
            if(n%2==1)
                cout<<0<<endl;
            else
                cout<<1<<endl;;
        }
        return 0;
    }
    init();
    long long all=C(n + m,n);
    long long ans=0;
    for(int t=0;t<=n;t+=2)
        ans=(ans+C(n+m-1-t,m-1))%mod;
    if(m==1&&(n&1)==0)
        ans=(ans-1+mod)%mod;
    if(m==1&&(n&1)) ans=(ans+1%mod);
    if(g==0) cout<<ans<<endl;
       else cout<<(all-ans+mod)%mod<<endl;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 5;
const int M = 1e9 + 7;

int n, m, g;
int fac[N], inv[N];

int modpow(long long x, int y) {
    long long ret = 1;
    while (y > 0) {
        if (y & 1) {
            ret = (ret * x) % M;
        }
        y >>= 1;
        x = (x * x) % M;
    }
    return ret;
}

int C(int a, int b) {
    if (b > a) return 0;
    long long ret = ((1LL) * fac[a] * inv[b]) % M;
    ret = ((1LL) * ret * inv[a - b]) % M;
    return ret;
}

int get(int x, int y, bool one) {
    int ret;
    if (one) {
        ret = C(x + y, y) - get(x, y, false);
    } else {
        if (x == 0) {
            ret = (y > 1);
        } else if (y == 0) {
            ret = (x & 1);
        } else {
            ret = C(x + y - 1, y - 1) + get(x - 1, y, true);
        }
    }
    ret = (ret % M + M) % M;
    return ret;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n >> m >> g;
    fac[0] = inv[0] = 1;
    for (int i = 1; i < N; i++) {
        long long res = ((1LL) * i * fac[i - 1]) % M;
        fac[i] = res;
        inv[i] = modpow(fac[i], M - 2);
    }
    cout << get(n, m, g) << '\n';

    return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e5+1;
const ll mod = 1e9+7;
ll fact[2*N];
int n, m, g;
ll fastpow(ll a, ll b) {
	if(b==0) {
		return 1;
	}
	ll c = fastpow(a, b/2);
	if(b%2==1) {
		return (a*c%mod*c)%mod;
	}
	else {
		return (c*c)%mod;
	}
}
int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>m>>g;
	fact[0]=1;
	for(ll i=1; i<=n+m; ++i) {
		fact[i]=(fact[i-1]*i)%mod;
	}
	ll x = 0, ans=0;
	if(g==0) {
		if(m==0 && n%2==1) {
			cout<<1;
			return 0;
		}
		else if(m==0) {
			cout<<0;
			return 0;
		}
		if(m==1 && n%2==1) {
			ans++;
		}
		if(m==1 && n==0) {
			cout<<ans;
			return 0;
		}
		x=1;
		while(x<=n+1) {
			if(x==n+1 && m==1) {
				break;
			}
			ans+=fact[n+m-x]*fastpow(fact[m-1]*fact[n-x+1]%mod, mod-2); // C(n+m-x, m-1)
			ans%=mod;
			x+=2;
		}
		cout<<ans;
	}
	else {
		if(m==0 && n%2==0) {
			cout<<1;
			return 0;
		}
		else if(m==0) {
			cout<<0;
			return 0;
		}
		if(m==1 && n%2==0) {
			ans++;
		}
		x=2;
		while(x<=n+1) {
			if(x==n+1 && m==1) {
				break;
			}
			ans+=fact[n+m-x]*fastpow(fact[m-1]*fact[n-x+1]%mod, mod-2);
			ans%=mod;
			x+=2;
		}
		cout<<ans;
	}
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long, long long> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<pair<ll,ll> > vii;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<pair<long long,long long> > vpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;

//# define PI 3.141592653589793
# define mod 1000000007
#define M 1000006
# define N 200005
# define A 1000007
template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }
# define INF 100000000

ll fac[N];
int n,m,g;
ll ans;
void factorial()
{
	fac[0]=1;
	for(int i=1;i<N;i++)
	{
		fac[i]=fac[i-1]*i;
		fac[i]%=mod;
	}
}

ll cal(int x,int y)
{
	ll nemo=fac[x];
	ll deno=(fac[y]*fac[(x-y)]);
	deno%=mod;
	ll invdemo=pow(deno,(ll)mod-2,(ll)mod);
	invdemo%=mod;
	ll pro=(nemo*invdemo);
	pro%=mod;
	return pro;
}

void calculate()
{
	if(m==0)
	{
		if((n%2)!=g)
		{
			cout << "1";
			return;
		}
		else
		{
			cout<<"0";
			return;
		}
	}
	if(n==0)
	{
		if(m>1)
		{
			if((g==0))
			{
				cout << "1";
				return;
			}
			else
			{
				cout<<"0";
				return;
			}
		}
		else
		{
			if(g==1)
			{
				cout << "1";
				return;
			}
			else
			{
				cout << "0";
				return ;
			}
		}

	}
    ans=0;
	for(int i=0;i<=n;i++)
	{
		ll to=(n+m-1-i);
		if(to>0)
		{
			if(i%2==g)
			{
				ans+=cal(to,m-1);
				ans%=mod;
			}
		}
		else
		{
			if((i%2)!=g)
			{
				ans+=cal(to,m-1);
				ans%=mod;
			}
		}
	}
	cout << ans;
}
int main()
{
	IOS;

	cin >> n >>m >> g;
	factorial();
	//ll ans=0;
	calculate();
	return 0;

}

#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
long long int arr[200003];
long long int modpow( int a , int b )
{
  if( b == 0 )
    return 1;
  if( b % 2 == 0 )
  {
    long long int x = modpow(a,b/2);
    return (x*x)%mod;
  }
  else return ( a*modpow(a,b-1) )%mod;
}
long long int f( int n , int r )
{
  long long int no = arr[n];
  long long int d = ( arr[r]*arr[n-r] )%mod;
  d = modpow( d , mod-2);
  no = ( no * d )%mod;

  return no;
}
int main()
{
  int n , m , q , i;
  arr[0] = 1;
  for( i = 1 ; i <= 200000 ; i++ )
  {
    arr[i] = i*arr[i-1];
    arr[i] %= mod;
  }
  long long int ans = 0;
  cin >> n >> m >> q;
  if( n == 0 )
  {
    if( q == 1)
    {
      if( m == 1 )
        ans = 1;
      else ans = 0;
    }
    else
    {
      if( m > 1 )
        ans = 1;
      else ans = 0;
    }
  }
  else if( m == 0 )
  {
    if( (n%2) == !q  )
      ans = 1;
    else ans = 0;
  }
  else
  {
    ans = 0;
    int r , x = n + m;
    for( i = 0 ; i <= n ; i++ )
    {
       r = x - 1- i;
       if( r > 0 )
       {
            if( ( i % 2) == q )
          {
            ans += f( r , m-1);
            ans %= mod;
          }
       }
       else
       {
         if( (i % 2) != q )
         {
           ans += f(r,m-1);
           ans %= mod;
         }
       }
    }
  }
 cout << ans%mod;
 return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define TR(i,v)         for(__typeof((v).begin())i=(v).begin();i!=(v).end();++i)
#define DEBUG(x)        cout << #x << " = " << x << endl;
#define SIZE(p)         (int)(p).size()
#define MP(a, b)        make_pair((a), (b))
#define ALL(p)          (p).begin(), (p).end()
#define rep(i, n)       for(int (i)=0; (i)<(int)(n); ++(i))
#define REP(i, a, n)    for(int (i)=(a); (i)<(int)(n); ++(i))
#define FOR(i, a, b)    for(int (i)=(int)(a); (i)<=(int)(b); ++(i))
#define FORD(i, b, a)   for(int (i)=(int)(b); (i)>=(int)(a); --(i))
#define CLR(x, y)       memset((x), (y), sizeof((x)))
typedef long long LL;
typedef pair<int, int> pii;
const int mod=(int)1e9+7;
int f[200005],f_inv[200005];
inline int add(int x,int y) {
    x+=y;
    if(x>=mod)  x-=mod;
    return x;
}
inline int sub(int x,int y) {
    x-=y,x%=mod;
    if(x<0)     x+=mod;
    return x;
}
inline int mul(LL x,LL y) {
    x*=y,x%=mod;
    return x;
}
int pw(int a,int p) {
    int r=1;
    for(;p;p>>=1,a=mul(a,a)) if(p&1)
        r=mul(r,a);
    return r;
}
void pre() {
    f[0]=1;
    FOR(i,1,200000)
        f[i]=(LL)i*f[i-1]%mod;
    f_inv[200000]=pw(f[200000],mod-2);
    FORD(i,200000-1,0)
        f_inv[i]=(LL)(i+1)*f_inv[i+1]%mod;
}
int C(int n,int m) {
    int c=f[n];
    c=mul(c,f_inv[m]);
    c=mul(c,f_inv[n-m]);
    return c;
}
int g(int n,int a) {
    if(n==0)    return 0;
    if(n==1) {
        return a==0;
    }
    if(a) return sub(C(n-1,a-1),g(n-1,a-1));
    return 0;
}
int main(int argc, char const *argv[]) {
#ifndef ONLINE_JUDGE
    freopen("D.in", "r", stdin);
    // freopen("out", "w", stdout);
#endif
    pre();
    int n,m,t;  cin>>n>>m>>t;
    int a=n;    n=n+m;
    int res=g(n,a);
    // DEBUG(res);
    // DEBUG(g(1,0));
    // DEBUG(res);
    if(t==0)    res=sub(C(n,a),res);
    printf("%d\n",res);
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

namespace {

    typedef double real;
    typedef long long ll;

    template<class T> ostream& operator<<(ostream& os, const vector<T>& vs) {
        if (vs.empty()) return os << "[]";
        os << "[" << vs[0];
        for (int i = 1; i < vs.size(); i++) os << " " << vs[i];
        return os << "]";
    }

    int N, M;
    int g;

    const ll MOD = ll(1e9 + 7);

    const int MAX_N = int(1e5 + 2);

    ll extgcd(ll a, ll b, ll& x, ll& y) {
        ll g = a; x = 1LL; y = 0LL;
        if (b != 0LL) {
            g = extgcd(b, a % b, y, x);
            y -= (a / b) * x;
        }
        return g;
    }
    ll inverse(ll v) {
        ll x, y;
        if (extgcd(v, MOD, x, y) == 1LL) return (x + MOD) % MOD;
        return 0;
    }

    ll C[MAX_N];
    void init() {
        C[0] = 1;
        for (int i = 1; i <= N; i++) {
            C[i] = (C[i - 1] * (M + i) % MOD) * inverse(i) % MOD;
        }
    }

    ll cache[MAX_N];
    ll z(int n) {
        if (cache[n] >= 0) return cache[n];
        if (n == 0) {
            if (M == 1) return 0;
            else return 1;
        }
        return cache[n] = (C[n] - z(n - 1) + MOD) % MOD;
    }

    void input() {
        cin >> N >> M >> g;
        for (int i = 0; i <= N; i++) cache[i] = -1;
        init();
    }

    void solve() {
        if (M == 0) {
            int last = 0;
            for (int i = 1; i < N; i++) {
                if (last == 0) last = 1;
                else last = 0;
            }
            cout << int(last == g) << endl;
            return;
        }

        if (g == 0) {
            cout << z(N) << endl;
        } else {
            if (N == 0) {
                cout << (M == 1) << endl;
            } else {
                cout << z(N - 1) << endl;
            }
        }
    }
}

int main() {
    input(); solve();
    return 0;
}

#include <iostream>
#include <vector>
using namespace std;

const int mod = 1000000007;
long long vec[1000000];

long long binpow(long long val, long long pow, long long mod)
{
    if(pow == 0) return 1 % mod;
    if(pow & 1)
    {
        return (binpow(val, pow-1, mod) * val)%mod;
    }
    else
    {
        long long z = binpow(val, pow/2, mod);
        return (z*z)%mod;
    }
}

long long cnk(long long  n, long long k)
{
    if(k > n || k < 0) return 0;
    long long fact = vec[n];
    long long z1 = binpow(vec[k],mod-2,mod);
    long long z2 = binpow(vec[n-k],mod-2,mod);
    long long ret = (fact * z1) % mod;
    ret = (ret * z2) % mod;
    return ret;
}

int solve()
{
    int n, m, g;
    cin >> n >> m >> g;

    vec[0] = 1;
    for(int i = 1; i <= n+m; i++)
    {
        long long fact = vec[i-1];
        fact *= i;
        fact %= mod;
        vec[i] = fact;
    }

    int len = n+m;

    //if 0000..000
    if(m == 0)
    {
        int res = len & 1 ? 1 : 0;
        cout << (g ^ res);
        return 0;
    }
    if(len == 1)
    {
        if(n) cout << (g ? 0 : 1);
        else  cout << (g ? 1 : 0);
        return 0;
    }
    long long ans0 = 0, ans1 = 0;
    for(int i = 1; i <= len; i++)
    {
        long long out = cnk(len - i, m-1);
        if(len == i)
        {
            if(i & 1) (ans1 += out) % mod;
            else (ans0 += out) % mod;
        }
        else if(i & 1) ans0 = (ans0 + out) % mod;
        else ans1 = (ans1 + out) % mod;
    }
    long long test = cnk(len, n) - ans0;
    if(test < 0) test += mod;
    cout << (g ? test : ans0);
    return 0;
}

int main()
{
    do solve();
    while(0);
    return 0;
}

#include <stdio.h>
#include <vector>
using ll=long long;
const int C=200001, M=1000000007;

std::pair <ll, ll> Euclid (ll a, ll b){
	int x1=0, x2=1, y1=1, y2=0, q=a/b, r=a-q*b, x, y, wynn;
	x=1, y=y2-(q-1)*y1;
	while (r!=0){
		a=b, b=r;
		x=x2-q*x1, x2=x1, x1=x;
		y=y2-q*y1, y2=y1, y1=y;
		wynn=r, q=a/b, r=a-q*b;
	}
	return std::make_pair (x,y);
}

ll invert(ll a, ll M){
	ll x=Euclid(a, M).first;
	if (x<0) return x+M;
	return x;
}

ll fac[C], afac[C];
inline ll cn(int n, int k) {
	if (k<0 || n<0) return 0;
	return (((fac[n]*afac[k])%M)*afac[n-k])%M;
}

int main(){
	int starter=0, n, m, g, zeros, i;
	ll res=0;

	fac[0]=1;
	for (i=1;i<C;i++) fac[i]=(fac[i-1]*i)%M;
	for (i=0;i<C;i++) afac[i]=invert(fac[i], M);

	scanf ("%d %d %d", &n, &m, &g);
	for (zeros=0; zeros<=n; zeros++){
		if (starter==g && zeros+1<n+m) res=(res+cn(n+m-zeros-1, m-1))%M;
		if (starter!=g && n==zeros && m==1) res=(res+1)%M;
		if (starter==g && n==zeros+1 && m==0) res=(res+1)%M;

		starter=1-starter;
	}
	printf ("%lld\n", res);

return 0;}

#include<bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,a,n) for(int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define FI first
#define SE second
#define maxn 200000
#define mod 1000000007
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef double db;

int a[maxn+5];
ll fac[maxn+5],inv[maxn+5],ifac[maxn+5];

ll C(int n,int m)
{
    if(m<0 || m>n) return 0;
    return fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}
int main()
{
    fac[0]=ifac[0]=inv[1]=1;
    rep(i,2,maxn) inv[i]=inv[mod%i]*(mod-mod/i)%mod;
    rep(i,1,maxn) fac[i]=fac[i-1]*i%mod;
    rep(i,1,maxn) ifac[i]=ifac[i-1]*inv[i]%mod;
    int n,m,g; scanf("%d%d%d",&n,&m,&g);
    int N=n+m;
    if(!n || !m)
    {
        rep(i,1,N) a[i]=m>0;
        per(i,2,N) a[i-1]=(a[i]|a[i-1])^1;
        printf("%d\n",a[1]^g^1);
    }
    else
    {
        ll ans=0;
        rep(i,0,n)
        {
            if((i&1)^g) ans=(ans+(i==n && m==1))%mod;
            else if(!(i==n && m==1)) ans=(ans+C(N-i-1,n-i))%mod;
        }
        printf("%I64d\n",ans);
    }
    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int mod = 1e9+7;
const int nmax = 2e5+5;
long long fact[nmax],inv_fact[nmax];
long long extended_euclid(long long a, long long b, long long c, long long d){
	if(c==0)
		return b;
	return extended_euclid(c,d,a%c,b-(a/c)*d);
}
long long inverse(long long a){
	return (extended_euclid(mod,0,a,1)%mod+mod)%mod;
}
long long comb(int a, int b){
//	if(fact[a]/fact[b]/fact[a-b]!=((fact[a]*inv_fact[b])%mod*inv_fact[a-b])%mod) cout << a << ' ' << b << '\n';
//	return fact[a]/fact[b]/fact[a-b];
	return ((fact[a]*inv_fact[b])%mod*inv_fact[a-b])%mod;
}
int f(int n, int m, int g){
	if(n<0||m<0)
		return 0;
	if(n+m==1)
		return (g==0&&n==1)||(g==1&&m==1);
	if(g==1)
		return f(n-1,m,0);
	if(g==0){
//		return f(n-1,m,1)+f(n,m-1,0)+f(n,m-1,1);
//		(n+m-1,m-1) m-1 will stay constant
//		(n+m-1)!/(m-1)!/(n)!
		return (f(n-1,m,1)+comb(n+m-1,n))%mod;
	}
}
int main(){
	fact[0]=1;
	inv_fact[0]=1;
	for(int i = 1; i < nmax; ++i){
		fact[i]=(fact[i-1]*i)%mod;
		inv_fact[i]=inverse(fact[i]);
	}
	ios_base::sync_with_stdio(false);
	int n,m,g;
	cin >> n >> m >> g;
	cout << f(n,m,g) << '\n';
}

//Copyright @ 2013, Chow-Shing Shih, All rights reserved.
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <ctime>
#include <utility>
#include <iostream>
#include <cmath>
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define mp(x, y) (make_pair(x, y))
#define pb(x) push_back(x)
#define clr(a, b) memset(a, b, sizeof(a))

using namespace std;

typedef long long llu;

inline void read(int &n)
{
    char c;
    for (c = getchar(); !(c >= '0' && c <= '9'); c = getchar());
    n = c - '0';
    for (c = getchar(); c >= '0' && c <= '9'; c = getchar()) n = n * 10 + c - '0';
}

typedef long long llu;
const llu mod = 1000000007;
llu N, M, G, fact[300000], ans;

llu inv(llu base, int n)
{
	if (n == 1) return base;
	int tmp = inv(base, n >> 1);
	tmp = (long long)tmp * (long long)tmp % mod;
	if (n & 1) tmp = (long long)tmp * (long long)base % mod;
	return tmp;
}

llu C(llu N, llu K)
{
	if (!K || !N) return 1;
	llu res = fact[N];
	res = (res * inv(fact[N - K] * fact[K] % mod, mod - 2)) % mod;
	return res;
}

int main()
{
	scanf("%I64d%I64d%I64d", &N, &M, &G);
	fact[0] = 1;
	rep(i, 1, 200000) fact[i] = fact[i - 1] * i % mod;
	rep(i, 1, N + 1)
	if (i <= N + M)
	{
		llu g;
		if (M == 1 && i == N + 1) g = (i & 1) ? 1 : 0;
		else g = (i & 1) ? 0 : 1;
		if (g == G)	ans = (ans + C(N + M - i, M - 1)) % mod;
	}
	if (!M)
	{
		llu g = (N & 1) ? 0 : 1;
		if (g == G) ans=1;
	}
	printf("%I64d\n", ans);
    return 0;
}

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <memory.h>
#include <ctime>
#include <bitset>

using namespace std;

#define ABS(a) ((a>0)?a:-(a))
#define MIN(a,b) ((a<b)?(a):(b))
#define MAX(a,b) ((a<b)?(b):(a))
#define FOR(i,a,n) for (int i=(a);i<(n);++i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define pnt pair <int, int>
#define mp make_pair
#define PI 3.14159265358979
#define MEMS(a,b) memset(a,b,sizeof(a))
#define LL long long
#define U unsigned

LL fact[200100];
LL inv[200100];
int mod=1000000007;
LL dp[2][200100];
LL r(LL c, LL p)
{
	if (p==0)
		return 1;
	LL res=r(c,p/2);
	res*=res;
	res%=mod;
	if (p&1)
	{
		res*=c;
		res%=mod;
	}
	return res;
}

LL getc(int n, int k)
{
	LL res=fact[n]*inv[k];
	res%=mod;
	res*=inv[n-k];
	res%=mod;
	return res;
}
int main()
{
#ifdef Fcdkbear
	freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	double beg=clock();
#endif

	int n,m,g;
	cin>>n>>m>>g;
	fact[0]=1;
	FOR(i,1,200100)
	{
		fact[i]=(fact[i-1]*i);
		fact[i]%=mod;
	}
	FOR(i,0,200100)
		inv[i]=r(fact[i],mod-2);
	dp[0][0]=1;
	if ((m==1) || (m==0))
		dp[0][0]=0;
	dp[1][0]=1-dp[0][0];
	FOR(i,1,n+1)
	{
		LL c=getc(i+m-1,i);
		dp[0][i]=dp[1][i-1]+c;
		dp[0][i]%=mod;
		c=getc(i+m,i);
		dp[1][i]=c-dp[0][i];
		if (dp[1][i]<0)
			dp[1][i]+=mod;
	}
	cout<<dp[g][n]<<endl;
#ifdef Fcdkbear
	double end=clock();
	fprintf(stderr,"*** Total time = %.3lf ***\n",(end-beg)/CLOCKS_PER_SEC);
#endif
	return 0;
}

#include <cstdio>
#define LL long long
#define REP(i,n) for (int i=1;i<=n;++i)
using namespace std;

const LL MO=1000000007ll;
const int MAXN=200020;
int n,m,g;
LL ans;
LL quc[MAXN];
LL cuq[MAXN];

inline LL Pow(LL a,LL b) {
	LL ret=1;
	for (;b;b>>=1) {
		if (b&1) ret=ret*a%MO;
		a=a*a%MO;
	}
	return ret;
}

inline LL C(int n,int k) {
	return quc[n]*cuq[k]%MO*cuq[n-k]%MO;
}

int main() {
	scanf("%d%d%d",&n,&m,&g);
	if (!m) {
		if (n%2!=g) puts("1"); else puts("0");
		return 0;
	}
	quc[0]=1; cuq[0]=1;
	REP(i,n+m) {
		quc[i]=quc[i-1]*(LL)i%MO;
		cuq[i]=Pow(quc[i],MO-2);
	}
	REP(i,n+1) {
		if ((i==n+1)&&(m==1)) {
			if (i%2==g) ++ans;
			continue;
		}
		LL tmp=C(n+m-i,m-1);
		if (i%2!=g) ans=(ans+tmp)%MO;
	}
	printf("%I64d\n",ans);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>pii;
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
mt19937_64 rngll(rng());
const int mn=2e5+10;
ll mod=1e9+7;
ll po(ll a,ll b=mod-2){
    ll ans=1;
    for(;b;b>>=1,a*=a,a%=mod)if(b&1)ans*=a,ans%=mod;
    return ans;
}
ll fact[mn];
ll ch(ll a,ll b){
    return fact[a]*po(fact[b]*fact[a-b]%mod)%mod;
}
int main(){
    int n,m,g;
    scanf("%d%d%d",&n,&m,&g);
    fact[0]=1;
    for(int i=1;i<mn;i++)fact[i]=fact[i-1]*i%mod;
    ll ans=0;
    if(m==0){
        ans=(n&1);
    }
    else if(m==1){
        for(int i=0;i<n;i+=2)ans++;
        ans+=(n&1);
    }
    else{
        for(int i=0;i<=n;i+=2)ans+=ch(n-i+m-1,m-1),ans%=mod;
    }
    if(g==1)ans=(ch(n+m,n)-ans)%mod;
    if(ans<0)ans+=mod;
    printf("%lld",ans);
}

#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define int long long

using namespace std;
const int mod=1e9+7;
int n,m,g,fac[200010],inv[200010],ans;

inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(!isdigit(ch)){if(ch=='-') f=-1;ch=getchar();}
    while(isdigit(ch)){x=x*10+(ch^48);ch=getchar();}
    return x*f;
}

inline int fpow(int a,int b){
    int res=1;
    while(b){
        if(b&1) res=res*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return res;
}

inline int C(int n,int m){
    return fac[n]*inv[n-m]%mod*inv[m]%mod;
}

inline void init(){
    fac[0]=1;
    for(int i=1;i<=n+m;i++)
        fac[i]=fac[i-1]*i%mod;
    inv[n+m]=fpow(fac[n+m],mod-2);
    for(int i=n+m-1;i>=0;i--)
        inv[i]=inv[i+1]*(i+1)%mod;
}

signed main(){
    n=read();m=read();g=read();
    init();
    if(!n) return printf("%lld",m==1?g:g^1)&0;
    if(!m) return printf("%lld",n&1?g^1:g)&0;
    if(g){
        for(int i=1;i<=n;i+=2) ans=(ans+C(n+m-i-1,m-1))%mod;
        if(m==1){
            if(n&1) ans=(ans-1+mod)%mod;
            else ans=(ans+1)%mod;
        }
    }
    else{
        for(int i=0;i<=n;i+=2) ans=(ans+C(n+m-i-1,m-1))%mod;
        if(m==1){
            if(n&1) ans=(ans+1)%mod;
            else ans=(ans-1+mod)%mod;
        }
    }
    printf("%lld",ans);
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n,m;
	cin >> n >> m;
	int g;
	cin >> g;

	if(m==0){
		if(n&1){
			if(g&1) cout << 0 << "\n";
			else cout << 1 << "\n";
		}else{
			if(g&1) cout << 1 << "\n";
			else cout << 0 << "\n";
		}
		return 0;
	}

	const long long mod=1000000007;

	int fs=505050;
	vector<long long> fact(fs),ifact(fs),invs(fs);
	fact[0]=ifact[0]=fact[1]=ifact[1]=invs[1]=1;
	for(int i=2;i<fs;i++){
		fact[i]=fact[i-1]*i%mod;
		invs[i]=mod-invs[mod%i]*(mod/i)%mod;
		ifact[i]=ifact[i-1]*invs[i]%mod;
	}
	function<long long(int,int)> binom=[&](int a,int b){
		if(b==0) return 1LL;
		if(a<b || b<0) return 0LL;
		return fact[a]*ifact[b]%mod*ifact[a-b]%mod;
	};

	if(g==1){
		long long res=0;
		for(int i=1;i<=n;i+=2){
			res=(res+binom(n+m-i-1,m-1))%mod;
		}
		if(m==1 && (n&1)) res=(res+mod-1)%mod;
		if(m==1 && !(n&1)) res=(res+1)%mod;
		cout << res << "\n";
	}else{
		long long res=0;
		for(int i=0;i<=n;i+=2){
			res=(res+binom(n+m-i-1,m-1))%mod;
		}
		if(m==1 && !(n&1)) res=(res+mod-1)%mod;
		if(m==1 && (n&1)) res=(res+1)%mod;
		cout << res << "\n";
	}
	return 0;
}

#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <queue>
#include <list>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <sstream>

#define mp make_pair
#define pb push_back

using namespace std;

typedef int i;
typedef long long ll;

typedef double d;
typedef long double ld;

typedef pair<int, int> pii;
typedef vector<int> vi;

typedef vector <vector<int> > graph;

ll F[2 * 100 * 1000];
ll MOD = 1000 * 1000 * 1000 + 7;
ll ANS = 0;

ll POW(ll a, ll b)
{
	if (b == 1)
		return a % MOD;
	if (b % 2 == 0)
	{
		ll tmp = POW(a, b / 2);
		tmp *= tmp;
		return tmp % MOD;
	}
	else
		return (POW(a, b - 1) * a) % MOD;
}

ll inv(ll a)
{
	return POW(a, MOD - 2);
}

ll C(ll n, ll k)
{
	return ((F[n]) * inv((F[k] * F[n - k]) % MOD)) % MOD;
}

void print(int a)
{
	cout << a << endl;
}

int main()
{
	ios_base::sync_with_stdio(0);
	F[0] = 1;
	for (int i = 1; i < 2 * 100 * 1000; i++)
		F[i] = (F[i - 1] * i) % MOD;
	int n, m, g, L;
	cin >> n >> m >> g;
	L = n + m;
	if (m == 0)
	{
		if ((g + 2) % 2 == n % 2)
			print(0);
		else
			print(1);
		exit(0);
	}
	if (n == 0)
	{
		if (m == 1)
		{
			if (g == 0)
				print(0);
			else
				print(1);
		}
		else
		{
			if (g == 0)
				print(1);
			else
				print(0);
		}
		exit(0);
	}
	if (L == 2)
	{
		if (g == 0)
			print(2);
		else
			print(0);
		exit(0);
	}
	for (int i = 0; i <= n; i++)
	{
		if (L - i - 1 > 0)
		{
			if (i % 2 == g)
				ANS += C(L - i - 1, m - 1);
		}
		else
			if (i % 2 == (g + 1) % 2)
				ANS += C(L - i - 1, m - 1);
	}
	print(ANS % MOD);
	#ifdef HOME
		cerr << "\ntime = " << clock() / 1000 << " ms\n";
	#endif
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define x first
#define y second
#define rep(x,s,to) for(int x=(s);x<(to);x++)
#define itr(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define all(a) (a.begin()),(a.end())
typedef  pair<int,int> pii;
typedef vector<pair<int, int>> vpii;
 ll mod=(ll)(1e9+7);
ll f[200005],fi[200005];

ll pow(ll a, ll b)
{
    if(b==0) return 1;
    if(b%2==1)
    return (a*pow((a*a)%mod,b/2))%mod;
    return pow((a*a)%mod,b/2);
}
ll inv(ll a)
{
    return pow(a,mod-2);
}

ll c(ll a,ll b)
{
    if(a==0 && b==0 ) return 0;
    return (((f[a+b]*fi[a])%mod)*fi[b])%mod;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);

int n,m,g;
cin>>n>>m>>g;
f[0]=1; fi[0]=1;
for(int i=1;i<=(n+m);i++) {f[i]=(f[i-1]*i)%mod; fi[i]=(fi[i-1]*inv(i))%mod;}
ll dp[n+1];
if(m>1)dp[1]=1; else dp[1]=0;
if(m>1) dp[0]=0; else dp[0]=1;
for(int i=2;i<=n;i++)
{
    dp[i]=(dp[i-2]+c(i-1,m-1))%mod;
}
if(g)
{
    cout<<dp[n]<<endl;
}
else
{
    cout<<((n!=0 ? dp[n-1] : 0)+(m>0 ? c(n,m-1) : 0))%mod;
}
}

#include <iostream>
using namespace std;

int n,m,g, M=1e9+7, inw;
int silnia[1000007];
long long res;

long long pow(long long a, int n)
{
    if (n==1)
        return a;
    if (n%2==0)
    {
        long long x=pow(a,n/2);
        return (x*x)%(long long)M;
    }
    return (a*pow(a,n-1))%(long long)M;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>m>>g;
    if (m==0)
    {
        if (n%2!=g)
            cout<<1;
        else
            cout<<0;
        return 0;
    }
    silnia[0]=1;
    for (int i=1; i<n+m; i++)
    {
        silnia[i]=((long long)silnia[i-1]*(long long)i)%(long long)M;
    }
    inw=pow(silnia[m-1],M-2); //cout<<inw<<"\n";

    for (int i=g; i<n; i+=2)
    {
        res+=((((long long)silnia[n+m-1-i]*pow(silnia[n-i],M-2))%(long long)M)*(long long)inw)%(long long)M;
        res%=M;
        //cout<<res<<"\n";
    }
    if (m==1 && (n+1)%2==g)
        res++;
    else if (m>1 && (n-g)%2==0)
        res++;
    res%=M;
    cout<<res;
    return 0;
}

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

typedef long long ll;
const int N = (int)2e5 + 50;
const ll mod = (int)1e9 + 7;

int n, num[N];
int m, g;
ll fac[N], facinv[N];
ll inv[N];

ll fp(ll x, ll k){
    if(k == 0) return 1;
    ll hf = fp(x, k/2);
    return k % 2 ? hf * hf % mod * x % mod: hf * hf % mod;
}

ll comb(int n, int k){
    if(k < 0 || k > n) return 0;
    return fac[n] * facinv[k] % mod * facinv[n - k] % mod;
}

int main(){
    inv[1] = 1;
    for(int i = 2; i < N; i++) inv[i] = (mod - (mod / i) * inv[mod % i] % mod) % mod;
    fac[0] = 1;
    for(int i = 1; i <= N-1; i++) fac[i] = fac[i-1] * i % mod;
    facinv[N-1] = fp(fac[N-1], mod - 2);
    for(int i = N-1 - 1; i >= 0; i--) facinv[i] = facinv[i+1] * (i+1) % mod;

    cin >> n >> m >> g;
    ll res = 0;
    if(m >= 1) {
        for(int bef = g; bef < n + m - 1; bef += 2) {
            res += comb(n + m - bef - 1, n - bef);
            res %= mod;
        }
    }
    int zeros = n + m - 1 + ((n + m) % 2 != g), ones = n + m - zeros;
    if(zeros <= n && ones <= m) res = (res + 1) % mod;
    cout << res << endl;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define all(x) (x).begin(), (x).end()

using namespace __gnu_pbds;
using namespace std;

using ull = unsigned long long;
using ll = long long;
using ld = long double;
template <typename T> using ordered_set = tree<T, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;

const int mod = 1e9 + 7;
const int inf = INT_MAX;
const int N = 2e5 + 5;

ll modexp(ll x, ll n) {
    ll ans = 1;
    while (n) {
        if (n & 1) ans = ans * x % mod;
        x = x * x % mod;
        n /= 2;
    }
    return ans;
}

ll modinv(ll x) {
    return modexp(x, mod - 2);
}

ll fact[N];

ll choose(int n, int k) {
    if (k > n)
        return 0;

    ll num1 = fact[n];
    ll num2 = fact[n - k] * fact[k] % mod;

    return num1 * modinv(num2) % mod;
}

int n, m, g;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);

    fact[0] = 1;
    for (int i = 1; i < N; i++)
        fact[i] = i * fact[i - 1] % mod;

    cin >> n >> m >> g;
    //01 = 10 = 11 = 0, 00 = 1

    string s;
    s += (g == 0 ? "0" : "1");

    ll ans = 0;
    for (int i = 1; i < n + m; i++) {
        if (s.back() == '0') {
            ans = (ans + choose(n + m - i, m - 1)) % mod; //1001, 1010, 1100,
            s += "1";
        }
        else {
            s.pop_back();
            s += "00";
        }
    }

    int c = count(all(s), '1');
    if (c == m)
        ans = (ans + 1) % mod;

    cout << ans << "\n";
    return 0;
}

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

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ppb pop_back()
#define ppf pop_front()
#define all(vec) vec.begin(), vec.end()
#define fol(i,a,b) for(int i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i>=b;i--)
#define forr(x,arr) for(auto& x:arr)
#define mod 1000000007
#define INF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-7
#define sz(x) ((lli)(x).size())

using   lli     =   long long;
using   lld     =   long double;
using   ulli    =   unsigned long long int;
using   pll     =   pair<lli, lli>;
using   ttt     =   pair<lli, pll>;
using   vttt    =   vector<ttt>;
using   vll     =   vector<pll>;
using   vl      =   vector<lli>;
using   vi      =   vector<int>;
using   vvi     =   vector<vector<int>>;
using   cd      =   complex<lld>;
const double PI = acos(-1);

#ifndef tejasp
#define trace(...) {}
#define cotra(...) {}
#define end_routine() {}
#define localsys 0
#define endl '\n'
#endif

inline lli mpow(lli a, lli b, lli m=mod) {
    lli ans = 1;
    // a=((a%mod)+mod)%mod; b=((b%mod)+mod)%mod;
    while (b) {
        if (b&1) ans=(ans*a)%m;
        a=(a*a)%m; b/=2;
    }
    return ans;
}

#define MAXN 200010
lli fact[MAXN], invf[MAXN];

void __prec()
{
    fact[0]=1;
    fol(i,1,MAXN) fact[i]=(fact[i-1]*i)%mod;
    fol(i,0,MAXN) invf[i]=mpow(fact[i],mod-2);
}

lli nck (lli n, lli k)
{
    if(k<0||n<k) return 0;
    return (((fact[n]*invf[n-k])%mod)*invf[k])%mod;
}

int tejas_919(int kkkk)
{
    lli n, m, k, q, u, v, temp=0, ans=0;
    cin>>n>>m>>k;
    lli tot=n+m;
    fol(i,0,tot-1)
    {
        if((i+k)%2) continue;
        ans+=nck(tot-i-1,m-1);
    }
    if(tot%2==0 && k==1 && m==0) ans++;
    if(tot%2==0 && k==0 && m==1) ans++;
    if(tot%2==1 && k==1 && m==1) ans++;
    if(tot%2==1 && k==0 && m==0) ans++;
    ans%=mod;
    cout<<ans<<endl;
    return 0;
}

signed main()
{
    #ifdef tejasp
            freopen("input.txt", "rt", stdin);
            freopen("output.txt", "wt", stdout);
    #endif
    if(!localsys) { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); }
    cout << fixed << setprecision(10);
    int t=1;
    __prec();
    //cin>>t;
    fol(i,0,t) { tejas_919(i+1); }
    end_routine();
    if(localsys) system("pause");
}

//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree <pair <int, int>, null_type, less <pair <int, int> >, rb_tree_tag, tree_order_statistics_node_update>
using namespace __gnu_pbds;

#define ll long long
#define db long double
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mp make_pair
#define size(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

#define endl "\n"
#define int long long

using namespace std;

void dout() {
    cerr << endl;
}
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;

const int N = 2e5 + 123, MOD = 1e9 + 7;
int n, m, g, fact[N], rev[N];

int binpow(int x, int y) {
    int res = 1;
    while (y > 0) {
        if (y & 1) {
            res = res * x % MOD;
        }
        x = x * x % MOD;
        y /= 2;
    }
    return res;
}

int c(int x, int y) {
    if (y > x) {
        return 0;
    }
    return (fact[x] * rev[y] % MOD) * rev[x - y] % MOD;
}

void solve(int tc) {
    // check for (int i = 0; i < n; j++)
    cin >> n >> m >> g;
    // g = 1
    int ans = 0;
    if (m > 0) {
        for (int x = 1; x <= n; x += 2) {
            if (x == n && m <= 1) {
                break;
            }
            ans += c(n + m - x - 1, m - 1);
            if (ans >= MOD) {
                ans -= MOD;
            }
        }
    }
    if ((n + m) % 2 && m == 1) {
        ans = (ans + 1) % MOD;
    }
    if ((n + m) % 2 == 0 && m == 0) {
        ans = (ans + 1) % MOD;
    }
    if (g == 0) {
        ans = (c(n + m, m) - ans + MOD) % MOD;
    }
    cout << ans;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    fact[0] = rev[0] = 1;
    for (int i = 1; i < N; i++) {
        fact[i] = fact[i - 1] * i % MOD;
        rev[i] = rev[i - 1] * binpow(i, MOD - 2) % MOD;
    }

    int tc = 1;
//    cin >> tc;
    for (int i = 0; i < tc; i++) {
        solve(i);
//        cleanup();
    }
}

/* -*- coding: utf-8 -*-
 *
 * 0336D.cc: D. Vasily the Bear and Beautiful Strings
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 200000;
const int MOD = 1000000007;

/* typedef */

typedef long long ll;

/* global variables */

int fs[MAX_N + 1], invfs[MAX_N + 1];

/* subroutines */

int powmod(int a, int n) {  // a^n % MOD
  int pm = 1;
  while (n > 0) {
    if (n & 1) pm = (ll)pm * a % MOD;
    a = (ll)a * a % MOD;
    n >>= 1;
  }
  return pm;
}

inline int nck(int n, int k) {  // nCk % MOD
  return (ll)fs[n] * invfs[n - k] % MOD * invfs[k] % MOD;
}

void prepare_fracs(int n) {
  fs[0] = invfs[0] = 1;
  for (int i = 1; i <= n; i++) {
    fs[i] = (ll)fs[i - 1] * i % MOD;
    invfs[i] = powmod(fs[i], MOD - 2);
  }
}

inline void addmod(int &a, int b) { a = (a + b) % MOD; }

/* main */

int main() {
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);

  int n, m, g;
  scanf("%d%d%d", &n, &m, &g);

  prepare_fracs(n + m);

  int sum = -1;

  if (m == 0) {
    sum = (n & 1) ^ g;
  }
  else if (m == 1) {
    if (n == 0)
      sum = g;
    else {
      sum = 0;
      for (int i = 0; i < n; i++)
	addmod(sum, (i & 1) ^ 1 ^ g);
      addmod(sum, (n & 1) ^ g);
    }
  }
  else { // m >= 2
    sum = 0;
    for (int i = 0; i <= n; i++)
      addmod(sum, ((i & 1) ^ 1 ^ g) * nck(n - i + m - 1, n - i));
  }

  printf("%d\n", sum);
  return 0;
}

/*
 * if you are interested in the reference code here,
 * see https://github.com/georeth/OJLIBS for more information
 *
 * Solution Author : Georeth Chow <georeth2010@gmail.com>
 */
#include <cstdio>
#include <cmath>
#include <cstring>      // memset
#include <cstdlib>      // malloc
#include <cstdint>      // int64_t
#include <cinttypes>    // PRId64 SCNd64
#include <cassert>      // assert
#include <limits>       // numeric_limits
#include <vector>
#include <deque>
#include <map>
#include <set>
#include <tuple>        // pair, tuple
#include <iostream>     // be careful
#include <sstream>
#include <algorithm>
#include <utility>
#include <iterator>
template <typename It>
struct iter_range : std::pair<It, It> {
    typedef std::pair<It, It> base_t;
    typedef It iterator;
    using base_t::base_t;
    It begin() { return base_t::first; }
    It end() { return base_t::second; }
};
template <typename It>
iter_range<std::reverse_iterator<It>> rev(const iter_range<It> &origin) {
    using rev_t = std::reverse_iterator<It>;
    return {rev_t(origin.second), rev_t(origin.first)};
}
// TODO: rev on std::string, etc.
template <typename Int = int>
struct int_iter {
    Int i;
    explicit int_iter(Int i = 0) : i(i) { }
    Int operator*() const { return i; }
    int_iter &operator++() { ++i; return *this; }
    int_iter &operator--() { --i; return *this; }
    int_iter operator+(Int step) const { return int_iter(i + step); }
    int_iter operator-(Int step) const { return int_iter(i - step); }
    Int operator-(const int_iter &that) const { return i - that.i; }
    int_iter &operator+=(Int step) { i += step; return *this; }
    int_iter &operator-=(Int step) { i -= step; return *this; }
    bool operator==(const int_iter &that) const { return  i == that.i; }
    bool operator!=(const int_iter &that) const { return !(*this == that); }
    Int operator[](Int n) { return i + n; }
    typedef Int difference_type;
    typedef Int value_type;
    typedef Int *pointer;
    typedef Int reference; // not a int container, never reference to int
    typedef std::random_access_iterator_tag iterator_category;
};
template <typename Int = int>
using int_range = iter_range<int_iter<Int>>;
template <typename Int>
int_range<Int> range(Int b, Int e) { return {int_iter<Int>(b), int_iter<Int>(e > b ? e : b)}; }
template <typename Int>
int_range<Int> range(Int n) { return range(Int(), n); }
template <typename Int>
int_range<Int> nrange(Int n) { return range(Int(1), Int(n+1)); }
template <typename Int>
int_range<Int> inrange(Int b, Int e) { return range(b, Int(e + 1)); }
using namespace std;    // use as solution header. name polution is fine.
#ifdef LOCAL_JUDGE
#  define pr_debug(...) fprintf(stderr, __VA_ARGS__)
#  define pr_line() fprintf(stderr, "%s: %d\n", __FILE__, __LINE__)
#else
#  define pr_debug(...)
#  define pr_line()
#endif
template <typename T>
bool chmax(T &m, const T &v) { if (v > m) return m = v, true; return false; }
template <typename T>
bool chmin(T &m, const T &v) { if (v < m) return m = v, true; return false; }
template <typename T>
T max_s(const T &v) { return v; }
template <typename T, typename... Args>
T max_s(const T &v1, const T &v2, Args... arg) {
    return max_s(max(v1, v2), arg...);
}
template <typename T>
T min_s(const T &v) { return v; }
template <typename T, typename... Args>
T min_s(const T &v1, const T &v2, Args... arg) {
    return min_s(min(v1, v2), arg...);
}
static const int HMAX32 = INT32_MAX / 2;
static const int64_t HMAX64 = INT64_MAX / 2;
#define fast_io\
    ios_base::sync_with_stdio(false); cin.tie(nullptr)
stringstream line_stream() {
    string str;
    getline(cin, str);
    return stringstream(str);
}
#define read_int(id) scanf("%d", &id)
#define read_int64(id) scanf("%" PRId64, &id)
#define new_int(id) int id; read_int(id)
#define new_int64(id) int64_t id; read_int64(id)
#define ALL(x) begin(x), end(x)
#include <type_traits>
// TODO : use gcc arith extension like __builtin_add_overflow
// try binary gcd on large number
template <typename Int>
Int gcd(Int a, Int b) {
    while (a != 0) {
        b %= a;
        if (b == 0)
            return a;
        a %= b;
    }
    return b;
}
template <typename Int, typename RInt = Int>
Int lcm(Int a, Int b) {
    return a / gcd(a, b) * static_cast<RInt>(b);
}
template <typename Int, typename XInt>
Int extended_gcd(Int a, Int b, XInt &x, XInt &y) {
    static_assert(std::numeric_limits<XInt>::is_signed,
            "x, y must be signed");
    // pre condition : a != 0 || b != 0
    // post condition : a * x + b * y = g
    // (a * x) or (b * y) may overflow, but the condition
    //                 always holds.
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    /**
     * r = a - b * q
     * b * k1 + r * k2 = g
     * => a * k2 + b * (k1 - q * k2)
     *                 x = k2
     *                 y = k1 - q * k2 = k1 - q * x
     */
    Int g = extended_gcd(b, a % b, y, x);
    y -= (a / b) * x;
    return g;
}
template <typename Int, typename TInt = int64_t>
Int mul_mod(Int a, Int b, Int m) {
    TInt p = a;
    p = (p * b) % m;
    return (Int)p;
}
template <typename Int, typename PInt, typename TInt = int64_t>
Int pow_mod(Int a, PInt p, Int m) {
    Int r;
    a %= m;
    for (r = 1; p; p >>= 1) {
        if (p & 1) r = mul_mod(r, a, m);
        a = mul_mod(a, a, m);
    }
    return r;
}
template <typename Int,
          typename XInt = typename std::make_signed<Int>::type>
Int inv_mod(Int a, Int m) {
    // a * x = gcd(a, m) (mod m)
    XInt x, y;
    extended_gcd(a, m, x, y);
    if (x < 0)
        return x + m;
    return x;
}
template <typename Int>
static Int addx_mod(Int u, Int v, Int m) {
    Int r = u + v;
    if (r >= m) r -= m;
    return r;
}
template <typename Int>
static Int subx_mod(Int u, Int v, Int m) {
    Int r = u - v;
    if (r < 0) r += m;
    return r;
}
template <typename Int>
Int div_pos_r(Int a, Int b, Int &r) {
    // 3 / 2  = 1 .. 1 (ok)
    // 3 / -2 = -1 .. 1 (ok)
    // -3 / 2 = -1 .. -1 (not ok)
    // -3 / -2 = 1 .. -1 (not ok)
    // a = q b + r
    //   = (q + 1) b + (r - b)
    //   = (q - 1) b + (r + b)
    Int q = a / b;
    r = a % b;
    if (r < 0) {
        if (b < 0)
            q += 1, r -= b;
        else
            q -= 1, r += b;
    }
    return q;
}
// TODO: gauss_factorial, factorial_mod.
//       log, factorial_exp
#define INV_MOD(x)      inv_mod((x), MOD)
#define MUL_MOD(x, y)   mul_mod((x), (y), MOD)
#define MULM_MOD(x, y)  (x) = mul_mod((x), (y), MOD)
#define POW_MOD(x, y)   pow_mod((x), (y), MOD)
#define ADDX_MOD(x, y)  addx_mod((x), (y), MOD)
#define ADDM_MOD(x, y)  (x) = addx_mod((x), (y), MOD)
#define SUBX_MOD(x, y)  subx_mod((x), (y), MOD)
#define SUBM_MOD(x, y)  (x) = subx_mod((x), (y), MOD)
// warning : mod is LARGE enough PRIME
struct factorial_list {
    std::vector<int> fact;
    int mod;
    factorial_list(int n, int mod) : fact(n + 1), mod(mod) {
        fact[0] = 1;
        for (int i = 1; i <= n; ++i)
            fact[i] = mul_mod(fact[i - 1], i, mod);
    }
    int operator()(int n) { return fact[n]; }
    int A(int n, int m) {
        return mul_mod(fact[n], inv_mod(fact[n - m], mod), mod);
    }
    int C(int n, int m) {
        if (m > n || n < 0 || m < 0) return 0;
        return mul_mod(A(n, m), inv_mod(fact[m], mod), mod);
    }
    int H(int n, int m) {
        return C(n + m - 1, m);
    }
};
// C(n, m) = C(n, n - m)
// Be cautious about overflow
// try Lucas if n is large, but r is small
// e.g C(10^15, 10^4, 1e9 + 7)
// use precompute C[][] if n and r are both small
// 30X faster than factorial list
template <int N, int Mod>
struct binomial_table {
    int arr[N][N];
    binomial_table() {
        arr[0][0] = 1;
        for (int i = 0; i < N; ++i) {
            arr[i][0] = 1;
            for (int j = 1; j < i; ++j)
                arr[i][j] = addx_mod(arr[i - 1][j], arr[i - 1][j - 1], Mod);
            arr[i][i] = 1;
        }
    }
    int C(int n, int m) {
        if (m > n || n < 0 || m < 0) return 0;
        return arr[n][m];
    }
    int H(int n, int m) {
        return C(n + m - 1, m);
    }
};
/* =====  SOLUTION START  ===== */
// dp[n][m][g] = #{ s, '0' * n, '1' * m, f(s) = g}
//
// dp[n][m][0] -> dp[n + 1][m][1]
//             -> dp[n][m + 1][0]
// dp[n][m][1] -> dp[n + 1][m][0]
//             -> dp[n][m + 1][0]
//
//
// dp[n][m][1] = dp[n-1][m][0]
// dp[n][m][0] = dp[n][m-1][1] + dp[n-1][m][1] + dp[n][m-1][0]
//             = 2 ^ (m + n - 1) + dp[n-2][m][0]
// so easy
//      dp[0][m][0]
//      dp[1][m][0]
//
static const int MOD = 1000000007;
const int maxn = 300005; // FIXME
factorial_list F(maxn, MOD);
int solve(int n, int m) {
    if (n == 0 && m == 0) return 0;
    if (n == 0) {
        if (m == 1) return 0; // "1"
        return 1;
    } else if (n == 1) {
        if (m == 0) return 1;
        else if (m == 1) return 2;
        else return m;
    } else {
        return ADDX_MOD(F.C(m + n - 1, n), solve(n - 2, m));
    }
}
int main() {
    int n, m, g;
    cin >> n >> m >> g;
    int r = solve(n, m);
    if (g)
        r = SUBX_MOD(F.C(n + m, n), r);
    printf("%d\n", r);
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define MOD 1000000007
int len;
#define MAXI 2*100000
map< pair<int,int> , LL > dp;
LL F[MAXI+10];
LL P[MAXI+10];
#define offset 10
LL PowMod(LL N,LL P)
{
	if(P==0)
		return 1;
	LL Res = PowMod(N,P/2);
	Res = (Res*Res)%MOD;
	if(P&1)
		return (Res*N)%MOD;
	return Res;
}
void Preprocess()
{
	F[0] = 1;
	for(int i = 1;i<=MAXI;i++)
		F[i] = (F[i-1]*i)%MOD;
	for(int i = 0;i<=MAXI;i++)
		P[i] = PowMod(F[i],MOD-2);
}
LL C(LL N,LL R)
{
	if(N<R)
		return 0;
	if(N==0||R==0)
		return 1;
	return ((F[N]*P[N-R])%MOD*P[R])%MOD;
}
LL calc(int zeros,int ones)
{
	LL &Res = dp[make_pair(zeros,ones)];
	if(Res==0)
	{
		Res = offset;
		if(zeros==1&&ones==0)
			Res+=1;
		else if(ones==1&&zeros==1)
			Res+=2;
		else
		{
			if(ones+zeros>=2)
				Res+=C(zeros+ones-1,zeros);
			if(zeros>=2)
				Res+=calc(zeros-2,ones);
		}
		Res%=MOD;
	}
	return (Res - offset + MOD)%MOD;
}
int main()
{
	Preprocess();
	int zeros,ones,req;
	cin>>zeros>>ones>>req;
	LL Res = calc(zeros,ones);
	if(req)
		Res = (C(zeros+ones,zeros) - Res + MOD)%MOD;
	cout<<Res<<endl;
	return 0;
}

#include <algorithm>
#include<cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include<iterator>
using namespace std;
#define N 100
#define M 10011
#define INF 1<<30
#define exp (1e-8)
#define mm(a,b) memset((a),b,sizeof(a))
#define PI 3.1415926535898
#define E 2.718281828459
#define MOD 1000000007

typedef long long LL;

LL pow(LL a,int b)
{
    LL r=1;
    while(b)
    {
        if(b&1)r=r*a%MOD;
        a=a*a%MOD;
        b/=2;
    }
    return r;
}
LL s[211111];

LL c(LL a,LL b)
{
    return (s[a]%MOD*pow(s[b]*s[a-b]%MOD,MOD-2))%MOD;
}

int main()
{
    int n,m,g;
    cin>>n>>m>>g;
    LL t,ans[2];
    mm(ans,0);
    s[0]=1;
    for(int i=1;i<=n+m;i++)
    {
        s[i]=(s[i-1]*i)%MOD;
    }
    if(m==0)
    {
        if(n%2==0)ans[1]++;
        else ans[0]++;
        cout<<ans[g]<<endl;
        return 0;
    }
    else
    {
        for(int i=0;i<=n;i++)
        {
            if(n+m-i-1==0)ans[(i%2+1)%2]++;
            else
            {
                ans[i%2]=(ans[i%2]+c(n+m-i-1,m-1))%MOD;
            }
        }
    }
    cout<<ans[g]%MOD<<endl;
    return 0;
}

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define MOD 1000000007

LL fact[222222];
LL invfact[222222];

LL inverse(LL a, LL mod){
	LL d0 = a, d1 = mod;
	LL x0 = 1, x1 = 0;
	LL dt, xt;
	while(d1 != 0){
		dt = d1;
		xt = x1;
		d1 = d0-(d0/dt)*dt;
		x1 = x0-(d0/dt)*xt;
		d0 = dt;
		x0 = xt;
	}
	if(x0 < 0)x0 = x0+mod;
	if(d0 == 1)return x0;
	else return -1;
}

LL comb(int p, int q){
	if(p<q)return 0;
	LL ret=fact[p];
	ret *= invfact[q];
	ret %= MOD;
	ret *= invfact[p-q];
	ret %= MOD;
	return ret;
}

LL C(int p, int q, int r){
	if(q==0){
		if(r==0){
			if(p%2==1)return 1LL;
			else return 0LL;
		}else{
			if(p%2==1)return 0LL;
			else return 1LL;
		}
	}
	LL ret = 0;
	while(p>1){
		if(r==0){
			ret += comb(p+q-1, p);
			ret %= MOD;
		}else{
			ret += comb(p+q-2, p-1);
			ret %= MOD;
		}
		p-=2;
	}
	if(p==0){
		if(r==0){
			if(q!=1)ret+=1;
		}else{
			if(q==1)ret+=1;
		}
	}else{
		if(r==0){
			if(q==1)ret+=q+1;
			else ret+=q;
		}else{
			if(q!=1)ret+=1;
		}
	}
	ret %= MOD;
	return ret;
}

int main(){
	fact[0]=fact[1]=invfact[0]=invfact[1]=1;
	FOR(i,2,222222)fact[i] = (fact[i-1]*i)%MOD;
	FOR(i,2,222222)invfact[i] = inverse(fact[i], MOD);
	int n,m,g;
	cin>>n>>m>>g;
	cout << C(n,m,g) << endl;
	return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include<cstdlib>
#include<queue>
#include<map>
#define ll long long
#define pb push_back
#define cs(a) (int)a.size()
#define mp make_pair
#define pii pair<int, int>
#define fi first
#define stol stol_mine
#define se second
#define uch unsigned char
#define MOD 1000000007LL
using namespace std;
ll fact[400000];

ll power(ll x, ll st) {
        if (st == 0) return 1;
        if (st == 1) return x;
        if (st % 2 == 0) {
                ll t = power(x, st / 2);
                return (t * t) % MOD;
        } else
                return (power(x, st - 1) * x) % MOD;
}

ll obr(ll x) {
        return power(x, MOD - 2);
}

ll C(int n, int k) {
        if (k > n) return 0;
        if (k < 0) return 0;
        return (fact[n] * obr(fact[n - k])) % MOD * obr(fact[k]) % MOD;
}

ll solve(int n, int ed, int cur) {
    if (n == 1) {
        if (ed == cur)
            return 1;
        else
            return 0;
    }
    if (cur == 0) {
        return (C(n - 1, ed - 1) + solve(n - 1, ed, 1)) % MOD;
    } else {
        return solve(n - 1, ed, 0);
    }
}

int main(void) {
    int n, m, g, asdj;
//34324
    cin >> n >> m >> g;
    fact[0] = 1;
    for (ll i = 1; i <= 300000; ++i)
        fact[i] = (fact[i - 1] * i) % MOD;
    cout << solve(n + m, m, g) << endl;
}

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define MOD 1000000007

LL fact[200002];

LL inverse(LL a, LL mod){
	LL d0 = a, d1 = mod;
	LL x0 = 1, x1 = 0;
	LL dt, xt;
	while(d1 != 0){
		dt = d1;
		xt = x1;
		d1 = d0-(d0/dt)*dt;
		x1 = x0-(d0/dt)*xt;
		d0 = dt;
		x0 = xt;
	}
	if(x0 < 0)x0 = x0+mod;
	if(d0 == 1)return x0;
	else return -1;
}

LL comb(int p, int q){
	if(p<q)return 0;
	LL ret=fact[p];
	ret *= inverse(fact[q], MOD);
	ret %= MOD;
	ret *= inverse(fact[p-q], MOD);
	ret %= MOD;
	return ret;
}

LL C(int p, int q, int r){
	if(q==0)return (r+p)%2;
	LL ret = 0;
	while(p>1){
		if(r==0){
			ret += comb(p+q-1, p);
			ret %= MOD;
		}else{
			ret += comb(p+q-2, p-1);
			ret %= MOD;
		}
		p-=2;
	}
	if(p==0)ret+=(r+(q!=1))%2;
	else{
		if(r==0){
			if(q==1)ret+=q+1;
			else ret+=q;
		}else{
			ret+=(q!=1);
		}
	}
	ret %= MOD;
	return ret;
}

int main(){
	fact[0]=fact[1]=1;
	FOR(i,2,200002)fact[i] = (fact[i-1]*i)%MOD;
	int n,m,g;
	cin>>n>>m>>g;
	cout << C(n,m,g) << endl;
	return 0;
}

#include <cstdlib>
#include <cstring>
#include <memory>
#include <cstdio>
#include <fstream>
#include <iostream>
#include <cmath>
#include <string>
#include <sstream>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
using namespace std;

typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)

#define FOR(x,to) for(x=0;x<to;x++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ZERO(a) memset(a,0,sizeof(a))
void _fill_int(int* p,int val,int rep) {int i;  FOR(i,rep) p[i]=val;}
#define FILL_INT(a,val) _fill_int((int*)a,val,sizeof(a)/4)
#define MINUS(a) _fill_int((int*)a,-1,sizeof(a)/4)
ll GETi() { ll i;scanf("%lld",&i); return i;}
//-------------------------------------------------------

int N,M,G;
ll mo=1000000007;
vector<ll> rev;

vector<ll> list_mod_inverse(ll n, ll m) {
    vector<ll> inv(n + 1);
    inv[1] = 1;
    for (int i=2;i<=n;++i) inv[i] = inv[m % i] * (m - m / i) % m;
    return inv;
}

void solve() {
    int f,i,j,k,l, x,y;
    ll r=0;

    cin>>N>>M>>G;

    if(M==0) {
        cout << ((N%2)!=G) << endl;
        return;
    }
    if(N==0) {
        G^=(M!=1);
        cout << G << endl;
        return;
    }

    rev = list_mod_inverse(200001,mo);

    // P0(0,M)
    ll ret=(M!=1);
    ll tot=1;

    FOR(i,N) {
        tot = tot*(i+1+M) % mo;
        tot = tot*rev[i+1] % mo;

        ret = (((tot - ret)%mo)+mo)%mo;
    }

    if(G==1) {
        ll tot=1;
        // C[N+M][M]
        FOR(i,M) tot=(tot*(N+M-i) % mo) *rev[i+1]%mo;
        ret = (mo+tot-ret)%mo;
    }
    cout << ret << endl;

    return;
}

int main(int argc,char** argv){
    if(argc>1) freopen(argv[1], "r", stdin);
    solve();
    return 0;
}

//Shubham Vijayvargiya

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define pb push_back
#define mp make_pair
#define eb emplace_back
#define F first
#define S second
#define sz(a) (int)(a.size())
#define set(a,b) memset(a,b,sizeof(a))
#define let(x,a) __typeof(a) x(a)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define all(v) (v).begin(),(v).end()
#define sll(x) { scanf("%lld",&x); }
#define si(x) { scanf("%d",&x); }
#define slf(x) { scanf("%lf",&x); }
#define tcases() long long testcases; cin>>testcases ; while(testcases--)

#define trace(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); cout<<endl;}

vector<string> split(const string& s, char c)
{
	vector<string> v;
	stringstream ss(s);
	string x;
	while (getline(ss, x, c))
		v.emplace_back(x);
	return move(v);
}
void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args)
{
	cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a <<" | ";
	err(++it, args...);
}

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef pair<long long,long long> pll;
typedef vector<long long> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;

//-----------------------------------------------------------------------------------------------------------------------------------------------//

ll fact[200009],invfact[200009];
#define mod 1000000007

ll check_one(ll , ll);
ll check_zero(ll,ll);

ll powmod(ll a,ll b)
{
	ll f;
	if(b==0)
		return 1;
	else if(b==1)
		return a;
	f=powmod(a,b/2)%mod;
	if(b%2==1)
	{
		f=(f*f)%mod;
		return ((f*a)%mod);
	}
	else
		return ((f*f)%mod);
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll n,m,g,ans;
	fact[0]=1;invfact[0]=1;
	rep(i,1,200009)
	{
		fact[i]=(fact[i-1]*i)%mod;
		invfact[i]=powmod(fact[i],mod-2);
	}
	cin>>n>>m>>g;
	if(g==1)
		ans=check_one(n,m);
	else
		ans=check_zero(n,m);
	cout<<ans<<endl;
	return 0;
}
ll check_one(ll n,ll m)
{
	if(n<0 || m<0)
		return 0;
	if(n==0 and m==1)
		return 1;
	if(m==0 and n==1)
		return 0;
	return (check_zero(n-1,m))%mod;
}

ll check_zero(ll n,ll m)
{
	if(n<0 || m<0)
		return 0;
	if(n==1 and m==0)
		return 1;
	if(n==0 and m==1)
		return 0;
	else
	{
//		trace(fact[n+m-1],invfact[n],invfact[m-1]);
		return (((((fact[n+m-1]*invfact[n])%mod)*invfact[m-1])%mod)+check_one(n-1,m))%mod;
	}
}

#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
#define int long long
using namespace std;
int n,m,g,ans,ff,fact[2*1000*100+100];
const int mod=10000*10000*10+7,maxn=2*1000*100+100;
int t(int x,int y){
	if(y==0)
		return 0;
	if(y==1)
		return x;
	int a=t(x,y/2);
	a*=a;
	a%=mod;
	if(a<0)
		a+=mod;
	if(y%2)
		a*=x;
	a%=mod;
	if(a<0)
		a+=mod;
	return a;
}
int F(int x,int y){
	int a=fact[y]*fact[x-y];
	a%=mod;
	if(a<0)
		a+=mod;
	int b=t(a,mod-2);
	int c=b*fact[x];
	c%=mod;
	if(c<0)
		c+=mod;
	return c;
}
main(){
	cin>>n>>m>>g;
	fact[0]=1;
	for(int i=1;i<maxn;i++){
		fact[i]=fact[i-1]*i;
		fact[i]%=mod;
		if(fact[i]<0)
			fact[i]+=mod;
	}
	if(!m){
		if(n%2){
			if(g)
				cout<<0<<endl;
			else
				cout<<1<<endl;
		}
		else if(g)
			cout<<1<<endl;
		else
			cout<<0<<endl;
		return 0;
	}
	for(int i=n;i>=0;i-=2){
		ans+=F(m+i-1,i);
		ans%=mod;
		if(ans<0)
			ans+=mod;
		if(i==1&&m==1){
			ans++;
			ans%=mod;
		}
		if(i==0&&m==1){
			ans+=mod;
			ans--;
			ans%=mod;
		}
	}
	if(g==0)
		cout<<ans<<endl;
	else{
		ans=F(n+m,m)-ans;
		ans+=mod;
		ans%=mod;
		if(ans<0)
			ans+=mod;
		cout<<ans<<endl;
	}
	return 0;
}

#include <iostream>
#include <iomanip>
#include <fstream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstring>
#include <string>
#include <sstream>
#include <bitset>
#include <iterator>
#include <list>
#include <functional>

#define FR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,c,n) for(int (i)=(c);(i)<(n);(i)++)
#define REP(it,v,cont) for((cont)::iterator (it)=(v).begin();(it)!=(v).end();++(it))
#define CLR(a,c) memset((a),(c),sizeof (a))
#define ALL(v) (v).begin(),(v).end()
#define VCPRINT(v) for(int iii = 0;iii < (v).size();iii++) cout<<(v)[iii]<<" ";cout<<endl;
#define SETPRINT(v,cont) for((cont)::iterator iiit = (v).begin();iiit != (v).end();iiit++) cout<<*iiit<<" ";cout<<endl;

bool ascending (int i,int j) { return (i<j); }
bool descending (int i,int j) { return (i>j); }

typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
#define PII pair<int,int>
#define PLI pair<long long,int>
#define PULI pair<unsigned long long,int>
#define PIL pair<int,long long>
#define PSI pair<string,int>
#define PSS pair<string,string>

using namespace std;

ll mod = 1000*1000*1000+7;
const ll MAX = 3*100*1000;
ll fact[MAX];
void PreCalc()
{
	fact[0] = 1;
	fact[1] = 1;
	FOR(i,2,MAX)
		fact[i] = (fact[i-1]*i)%mod;
}
ll countFact(ll n, ll p)
{
	ll k=0;
	while (n>=p)
	{
		k+=n/p;
		n/=p;
	}
	return k;
}
ll powmod(ll a , ll b,ll m){

	ll x=a,p=1;
	while(b>0)
	{
		if(b%2)
			p=((p%m)*(x%m))%m;
		b/=2;
		x=((x%m)*(x%m))%m;
	}
	return p;
}
ll inverse(ll n,ll p)
{
	return powmod(n,p-2,p);
}

ll C(ll n,ll k,ll p)
{
	if (countFact(n, p) > countFact(k, p) + countFact(n-k, p))
		return 0;

	return (fact[n] *
			((inverse(fact[k], p) *
			inverse(fact[n-k], p)) % p)) % p;
}

ll f(ll n,ll m,ll i)
{
	if(n < 0 || m < 0) return 0;
	if(i <= 0) return 0;
	return C(n+m,n,mod);
}

ll MOD(ll a)
{
	while(a<0) a+=mod;
	return a%mod;
}
int main()
{
	PreCalc();
	int n,m,g;cin>>n>>m>>g;
	ll ret = 0;
	for(int i = 0;i < n+m+1;i+=2){
		ret += f(n-i,m-1,n+m-i-1);
		ret%=mod;
	}
	if(n % 2 == 1 && m == 1) ret++;
	if(n % 2 == 1 && m == 0) ret = 1;
	if(g==0) cout<<ret<<endl;
	else cout<<MOD(f(n,m,n+m)-ret)<<endl;
}

/**Bismillahir Rahmanir Rahim  *///{
#include <bits/stdc++.h>
using namespace std;
#define inf 1000000007
#define llinf 1000000000000000000LL
#define eps 0.000000001
#define im(_x, _mod) if (_x >= _mod) _x -= _mod; else if (_x<0) _x += _mod;
#define bug(args ...) cout << __LINE__ << ": ", err(new istringstream(string(#args)), args), cout << '\n'
inline void err(istringstream *iss) {}
template<typename T, typename ... Args> void err(istringstream *iss, const T &$val, const Args & ... args) {
    string $name; *iss >> $name; if ($name.back()==',') $name.pop_back();
    cout << $name << " = " << $val << "; ", err(iss, args ...);
}
using ll = long long; using ull = unsigned long long; using ld = long double;
int n, m, K, T, Q, cn;//}
#define mxn 200005

ll ans;

ll facMod[mxn], invfacMod[mxn], invMod[mxn];

void preFacModInvMod(int _n) {
    facMod[0] = invfacMod[0] = invMod[0] = facMod[1] = invfacMod[1] = invMod[1] = 1;
    for (int i = 2; i<=_n; i++) invMod[i] = inf-invMod[inf%i]*(inf/i)%inf;
    for (int i = 2; i<=_n; i++) facMod[i] = facMod[i-1]*i%inf, invfacMod[i] = invfacMod[i-1]*invMod[i]%inf;
}

int nCr(int _n, int r) { return (_n<0 || r<0 || r>_n) ? 0 : int(facMod[_n]*invfacMod[r]%inf*invfacMod[_n-r]%inf); }

int main() { cin.tie(NULL);

// to get 0, we either need only single 0, or 1+whatever or 0+next must be single 1 or 0+next must 0 ==> recursion.
    // this recursion can be counted without recursion, see below.
// to get 1, we either need only single 1, or a 0 and next must be 0 ==> this must be 0 has already been described.

    scanf("%d%d%d", &n, &m, &K);
    if (K==1) {
        if (n) n--;
        else return printf("%c\n", "01"[m==1]), 0;
    }

    if ((m==1 and !((n+m)&1)) or (!m and ((n+m)&1))) ans = 1;
    preFacModInvMod(n+m);
    for (int i = 1; i < n+m; i += 2) {
        ans += nCr(n+m-i, n-(i-1)); im(ans, inf)
    }
    printf("%lld\n", ans);

return 0; }

#include <cstdio>

int tab[200007];
long long silnie[200007];
const int mod = 1000000007;

long long binpow(long long a, int n) {
    long long ret = 1;
    while (n) {
        if (n % 2 == 1) {
            ret *= a;
            ret %= mod;
        }
        a *= a;
        a %= mod;
        n /= 2;
    }
    return ret;
}

long long dwumian(int n, int k) {
    return (((silnie[n] * binpow(silnie[k], mod - 2)) % mod) * binpow(silnie[n - k], mod - 2)) % mod;
}

int policz(int n) {
    int ter = tab[n - 1];
    for (int i = n - 2; i >= 0; i--) {
        if (ter == 0 && tab[i] == 0)
            ter = 1;
        else
            ter = 0;
    }
    return ter;
}

int main() {
    int zera, jedynki, wynik;
    scanf("%d%d%d", &zera, &jedynki, &wynik);
    if (zera == 0 || jedynki == 0) {
        for (int i = 0; i < jedynki; i++)
            tab[i] = (zera == 0);
        printf("%d", wynik == policz(zera == 0 ? jedynki : zera));
        return 0;
    }
    int N = zera + jedynki;
    silnie[0] = 1;
    for (int i = 1; i <= N; i++) {
        silnie[i] = silnie[i - 1] * i;
        silnie[i] %= mod;
    }
    long long wyn = 0;
    for (int i = 1; i < N; i++) {
        int pewno = i - 1;
        int zera_zostalo = zera - pewno;
        int jedynki_zostalo = jedynki - 1;
        int zostalo = N - i;
        if (zera_zostalo >= 0 && jedynki_zostalo >= 0 && zostalo == zera_zostalo + jedynki_zostalo && wynik == (pewno % 2)) {
            wyn += dwumian(zostalo, zera_zostalo);
            wyn %= mod;
        }
    }
    if (jedynki == 1 && N % 2 == wynik) {
        wyn++;
        wyn %= mod;
    }
    printf("%lld", wyn);
    return 0;
}

#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
#include<iomanip>
using namespace std;
const double eps(1e-8);
typedef long long lint;

const lint mod = 1000000007LL;

int n, m, g;
lint fac[200010];

void init()
{
    fac[0] = fac[1] = 1;
    for(int i = 2; i <= 200000; i++)
        fac[i] = fac[i - 1] * i % mod;
    return;
}

lint quick_pow(lint base, lint pow)
{
    lint ret = 1;
    while(pow)
    {
        if(pow & 1)
            ret = (ret * base) % mod;
        base = base * base % mod;
        pow >>= 1;
    }
    return ret;
}

lint C(int r, int k)//C[r][k]
{
    return fac[r]*quick_pow(fac[k]*fac[r - k] % mod, mod - 2LL) % mod;
}

int main()
{
    scanf("%d %d %d", &n, &m, &g);
    if(n == 0)
    {
        if(g == 0)
        {
            if(m == 1)
                printf("0\n");
            else
                printf("1\n");
        }
        else
        {
            if(m == 1)
                printf("1\n");
            else
                printf("0\n");
        }
        return 0;
    }
    if(m == 0)
    {
        if(g == 0)
        {
            if(n & 1)
                printf("1\n");
            else
                printf("0\n");
        }
        else
        {
            if(n & 1)
                printf("0\n");
            else
                printf("1\n");
        }
        return 0;
    }
    init();
    lint all = C(n + m, n);
    lint ans = 0;
    for(int t = 0; t <= n; t += 2)
        ans = (ans + C(n + m - 1 - t, m - 1)) % mod;
    if(m == 1 && (n & 1) == 0)
        ans = (ans - 1 + mod) % mod;
    if(m == 1 && (n & 1))
        ans = (ans + 1) % mod;
    if(g == 0)
        printf("%I64d\n", ans);
    else
        printf("%I64d\n", (all - ans + mod) % mod);
    return 0;
}

  //File Name: cf336D.cpp
  //Author: long
  //Mail: 736726758@qq.com
  //Created Time: 2016年02月17日 星期三 20时38分47秒

#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <algorithm>

#define LL long long

using namespace std;

const int MAXN = 1e5+5;
const int MOD = 1e9+7;

LL f[MAXN];
LL jie[MAXN << 1];

LL qp(LL x,LL y)
{
	LL res = 1LL;
	while(y){
		if(y & 1)
			res = res * x % MOD;
		x = x * x % MOD;
		y >>= 1;
	}
	return res;
}

LL comb(int x,int y)
{
	if(y < 0 || y > x)
		return 0;
	if(y == 0 || y == x)
		return 1;
	return jie[x] * qp(jie[y] * jie[x - y] % MOD,MOD  - 2) % MOD;
}

void init()
{
	jie[0] = 1;
	for(int i=1;i<MAXN * 2;i++){
		jie[i] = jie[i-1] * i % MOD;
	}
}

void solve(int n,int m,int g)
{
	if(m == 0){
		int num_0 = 0,num_1 = 0;
		if(n % 2)
			num_0 = 1;
		else
			num_1 = 1;
		printf("%d\n",g ? num_1:num_0);
		return ;
	}
	init();
	memset(f,0,sizeof f);
	f[0] = (m == 1 ? 1: 0);
	for(int i=0;i<n;i++){
		f[i+1] =((comb(i + m, i) - f[i] + MOD ) % MOD + MOD) % MOD;
	}
	LL ans = f[n];
	if(!g)
		ans = ((comb(n+m,n) - f[n] + MOD) % MOD + MOD) % MOD;
	printf("%d\n",(int)ans);
	return ;
}

int main()
{
	int n,m,g;
	while(~scanf("%d %d %d",&n,&m,&g)){
		solve(n,m,g);
	}
	return 0;
}

#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>

#define st first
#define nd second
#define mp make_pair
#define lli long long int
#define mod 1000000007LL
#define FP( ii,aa,bb ) for( int ii=aa;ii<=bb;ii++ )
#define FM( ii,aa,bb ) for( int ii=aa;ii>=bb;ii-- )

using namespace std;

int n,m,g;
lli fakt[300000]={1};

lli fe( lli m,lli n ){
  if( !n ) return 1;
  lli t = fe( m,n/2 );
  return n%2 ? t*t%mod*m%mod : t*t%mod;
}
lli comb( lli m,lli n ){
  if( m<n ) return 0;
  return fakt[m]*fe( fakt[m-n],mod-2 )%mod*fe( fakt[n],mod-2 )%mod;
}

lli f( lli n,lli m ){

  if( m+n==2 ) return n!=2 ? m==2 ? 1 : 2 : 0;

  if( n==1 and !m ) return 1;
  if( !n and m==1 ) return 0;

  lli sum=0;
  if( m ) sum += comb( n+m-1,n );
  if( n ) sum += (comb( n+m-1,m )-f( n-1,m )+2*mod)%mod;

  return sum%mod;

}

int main(){

  cin >> n >> m >> g;
  FP( i,1,n+m ) fakt[i] = i*fakt[i-1]%mod;

  if( !g ) cout << f( n,m ) << endl;
  else     cout << (comb( m+n,n )-f(n,m)+2*mod)%mod << endl;

}

#include<bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define tr(v, it) for(auto const& it: v)
#define ll long long
#define for_in(i, n) for(ll i = 0; i<n; i++)
#define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
ll MOD = 1e9+7;

ll power(ll a, ll n)
{
    ll result=1;
    while(n>0)
    {
        if(n%2 == 1) result = (result*a)%MOD;
        a = (a*a)%MOD;
        n/=2;
    }
    return result;
}

ll C(vector< ll > &f, vector< ll > &r, ll n, ll k)
{
    ll result = (f[n]*r[n-k])%MOD;
    result = (result*r[k])%MOD;
    return result;
}

int main()
{
    ios
    ll n, m, g;
    cin>>n>>m>>g;
    ll N = n+m;
    vector< ll > f(N+5, 0);
    vector< ll > r(N+5, 0);
    f[0] = 1;
    for_in(i, N+3) { f[i+1]=(f[i]*(i+1))%MOD;}

    for_in(i, N+3){r[i] = power(f[i], MOD-2);}

    if(m==0){
        cout<< (n%2 == 1-g);
        return 0;
    }

    ll res = 0;
    for(ll i=g;i<=n;i+=2)
    {
        if(i+1<N) res = (res + C(f, r, N-i-1, n-i))%MOD;
    }
    if(n%2 != g && m == 1)res++;
   cout<<res;
   return 0;
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
#include <queue>
#include <vector>
#include <string>
#include <cmath>
#define Mod (1000000007LL)
#define eps (1e-8)
#define Pi (acos(-1.0))
using namespace std;
long long ans;
long long Power(long long x,long long k)
{
    long long tmp=1;
    while(k)
    {
        if(k&1) tmp=tmp*x%Mod;
        x=x*x%Mod;
        k>>=1;
    }
    return tmp;
}
long long Inv(long long x)
{
    return Power(x,Mod-2LL);
}
int n,m,g,s;
long long f[200100];
long long C(int x,int y)
{
    //if(n>1)printf("(%d %d)=",x,y);
    if(x==0||x<y) {/*if(n>1) printf("0\n");*/return 0;}
    long long tmp;
    tmp=f[x]*Inv(f[y])%Mod;
    tmp=tmp*Inv(f[x-y])%Mod;
    //if(n>1)printf("%I64d\n",tmp);
    return tmp;
}
int main()
{
    f[0]=1;
    for(long long i=1;i<=200000LL;i++)
    f[i]=f[i-1]*i%Mod;
    while(~scanf("%d%d%d",&m,&n,&g))
    {
        ans=0;
        if(n==0)
        {
            ans=m%2;
        }
        else
        {
            s=n+m;
            for(int i=s-1;i>=n-1;i--)
            {
                if((s-i)%2)
                {
                    ans+=C(i,n)+C(i,n-1);
                    ans%=Mod;
                }
                else
                {
                    ans+=2LL*Mod-C(i,n)-C(i,n-1);
                    ans%=Mod;
                }
            }
        }
        if(g==0) printf("%I64d\n",ans);
        else
        {

            ans=C(n+m,n)+Mod-ans;
            ans%=Mod;
            printf("%I64d\n",ans);
        }
    }
    return 0;
}

#include "bits/stdc++.h"
#define MOD (1000000007)
using namespace std;
int fact[200001]={};
int invfact[200001]={};
int modExp(int val,int p)
{
	if(p==0)return 1;
	if(p==1)return val;
	long long int ans=modExp(val,p/2);
	ans=(ans*ans)%MOD;
	if(p%2)
		ans=(ans*val)%MOD;
	return ans;
}
int inv(int n)
{
	return modExp(n,MOD-2);
}
int nCr(int n,int r)
{
	//n!/(n-r)!(r)!
	long long int ans=fact[n];
	ans=(ans*invfact[r])%MOD;
	ans=(ans*invfact[n-r])%MOD;
	return ans;
}
int findZerosVal(int nZ)
{
	if(nZ==0)
		return 0;
	return (nZ%2==0);
}

int main()
{
	std::ios::sync_with_stdio(false);
	#ifndef ONLINE_JUDGE
		freopen("in.txt","r",stdin);
	#endif
	fact[0]=1;
	invfact[0]=1;
	for(long long int i=1;i<200001;i++)
	{
		fact[i]=(i*fact[i-1])%MOD;
		invfact[i]=inv(fact[i]);
	}
	int z,o,g;
	cin>>z>>o>>g;
	if(o==0)
	{
		int ans=findZerosVal(z);
		cout<<(ans==g);
	}
	else if(o==1)
	{
		if(z==0)
			cout<<(1==g);
		else
		{
			//z is no of zeros to the left
			int ans=0;
			int totalWays=nCr(z+o,z);
			ans+=findZerosVal(z)==0;
			z--;
			while(z>=0)
			{
				int curVal=findZerosVal(z+1);
				ans+=(curVal==0);
				z--;
			}
			if(g==0)
				cout<<ans;
			else
			{
				ans=totalWays-ans;
				if(ans<0)
					ans+=MOD;
				cout<<ans;
			}
		}

	}
	else
	{
		int totalWays=nCr(z+o,z);
		long long int ans=(findZerosVal(z+1)==0);
		int remZeros=0;
		while(z>0)
		{
			z--;
			remZeros++;
			int ways=nCr(remZeros+o-1,remZeros);
			if(findZerosVal(z+1)==0)
			{
				ans=(ans+ways)%MOD;
			}
		}
		if(g==0)
			cout<<ans;
		else
		{
			ans=(totalWays-ans);
			if(ans<0)
				ans+=MOD;
			cout<<ans;
		}
	}
}

#include<stdio.h>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include <time.h>
using namespace std;
long long int mod=1e9+7;

long long int a[200200],inv[200200],c[200200];
long long int q0=0,q1=0;

long long int qwe(int n,int k){
	if(k<0||n<k||n<0)
		return 0;
	long long int ans=1;
	ans=c[n];
	ans=(ans*a[k])%mod;
	ans=(ans*a[n-k])%mod;
	return ans;
}

void check(int n,int m,bool f){
	if(m==0){
		if(f)
			q0++;
		else
			q1++;
	} else {
		if(m%2==1)
			if(f)
				q0++;
			else
				q1++;
		else
			if(f)
				q1++;
			else
				q0++;
	}
}

void solve(int m,int n,int k) {
	int i,j,x,y,z=0,lc,lv,tw,th;
	inv[1]=1;
	a[0]=1;
	a[1]=1;
	c[1]=1;
	c[0]=1;
	for(i=2;i<=200000;i++){
		inv[i]=(mod*mod-(mod/i)*inv[mod%i])%mod;
		a[i]=(a[i-1]*inv[i])%mod;
		c[i]=(c[i-1]*i)%mod;
	}
	q0=0,q1=0;

	for(i=0;i<1e6&&m>=0;i++){
		if(n>0&&m+m>1){
			q0=(q0+qwe(n+m-1,n-1))%mod;
			m--;
			if(n>0&&m+n>1){
				q1=(q1+qwe(n+m-1,n-1))%mod;
				m--;
			} else if(n==1){
				check(n,m,true);
				i=1e6;
			} else {
				check(n,m,true);
				i=1e6;
			}
		} else if(n==1){
			q1++;
				i=1e6;
		} else {
			check(n,m,true);
			i=1e6;
		}
	}

	if(k==0)
		printf("%I64d\n",q0%mod);
	else
		printf("%I64d\n",q1%mod);
}

int main() {
#pragma comment(linker,"/STACK:268435456")
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
#ifdef ONLINE_JUDGE
	//freopen("reading.in","r",stdin);
	//freopen("reading.out","w",stdout);
#endif
	int n,m,k;
	while(scanf("%d%d%d",&n,&m,&k)!=EOF)//{
		//while(gets(c))//{
			solve(n,m,k);
	//}
	return 0;
}

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstddef>
#include <complex>
#include <ctime>
#include <climits>

#include <algorithm>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <string>
#include <numeric>
#include <functional>
#include <iterator>
#include <typeinfo>
#include <utility>
#include <memory>

#include <cassert>

#if __cplusplus >= 201103L
#include <tuple>
#include <ratio>
#include <array>
#include <forward_list>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;

typedef long long int64;
const int inf = 2000000000;
static inline int Rint()
{
	struct X{ int dig[256]; X(){
	for(int i = '0'; i <= '9'; ++i) dig[i] = 1; dig['-'] = 1;
	}};
	static 	X fuck;int s = 1, v = 0, c;
	for (;!fuck.dig[c = getchar()];);
	if (c == '-') s = 0; else if (fuck.dig[c]) v = c ^ 48;
	for (;fuck.dig[c = getchar()]; v = v * 10 + (c ^ 48));
	return s ? v : -v;
}
typedef vector<int> vi;
typedef map<int, int> mii;
typedef set<int> si;

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define rep(i, s, e) for (int i = (s); i < (e); ++i)

#if __cplusplus >= 201103L
#define foreach(iter, c) for(auto& iter : c)
#else
#define foreach(itr, c) for(__typeof((c).begin()) itr = (c).begin(); itr != (c).end(); ++itr)
#endif

template<typename T> static inline void cmax(T& a, const T& b){if(b>a)a=b;}
template<typename T> static inline void cmin(T& a, const T& b){if(b<a)a=b;}
#define SL static inline

#define dbg(x) cerr << (#x) << " = " << (x) << endl

const int maxn = 100005;
const int64 mod = 1000000007;

int64 invof(int64 x)
{
	int64 n = mod - 2;
	int64 ret = 1;
	for (; n; n >>= 1)
	{
		if (n & 1) ret = ret * x % mod;
		x = x * x % mod;
	}
	return ret;
}
int main()
{
	const int zero = Rint(), one = Rint(), g = Rint();
	int64 c0 = 0, c1 = 0;

	if (one == 0)
	{
		if (zero % 2 == 0)
		{
			++c1;
		}
		else
		{
			++c0;
		}
		if (g == 0) cout << c0 << endl;
		else cout << c1 << endl;
		return 0;
	}

	if (one == 1)
	{
		for (int i = zero; i >= 1; --i)
		{
			if (i % 2 == 0)
			{
				++c1;
			}
			else
			{
				++c0;
			}
		}
		if (zero % 2 == 0)
		{
			++c1;
		}
		else
		{
			++c0;
		}
		if (g == 0) cout << c0 << endl;
		else cout << c1 << endl;
		return 0;
	}

	int64 prev = 1;
	int64 a = one - 1, b = one - 1;
	for (int i = zero + 1; i >= 1; --i)
	{
		if (i % 2 == 0)
		{
			c1 += prev;
			if (c1 >= mod) c1 -= mod;
		}
		else
		{
			c0 += prev;
			if (c0 >= mod) c0 -= mod;
		}
		++a;
		prev = prev * a % mod;
		prev = prev * invof(a - b) % mod;
	}

	if (g == 0) cout << c0 << endl;
		else cout << c1 << endl;
	return 0;
}

#include <functional>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <cassert>
#include <bitset>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>

using namespace std;

const int INF = 1000 * 1000 * 1000;

#define DEBUG(x) cout << #x << " = " << x << endl;
#define ALL(v) v.begin(), v.end()
#define SZ(v) (int) v.size()

#define TASK ""

const int MOD = INF + 7;
const int XD = 100100;

int facts[XD << 1];

void calcFacts(int n) {
    facts[0] = 1;
    for (int i = 1; i <= n; ++i) {
        facts[i] = 1LL * facts[i - 1] * i % MOD;
    }
}

int exgcd(int a, int b, int &x, int &y) {
    if (a == 0) {
        x = 0;
        y = 1;
        return b;
    }
    int xx, yy;
    int d = exgcd(b % a, a, xx, yy);
    x = yy - b / a * xx;
    y = xx;
    return d;
}

int getInv(int n) {
    int x, y;
    exgcd(n, MOD, x, y);
    x = (x % MOD + MOD) % MOD;
    return x;
}

int cnk(int n, int k) {
    return 1LL * facts[n] * getInv(facts[n - k]) % MOD * getInv(facts[k]) % MOD;
}

int main() {
    #ifdef EDDY
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #else
    //  freopen(TASK ".in", "r", stdin);
    //  freopen(TASK ".out", "w", stdout);
    #endif

    int zeroes, ones, sm;

    cin >> zeroes >> ones >> sm;

    if (zeroes == 0) {
        if (sm == 1) {
            cout << ((ones == 1) ? 1 : 0);
        } else {
            cout << ((ones == 1) ? 0 : 1);
        }
        return 0;
    }

    if (ones == 0) {
        if (sm == 1) {
            cout << ((zeroes & 1) ? 0 : 1);
        } else {
            cout << ((zeroes & 1) ? 1 : 0);
        }
        return 0;
    }

    calcFacts(zeroes + ones);

    int res = 0;

    for (int pos = 0; pos <= zeroes; ++pos) {
        if (sm == 0 && (pos % 2 == 0 && (pos < zeroes || pos == zeroes && ones > 1) || pos % 2 == 1 && (pos == zeroes && ones == 1))) {
            res += cnk(zeroes + ones - pos - 1, ones - 1);
            res %= MOD;
        }
        if (sm == 1 && (pos % 2 == 1 && (pos < zeroes || pos == zeroes && ones > 1) || pos % 2 == 0 && (pos == zeroes && ones == 1))) {
            res += cnk(zeroes + ones - pos - 1, ones - 1);
            res %= MOD;
        }
    }

    cout << res;

    return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int p=1e9+7;
int n,m,g;
long long inv[100005];
long long c[100005];//C(i,i+m-1);

long long dfs(int x,int y,int u){
	long long tot=0;
	if(x+y==2){
		if(x==2 && u==1)return 1;
		else if(x==1 && y==1 && u==0)return 2;
		else if(y==2 && u==0)return 1;
		else return 0;
	}
	if(x==0)return u^1;
	else if(y==0)return ((x&1)^u);
	else if(u==1)tot=(tot+dfs(x-1,y,0))%p;
	else{
		tot=(tot+c[x])%p;
		tot=(tot+dfs(x-1,y,1))%p;
	}
	return tot%p;
}

int main(){
	scanf("%d%d%d",&n,&m,&g);
	if(n+m==1){
		if((n==1 && g==0) || (m==1 && g==1))printf("1");
		else printf("0");
		return 0;
	}
	inv[1]=1;
	for(int i=2;i<=n;i++)inv[i]=1LL*(p-p/i)*inv[p%i]%p;
	c[0]=1;
	for(int i=1;i<=n;i++){
		c[i]=(1LL*c[i-1]*(i+m-1)%p*inv[i])%p;
	}
	printf("%lld",dfs(n,m,g));
}

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<vector>
#include<algorithm>
using namespace std;

#define maxm 300100
#define mod 1000000007
#define ii __int64

int n,m,g;
ii dp[maxm][4];
ii cal(int rem,int fl,int n,int m);

struct node{
    ii x,y,g;
    node(){};
    node(ii xx,ii yy,ii gg){ x=xx; y=yy; g=gg;};
};

ii norm[maxm],inv[maxm],invr[maxm];

node euclid(ii a,ii b){

    if(!b) return node(1,0,a);
    node r=euclid(b,a%b);
    return node(r.y,r.x-(a/b)*r.y,r.g);
}

ii mod_inv(ii a,ii n){

    node t=euclid(a,n);
    if(t.g>1) return 0;
    ii ret=t.x%n;
    ret= ret<0 ? ret+n:ret;
    return ret;

}

void gen(int n){

    int i,j,k,l;

    norm[0]=1;
    inv[0]=1;

    for(i=1;i<=n;i++){
        norm[i]=(i*norm[i-1])%mod;
        //inv[i]=mod_inv(norm[i],mod);
    }

}

int main(){

    int i,j,k,l,test,t=1;

    //freopen("in.txt","r",stdin);

    gen(maxm-100);

    while(scanf("%d %d %d",&n,&m,&g)==3){

        //memset(dp,-1,sizeof(dp));
        printf("%I64d\n",cal(n+m,g,n,m));

    }

    return 0;
}

ii cal(int rem,int fl,int n,int m){

    ii ret=0;

    if(fl==2){
        ret=norm[n+m];
        ret*=mod_inv(norm[n],mod);
        ret%=mod;
        ret*=mod_inv(norm[m],mod);
        ret%=mod;
        return ret;
    }
    if(n<0|| m<0) return 0;
    if(rem==1){
        //if(fl==2) return 1;
        if(fl==0) if(n) return 1;
        if(fl==1) if(m) return 1;
        return 0;
    }

    if(fl==0){
        ret+=cal(rem-1,1,n-1,m);
        ret+=cal(rem-1,2,n,m-1);
    }
    else if(fl==1){
        ret+=cal(rem-1,0,n-1,m);
    }
    ret%=mod;
    return ret;
}

#include<cstdio>
#include<cstring>
const int MOD = 1000000007;
const int N = 200007;
typedef __int64 ll;
ll inv[N],fct[N];
ll f(ll x,ll k)
{
    ll y=1;
    while(k)
    {
        if(k%2)y=y*x%MOD;
        x=x*x%MOD;
        k>>=1;
    }
    return y;
}
ll f0(int n,int m)
{
    if(n==-1&&m==1)return 1;
    if(n==0)
    {
        if(m<=1)return 0;
        return 1;
    }
    if(m==0)
    {
        if(n==1)return 1;
        if(n<=0)return 0;
        return f0(n-2,m);
    }
    if(n<0)return 0;
    return (fct[n+m-1]*inv[m-1]%MOD*inv[n]%MOD+f0(n-2,m))%MOD;
}
int main()
{
    int i,n,m,g;
    fct[0]=1;
    inv[0]=1;
    for(i=1;i<N;i++)
    {
        fct[i]=fct[i-1]*i%MOD;
        inv[i]=f(fct[i],MOD-2);
    }
    scanf("%d%d%d",&n,&m,&g);
    ll ret;
    if(g==0)ret=f0(n,m);
    else ret=f0(n-1,m);
    printf("%I64d\n",ret);
    return 0;
}

#include <algorithm>
#include <iostream>
#include <cstring>
#include <climits>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define R register
#define LL long long
#define U unsigned
#define FOR(i,a,b) for(R int i = a;i <= b;++i)
#define RFOR(i,a,b) for(R int i = a;i >= b;--i)
#define SFOR(i,a,b,x) for(R int i = a;i <= b;i += x)
#define CLR(i,a) memset(i,a,sizeof(i))
#define BR printf("--------------------\n")
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl

namespace fastIO{
    #define BUF_SIZE 100000
    #define OUT_SIZE 100000
    #define ll long long
    bool IOerror=0;
    inline char nc(){
        static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+BUF_SIZE;
        if (p1==pend){
            p1=buf; pend=buf+fread(buf,1,BUF_SIZE,stdin);
            if (pend==p1){IOerror=1;return -1;}
        }
        return *p1++;
    }
    inline bool blank(char ch){return ch==' '||ch=='\n'||ch=='\r'||ch=='\t';}
    inline void read(int &x){
        bool sign=0; char ch=nc(); x=0;
        for (;blank(ch);ch=nc());
        if (IOerror)return;
        if (ch=='-')sign=1,ch=nc();
        for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';
        if (sign)x=-x;
    }
    inline void read(ll &x){
        bool sign=0; char ch=nc(); x=0;
        for (;blank(ch);ch=nc());
        if (IOerror)return;
        if (ch=='-')sign=1,ch=nc();
        for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';
        if (sign)x=-x;
    }
    #undef ll
    #undef OUT_SIZE
    #undef BUF_SIZE
};
using namespace fastIO;

const int ha = 1e9+7;
int N,M,G;
const int MAXN = 200000 + 5;
LL mul[MAXN],inv[MAXN];

inline void init(){
    mul[0] = mul[1] = 1;
    FOR(i,2,N+M){
        mul[i] = (mul[i-1]*i)%ha;
    }
    inv[1] = 1;
    FOR(i,2,N+M){
        inv[i]= ha - (LL)(ha/i)*inv[ha%i]%ha;
    }
    inv[0] = 1;
    FOR(i,1,N+M) inv[i] = (inv[i-1]*inv[i])%ha;
}

inline LL C(int u,int d){
    return ((mul[u]*inv[d])%ha*inv[u-d])%ha;
}

int main(){
    read(N);read(M);read(G);
    init();
    if(!N){
        if((M == 1 && G) || (M > 1 && !G)) puts("1");
        else puts("0");
        return 0;
    }
    if(!M){
        if((N&1 && !G) || (!(N&1) && G)) puts("1");
        else puts("0");
        return 0;
    }
    LL ans = 0;
    SFOR(i,1,N,2){
        if(N-i+M-1) ans = (ans + C(N+M-i-1,M-1)%ha)%ha;
    }
    if(!(N%2) && M == 1) ans++;
    if(!G) ans = (C(N+M,M)-ans+ha)%ha;
    printf("%lld\n",ans%ha);
    return 0;
}

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#define MOD 1000000007
#define int long long
using namespace std;
const int N = 500000;
int n, m, g, inv[N + 5], fac[N + 5], invf[N + 5];
inline void prework() {
	inv[0] = inv[1] = fac[1] = invf[1] = fac[0] = invf[0] = 1;
	for(int i = 2; i <= N; i++) fac[i] = (fac[i - 1] * i) % MOD;
	for(int i = 2; i <= N; i++) inv[i] = (MOD - MOD / i) * inv[MOD % i] % MOD;
	for(int i = 2; i <= N; i++) invf[i] = invf[i - 1] * inv[i] % MOD;
}
inline int C(int a, int b) {
	return fac[a] * invf[b] % MOD * invf[a - b] % MOD;
}
signed main() {
	prework();
	scanf("%lld%lld%lld", &n, &m, &g);
	if(n == 0) {
		if(m == 1 && g == 1 || m > 1 && g == 0)
			printf("1\n");
		else printf("0\n");
		return 0;
	}
	if(m == 0) {
		printf("%d\n", ( (n % 2) ^ 1 ) == g );
		return 0;
	}
	int ans = 0;
	if(m == 1 && n % 2 == 0) ans = 1;
	for(int i = 1; i <= n; i += 2) {
		int num0, num1;
		num0 = n - i, num1 = m - 1;
		if(num1 + num0)
		    ans = (ans + C(num1 + num0, num0)) % MOD;
	}
	if(g == 1) printf("%lld\n", ans);
	else printf("%lld\n", (C(n + m, m) - ans + MOD) % MOD);
	return 0;
}

#include <bits/stdc++.h>

using namespace std;
//FILE *fi=freopen("1.txt","r",stdin);
int n,m,G;
const long long Mod = 1e9 + 7;
long long g[300001];
long long ig[300001];
long long power(long long x,int n)
{
    if(!n)
        return 1;
    if(n&1)
        return x*power(x*x%Mod,n/2) % Mod;
    return power(x*x%Mod,n/2);
}
long long nck(int n,int k)
{
    if(n<0 || n<k)
        return 0;
    return g[n] * ig[k] % Mod * ig[n-k] % Mod;
}
long long Calc(long long a,long long b,int g)
{
    if(!b && !a)
        return 0;
    if(!a)
    {

        if(b==1)
            return g;
        return !g;
    }
    if(!b)
    {
        if(a&1)
            return !g;
        else
            return g;
    }
    long long ans = 0;
    ans += Calc(a-1,b,0);
    if(!g)
        ans = nck(a+b,a) - ans;
    ans += Mod*Mod;
    ans%=Mod;
    return ans;
}
int main()
{
    cin>>n>>m>>G;
    g[0] = 1;
    int N = 2e5;
    for(int i=1;i<=N;i++)
    {
        g[i] = g[i-1]  * i  %Mod;
    }
    ig[N] = power(g[N],Mod-2);
    for(int i=N-1;i>=0;i--)
    {
        ig[i] = ig[i+1] * (i+1) %Mod;
    }
    cout<<Calc(n,m,G);
    return 0;
}

#include<complex>
#include<cstdio>
using namespace std;
const int mod=1e9+7;
const int N=2e5+7;
int n,m,g,ans;
int fac[N],fdiv[N],num[N];
void Init()
{
	fac[0]=fdiv[0]=num[0]=num[1]=1;
	for(int i=1;i<=n+m;i++)
		fac[i]=1ll*fac[i-1]*i%mod;
	for(int i=2;i<=n+m;i++)
		num[i]=1ll*(mod-mod/i)*num[mod%i]%mod;
	for(int i=1;i<=n+m;i++)
		fdiv[i]=1ll*fdiv[i-1]*num[i]%mod;
}
int C(int n,int m)
{
	return 1ll*fac[n]*fdiv[m]%mod*fdiv[n-m]%mod;
}
int main()
{
	scanf("%d%d%d",&n,&m,&g);
	if(!n)
	{
		if((m==1 && g) || (m>1 && g==0))puts("1");
		else puts("0");
		return 0;
	}
	if(!m)
	{
		if((n%2 && g==0) || (n%2==0 && g))puts("1");
		else puts("0");
		return 0;
	}
	Init();
	for(int i=1;i<=n;i+=2)
		if(n-i+m-1)ans=(ans+C(n-i+m-1,m-1))%mod;
	if(n%2==0 && m==1)ans++;
	if(!g)ans=(C(n+m,m)-ans+mod)%mod;
	printf("%d\n",ans);
	return 0;
}

#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
#include<iomanip>
using namespace std;
const double eps(1e-8);
typedef long long lint;

const lint mod = 1000000007LL;

int n, m, g;
lint fac[200010];

void init()
{
    fac[0] = fac[1] = 1;
    for(int i = 2; i <= 200000; i++)
        fac[i] = fac[i - 1] * i % mod;
    return;
}

lint quick_pow(lint base, lint pow)
{
    lint ret = 1;
    while(pow)
    {
        if(pow & 1)
            ret = (ret * base) % mod;
        base = base * base % mod;
        pow >>= 1;
    }
    return ret;
}

lint C(int r, int k)//C[r][k]
{
    return fac[r]*quick_pow(fac[k]*fac[r - k] % mod, mod - 2LL) % mod;
}

int main()
{
    scanf("%d %d %d", &n, &m, &g);
    if(n == 0)
    {
        if(g == 0)
        {
            if(m == 1)
                printf("0\n");
            else
                printf("1\n");
        }
        else
        {
            if(m == 1)
                printf("1\n");
            else
                printf("0\n");
        }
        return 0;
    }
    if(m == 0)
    {
        if(g == 0)
        {
            if(n & 1)
                printf("1\n");
            else
                printf("0\n");
        }
        else
        {
            if(n & 1)
                printf("0\n");
            else
                printf("1\n");
        }
        return 0;
    }
    init();
    lint all = C(n + m, n);
    lint ans = 0;
    for(int t = 0; t <= n; t += 2)//末尾的0的个数, 然后放一个1
        ans = (ans + C(n + m - 1 - t, m - 1)) % mod;
    if(m == 1 && (n & 1) == 0)//只有一个1, 偶数个0的时候1不能放在所有0的后面, 之前一种排列不能算
        ans = (ans - 1 + mod) % mod;
    if(m == 1 && (n & 1))//只有一个1, 奇数个0的时候1还可以放在最前面(末尾奇数个0), 要多加上一种选择
        ans = (ans + 1) % mod;
    if(g == 0)
        printf("%I64d\n", ans);
    else
        printf("%I64d\n", (all - ans + mod) % mod);
    return 0;
}

# include <ctime>
# include <cmath>
# include <queue>
# include <cstdio>
# include <cstdlib>
# include <cstring>
# include <algorithm>
# include <iostream>
# define LL long long
# define N 200000
inline int Read()
{
    register int x = 0;char ch = getchar();

    while(ch < '0' || ch > '9')ch = getchar();

    while(ch >= '0' && ch <= '9'){x = x*10+(ch^48);ch = getchar();}

    return x;
}

const LL mod = 1000000007;

LL qpow(LL x,int p = mod-2)
{
    LL res = 1;
    for(; p ; p>>=1,x = (x*x)%mod) if(p&1) res = res*x%mod;
    return res;
}

LL fac[N+5],inv[N+5],ans;

LL Cn(const LL n,const LL m){return fac[n] * inv[n-m] % mod * inv[m] % mod;}

int n,m,g;

int main()
{
    scanf("%d%d%d",&n,&m,&g);
    fac[0] = 1;
    for(int i = 1; i <= n+m ; ++i) fac[i] = fac[i-1]*i%mod;
    inv[n+m] = qpow(fac[n+m]);
    for(int i = n+m-1; i >= 0 ; --i) inv[i] = inv[i+1]*(i+1)%mod;
    if(n == 0) return printf("%d\n",m == 1 ? g : g^1),0;
    if(m == 0) return printf("%d\n",n & 1 ? g^1 : g),0;
    for(int i = 0; i <= n ; i += 2) ans = (ans + Cn(n+m-1-i,m-1))%mod;
    m == 1 && (ans = ((n&1) ? (ans + 1) % mod : (ans - 1 + mod) % mod));
    if(g) ans = (Cn(n+m,n)-ans+mod)%mod;
    printf("%lld\n",ans);
    return 0;
}

#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
#include <ctime>
#include <list>
using namespace std;

const int MAXN = 200000 + 10, mod = 1e9+7;
typedef long long ll;

ll fa[MAXN];

ll fpow(ll a, ll b)
{
    if(!b)
        return 1;
    if(b == 1)
        return a%mod;
    ll ans = fpow((a*a)%mod, b/2);
    if(b & 1)
        ans = (ans*a)%mod;
    return ans;
}

ll cnk(int n, int k)
{
    ll ans = (fa[n]*fpow(fa[k], mod-2))%mod;
    ans = (ans*fpow(fa[n-k], mod-2))%mod;
    return ans;
}

int main()
{
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
#else
    //freopen("input.txt", "r", stdin);
    //freopen("peacefulsets.in", "r", stdin);
    //freopen("peacefulsets.out", "w", stdout);
#endif

    fa[0] = 1;
    for(int i = 1;i<MAXN;i++)
        fa[i] = (fa[i-1]*i)%mod;

    int n0, n1, s;
    cin>>n0>>n1>>s;
    if(s == 1)
        n0--;

    if(n0 == -1)
    {
        cout<<(n1 == 1 ? 1 : 0)<<endl;
        return 0;
    }

    ll ans = 0;
    for(int i=0;i<=n0&&i<n0+n1-1;i+=2)
        ans = (ans + cnk(n0+n1-i-1, n0-i))%mod;

    if(n0 && !n1 && n0%2 == 1)
        ans = (ans + 1)%mod;
    if(n1 == 1 && (n0+n1)%2 == 0)
        ans = (ans + 1)%mod;
    cout<<ans<<endl;
    return 0;
}

#include<iostream>

using namespace std;

typedef long long ll;
const int N = 200005;
const ll MOD = 1000000007ll;

ll fac[N];

ll Powmod(ll a,ll m)
{
    ll ret=1%MOD;
    for(;m;m>>=1)
    {
        if(m & 1) ret=ret*a%MOD;
        a=a*a%MOD;
    }
    return ret;
}
ll C(int n,int m)
{
    if(n<m) return 0ll;
    return fac[n]*Powmod(fac[m],MOD-2)%MOD*Powmod(fac[n-m],MOD-2)%MOD;
}
int main()
{
    ll n,m,g;
    fac[0]=1;
    for(int i=1;i<=200000;i++) fac[i]=fac[i-1]*i%MOD;
    cin>>n>>m>>g;
    if(m==0)
    {
        if(n%2==1 && g==0) cout<<1<<endl;
        else if(n%2==0 && g==1) cout<<1<<endl;
        else cout<<0<<endl;
        return 0;
    }
    ll ans=0;
    if(m==1)
    {
        for(int i=1;i<=n;i++)
        {
            if(i%2==0 && g==1) ans+=C(n+m-i,m-1);
            else if(i%2==1 && g==0) ans+=C(n+m-i,m-1);
            ans%=MOD;
        }
        if((n+1)%2==0 && g==0) ans++;
        else if((n+1)%2==1 && g==1) ans++;
    }
    else
    for(int i=1;i<=n+1;i++)
    {
        if(i%2==0 && g==1) ans+=C(n+m-i,m-1);
        else if(i%2==1 && g==0) ans+=C(n+m-i,m-1);
        ans%=MOD;
    }
    ans%=MOD;
    cout<<ans<<endl;
    return 0;
}

//#pragma comment(linker, "/STACK:10000")

#include <stdlib.h>
#include <stdio.h>
#include <algorithm>
#include <iostream>

#include <hash_map>
#include <map>
#include <hash_set>
#include <set>

using namespace std;

int n, m, g;

long long v[100000 + 10][2];
long long mod = (long long)1e9 + 7;

long long powmod(long long a, long long n) {
	long long ans = 1;
	while (n > 0) {
		if (n & 1) ans = (ans * a) % mod;
		a = (a * a) % mod;
		n >>= 1;
	}
	return ans;
}

int main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	cin >> n >> m >> g;

	if (n + m == 1) {
		if (g == 0) {
			cout << n;
		} else {//g == 1
			cout << m;
		}
		return 0;
	}

	if (n == 0 || m == 0) {

		if (n == 0) {
			if (g == 0) {
				cout << 1;
			} else {// g == 1
				cout << 0;
			}
		} else { // m == 0
			if (g == 0) {
				if (n & 1) {
					cout << 1;
				} else {
					cout << 0;
				}
			} else {//g == 1
				if (n & 1) {
					cout << 0;
				} else {
					cout << 1;
				}
			}
		}

		return 0;
	}

	if (m == 1) {
		v[0][0] = 0;
		v[0][1] = 1;
	} else {
		v[0][0] = 1;
		v[0][1] = 0;
	}

	long long cnk = 1;

	for (int i = 1; i <= n; ++i) {
		v[i][1] = v[i - 1][0];
		v[i][0] = v[i - 1][1];
		cnk = (cnk * (m + i - 1)) % mod;
		cnk = (cnk * powmod(i, mod - 2)) % mod;
		v[i][0] = (v[i][0] + cnk) % mod;
	}

	cout << v[n][g];

	return 0;

}

#pragma comment(linker, "/STACK:64000000")
#define _CRT_SECURE_NO_DEPRECATE
#define _USE_MATH_DEFINES

#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <cstring>
#include <ctime>
#include <cmath>
#include <iomanip>
#include <complex>
#include <utility>
#include <vector>
#include <deque>
#include <bitset>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>

#define forn(i, n) for(int i = 0; i < int(n); i++)
#define forl(i, n) for(int i = 1; i <= int(n); i++)
#define ford(i, n) for(int i = int(n) - 1; i >= 0; i--)
#define fore(i, l, r) for(int i = int(l); i <= int(r); i++)
#define correct(x, y, n, m) (0 <= (x) && (x) < (n) && 0 <= (y) && (y) < (m))
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))
#define pb(a) push_back(a)
#define ft first
#define sc second
#define x first
#define y second

using namespace std;

template<typename X> inline X abs(const X& a) { return a < 0? -a: a; }
template<typename X> inline X sqr(const X& a) { return a * a; }

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;

const int INF = INT_MAX / 2;
const ld EPS = ld(1e-9);
const ld PI = ld(3.1415926535897932384626433832795);
const int N = 2e5+100;
int n,m,g;
const int mod = 1e9 + 7;
li fact[N];
li inv[N];
li ans0=0;
li ans1=0;

void printans()
{
    if(g==0)
        cout<<ans0<<endl;
    else
        cout<<ans1<<endl;
    return;
}

li bp(li a,li n)
{
    if(n==0)
        return 1LL;
    if(n%2)
        return (bp(a,n-1)*a)%mod;
    li b=bp(a,n/2);
    return (b*b)%mod;
}

inline bool solve()
{
    cin>>n>>m>>g;
    fact[0]=1;
    for(int i=1;i<N;i++)
    {
        fact[i]=fact[i-1]*i;
        fact[i]%=mod;
    }
    for(int i=0;i<N;i++)
        inv[i]=bp(fact[i],mod-2);
    if(m==0)
    {
        if(n%2==0)
            ans1=1;
        else
            ans0=1;
        printans();
        return false;
    }
    if(n==0)
    {
        if(m==1)
            ans1=1;
        else
                ans0=1;
        printans();
        return false;
    }
    for(int i=0;i<=n;i++)
    {

        int ost0=n-i;
        int ost1=m-1;
        if(ost0==0 && ost1==0)
        {
            if(n%2==0)
                ans1+=1;
            else
                ans0+=1;
            continue;
        }
        if(i%2==0)
        {
            ans0+=(((fact[ost0+ost1]*inv[ost0])%mod)*inv[ost1])%mod;
            ans0%=mod;
        }
        //cerr<<ans0<<endl;
        else
        {
            ans1+=(((fact[ost0+ost1]*inv[ost0])%mod)*inv[ost1])%mod;
            ans1%=mod;
        }
        //cerr<<ans0<<' '<<ans1<<endl;
    }
    //ans1+=(((fact[n+m]*inv[n])%mod)*inv[m])%mod;
    //ans1%=mod;
    //ans1-=ans0;
    //ans1=(ans1+mod)%mod;
    printans();
    return false;
}

int main()
{
   // freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);

    solve();

    return 0;
}

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

#define llong long long
#define xx first
#define yy second
#define len(x) ((int)x.size())
#define rep(i,n) for (int i = -1; ++ i < n; )
#define rep1(i,n) for (int i = 0; i ++ < n; )
#define all(x) x.begin(), x.end()

#define maxn 301010
#define rem ((llong)1e9+7)

llong mpow(llong b, llong ex) {
  llong ans = 1;
  for (; ex > 0; ex >>= 1) {
    if (ex & 1) (ans *= b) %= rem;
    (b *= b) %= rem;
  }
  return ans;
}

llong fac[maxn], rfac[maxn];
llong comb(int n, int k) {
  return fac[n] * rfac[k] % rem * rfac[n - k] % rem;
}

int g;
int n, m;

vector<vector<llong>> dp;

int main(void) {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    fac[0] = rfac[0] = 1;
    rep1(i, maxn - 1) {
      fac[i] = (fac[i - 1] * i) % rem;
      rfac[i] = mpow(fac[i], rem - 2);
    }

    cin >> m >> n >> g;
    if (g == 1) {
      if (m == 0) {
        cout << (n == 1);
        exit(0);
      }
      --m;
      g = 0;
    }

    dp.resize(max(n + 1, 4));
    dp[0].resize(m + 1);
    dp[1].resize(m + 1);
    dp[2].resize(m + 1);
    for (int i = 3; i < len(dp); ++i) dp[i].resize(min(3, m + 1));

    // formulas times!!!
    rep1(i, m) dp[0][i] = i & 1;
    dp[1][0] = 0;
    rep1(i, m) dp[1][i] = (i + 1) / 2 + (i & 1);

    for (int i = 2; i < len(dp); ++i) {
      dp[i][0] = 1;
      dp[i][1] = i;
      for (int f = 2; f < len(dp[i]); ++f) {
        if (i == 2) dp[i][f] = (dp[i][f - 1] + dp[i - 1][f - 1] + dp[i - 2][f]) % rem;
        else dp[i][f] = (dp[i - 1][f] + dp[i][f - 1]) % rem;
      }
    }

    if (m < len(dp[n])) {
      cout << dp[n][m] << '\n';
      exit(0);
    }

    llong ans = 0;
    for (int f = 3; f <= m; ++f) {
      llong times = comb(n + m - f - 2 - 1, n - 3);
      // clog << 2 << ' ' << f << ' ' << times << ' ' << dp[2][f] << endl;
      (ans += times * dp[2][f]) %= rem;
    }

    for (int i = 3; i <= n; ++i) {
      llong times = comb(n + m - i - 3, m - 3);
      // clog << i << ' ' << 2 << ' ' << times << ' ' << dp[i][2] << endl;
      (ans += times * dp[i][2]) %= rem;
    }
    cout << ans;

    return 0;
}

#include<iostream>

using namespace std;

const int MAXN = 2e5 + 5;
const long long mod = 1e9 + 7;

long long fastPow(long long x, long long p)
{
    long long ans = 1, curr = x;

    while(p!=0)
    {
        if(p%2!=0)
        {
            ans = (ans*curr)%mod;
        }

        p/=2;
        curr = (curr*curr)%mod;
    }

    return ans;
}

long long inv(long long x)
{
    return fastPow(x, mod-2);
}

long long fact[MAXN], invFact[MAXN];
void Init()
{
    fact[0] = invFact[0] = 1;
    for(int i = 1;i<MAXN;i++)
    {
        fact[i] = (fact[i-1]*i)%mod;
        invFact[i] = (invFact[i-1]*inv(i))%mod;
    }
}

long long getShuffles(int n, int m)
{
    long long ans = fact[n+m];
    ans = (ans*invFact[n])%mod;
    ans = (ans*invFact[m])%mod;

    return ans;
}

long long solve(int n, int m, int g)
{
    long long ans = 0;

    if(n+m==1)
    {
        if(g==0) return n;
        else if(g==1) return m;
    }
    if(n==0 && m==0) return 1;

    if(g==0)
    {
        //0
        if(n>0) ans += solve(n-1, m, 1);

        //1
        if(m>0) ans += getShuffles(n, m-1);
    }
    else
    {
        //0
        if(n>0) ans += solve(n-1, m, 0);
    }

    return ans%mod;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    Init();

    int n, m, g;
    cin >> n >> m >> g;

    cout << solve(n, m, g) << '\n';
}

#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef long double ldb;

const lld mod = 1e9+7;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){
		cerr << name << " : " << arg1 << std::endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
	}
#else
#define trace(...)
#endif
int iter = 0;
lld powmod(lld base, lld exp){
    lld ans = 1;
    while(exp){
        if(exp&1ll) ans = (ans*base)%mod;
        exp >>= 1;
        base = (base*base)%mod;
    }
    // if(iter++ < 10) trace(ans);
    return ans;
}

lld fac[200010], ifac[200010];

lld c(lld n, lld r){
    // trace(n, r);
    if(r > n) return 0;
    lld num = fac[n];
    lld den = (ifac[r] * ifac[n-r]) % mod;
    // trace(num, den, ifac[r], ifac[n-r]);
    return (num * den) % mod;
}

main(){
    lld n, m, k;
    cin >> n >> m >> k;
    if(m == 0){
        if(n%2 != k) cout << 1 << endl;
        else cout << 0 << endl;
        return 0;
    }
    else if(n == 0){
        if(m == 1 and k == 1) cout << 1 << endl;
        else if(m != 1 and k == 0) cout << 1 << endl;
        else cout << 0 << endl;
        return 0;
    }
    fac[0] = ifac[0] = 1;
    for(lld i = 1; i <= 200000; ++i){
        fac[i] = (fac[i-1]*i)%mod;
        ifac[i] = powmod(fac[i], mod-2);
    }
    lld ans = 0;
    for(int i = 0; i < n+m-1; ++i){
        if(i%2 == k){
            // trace(i,c(n+m-i-1,m-1));
            ans = (ans + c(n+m-i-1,m-1))%mod;
        }
    }
    if((n+m-1)%2 != k and m == 1){
        ans++;
    }
    ans %= mod;
    cout << ans << endl;
}

#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;
LL MOD = 1000000007;
const int MAX_SIZE = 2 * 100000 + 5;
LL fact[MAX_SIZE];
LL bin_pow(LL a, LL p)
{
    if (p == 0) return 1;
    if (p % 2 == 0)
    {
        LL tmp = bin_pow(a, p >> 1) % MOD;
        return tmp * tmp % MOD;
    }
    else
    {
        return a * bin_pow(a, p - 1) % MOD;
    }
}

LL inv(LL n)
{
    return bin_pow(n, MOD - 2);
}

LL C(LL n, LL k)
{
    if (n <= 0) return 0;
    if (k < 0) return 0;
    if (k == 0) return 1;
    return fact[n] * inv(fact[k] * fact[n - k] % MOD) % MOD;
}

LL rec(int g, int n, int m)
{
    if (m == 0)
    {
        if (n == 1 && g == 0) return 1;
        if (n == 2)
        {
            if (g == 0) return 0; else return 1;
        }
    }
    if (n < 0) return 0;
    if (n == 0)
    {
        if (g == 1)
        {
            if (m == 1) return 1; else
            return 0;
        }
        else
        {
            if (m == 1) return 0; else return 1;
        }
    }
    if (g == 0)
    {
        return (C(n + m - 1, m - 1) + rec(1, n - 1, m)) % MOD;
    }
    else
    {
        return (C(n + m - 2, m - 1) + rec(1, n - 2, m)) % MOD;
    }
}

int main()
{
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int n, m, g;
    cin>>n>>m>>g;
    fact[0] = 1;
    for (int i = 1; i < MAX_SIZE; ++i)
    {
        fact[i] = fact[i - 1] * i % MOD;
    }

    cout<<rec(g, n, m);

    return 0;
}

#include <stdio.h>
const int M = 1000000007;
const int maxn = 200001;
int t[maxn << 2];
int a[maxn];
int p[maxn];
int n, up, down1, down2;
int A, B;
int binpow(int a, int n){
    int r = 1;
    while(n){
        if(n % 2) r = (1ll * r * a) % M;
        n /= 2;
        a = (1ll * a * a) % M;
    }
    return r;
}
void erotosfen(){
    for(int i = 2; i <= n; i ++){
        if(!p[i]){
            p[i] = i;
            if(1ll * i * i <= n){
                for(int j = i * i; j <= n; j += i){
                    if(!p[j]) p[j] = i;
                }
            }
        }
    }
}
void fillones(){
    for(int i = (maxn << 2) - 1; i; i --) t[i] = 1;
}
void update(int v, int l, int r, int id){
    if(l == r){
        t[v] = binpow(l, a[l]);
        return ;
    }
    int m = (l + r) / 2;
    if(id > m) update(v * 2 + 1, m + 1, r, id);
    else update(v * 2, l, m, id);
    t[v] = (1ll * t[v * 2 + 1] * t[v * 2]) % M;
}
void add(int N, int k){
    int P, c;
    while(N > 1){
        P = p[N];
        c = 0;
        while(p[N] == P){
            N /= P;
            c ++;
        }

        a[P] += k * c;
        update(1, 1, n, P);
    }
}
void solve(int N, int k){
    while(up > N){
        add(up, -1);
        add(up - k, 1);
        up --;
    }
}
int main(){
    int g, res = 0;
    scanf("%d %d %d",&A,&B,&g);
    if(B == 0){
        if(g == 0) puts(A % 2 ? "1" : "0");
        else puts(A % 2 ? "0" : "1");
        return 0;
    }
    if(A == 0){
        if(g == 1) puts(B == 1 ? "1" : "0");
        else puts(B == 1 ? "0" : "1");
        return 0;
    }
    up = n = A + B;
    erotosfen();
    fillones();

    for(int i = 2; i <= B - 1; i ++) add(i, -1);
    for(int i = 2; i <= n; i ++) add(i, 1);
    for(int i = 2; i <= n - (B - 1); i ++) add(i, -1);

    while(A){
        if(g == 1 && A == 1){
            g = 0;
            res = (res + (B == 1 ? 0 : 1)) % M;
            break;
        }
        A --;
        if(g == 1){
            g = 0;
        }else{
            solve(A + B, B - 1);
            res = (res + t[1]) % M;
            g = 1;
        }

    }
    if(g == 1 && B < 2) res = (res + 1) % M;
    printf("%d",res);
}

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

    #define db double
    #define ll long long
    #define ld long double
    #define li long int
    #define pb push_back
    #define mp make_pair
    #define FOR(i,a,b) for(i=a;i<b;i++)
    #define RFOR(i,a,b) for(i=a;i>b;i--)
    #define f first
    #define s second
    #define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
    #define pl pair<ll,ll>
    #define pll pair<pl,ll>
    #define plll pair<ll,pll>
    #define all(a) a.begin(),a.end()
    #define nl cout<<endl
    #define inf LONG_LONG_MAX
    #define minf LONG_LONG_MIN
    #define pq priority_queue
    #define pi 3.1415926535897932

    bool isPrime(ll n)
    {
            if (n <= 1)  return false;
            if (n <= 3)  return true;

            if (n%2 == 0 || n%3 == 0)
                return false;

            for (ll i=5; i*i<=n; i=i+6)
            {
                if (n%i == 0 || n%(i+2) == 0)
                   return false;
            }
            return true;
    }
    ll gcd(ll a,ll b)
    {
        if(a==0)    return b;
        if(a<b) swap(a,b);
        return gcd(a%b,b);
    }
    ll gcdextended(ll a,ll b,ll &x,ll &y)
    {
        if(a==0)
        {
            x=0;
            y=1;
            return b;
        }
        ll x1,y1,gcd=gcdextended(b%a,a,x1,y1);
        x=y1-(b/a)*x1;
        y=x1;
        return gcd;
    }
    ll modinverse(ll a,ll m)
    {
        ll x,y;
        ll g=gcdextended(a,m,x,y);
        if(g!=1)
        {
            cout<<"NOT POSSIBLE";
            return -1;
        }
        else
            return (x%m+m)%m;
    }
    ll po(ll x,ll y)
    {
        ll res = 1;
        while (y > 0)
        {
            if (y & 1)
                res = (res*x);
            y = y>>1;
            x = (x*x);
        }
        return res;
    }
    ll pom(ll x,ll y,ll p)
    {
        ll res=1;
        x=x%p;
        while(y>0)
        {
            if(y&1)
                res=(res*x)%p;
            y= y>>1;
            x=(x*x)%p;
        }
        return res;
    }
    ll root(ll x,vector<ll> &id)
    {
        while(id[x]!=x)
        {
            id[x]=id[id[x]];
            x=id[x];
        }
        return x;
    }
    void uni(ll x,ll y,vector<ll> &id)
    {
        ll a=root(x,id);
        ll b=root(y,id);
        id[a]=id[b];
    }
    bool sec(const pl &a,const pl &b)
    {
        if(a.s==b.s)    return a.f<b.f;
        return a.s<b.s;
    }
    const ll N=2e5+5,mm=1e9+7;
    void solve()
    {
        ll n,m,g,i,an=0;
        cin>>n>>m>>g;
        if(n+m==1)
        {
            if(n==1 && g==0)    cout<<1;
            else if(m==1 && g==1)    cout<<1;
            else    cout<<0;
            return;
        }
        ll f[N],inv[N];
        f[0]=1;
        FOR(i,1,N)  f[i]=(f[i-1]*i)%mm;
        inv[N-1]=pom(f[N-1],mm-2,mm);
        RFOR(i,N-2,-1)  inv[i]=(inv[i+1]*(i+1))%mm;
        if(g==0)    i=1;
        else    i=2;
        while(n+m-i>=m-1 && n+m-i>0 && m-1>=0)
        {
            an=(an+(((f[n+m-i]*inv[n-i+1])%mm)*inv[m-1])%mm)%mm;
            i+=2;
        }
        if(g==0 && n&1==1 && m<=1)  an=(an+1)%mm;
        if(g==1 && n%2==0 && m<=1)  an=(an+1)%mm;
        cout<<an;
    }
    int main()
    {
        fast;
        ll t;
        t=1;
        //cin>>t;
        while(t--)
        {
            solve();
        }
    }

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

typedef long long ll;

#define sqr(x) (x)*(x)

const ll mod=1000000007;

const int maxn=300005;

ll ksm(ll a,ll k)
{
    ll r=1;
    while(k>0)
    {
        if(k&1) r=r*a%mod;
        a=a*a%mod;
        k>>=1;
    }
    return r;
}

ll jc[maxn]={1},jci[maxn]={1};

ll comb(int n,int m)
{
    return jc[n]*jci[m]%mod*jci[n-m]%mod;
}

ll cal(int n,int m,int g)
{
    if(n+m==1) return g==m;
    if(g==1)
    {
        if(n==0) return 0;
        return cal(n-1,m,0);
    }
    else
    {
        return (comb(n+m,n)+mod-cal(n,m,1))%mod;
    }
}

int n,m,g;

int main()
{
    int i,j;
    scanf("%d %d %d",&n,&m,&g);
    for(i=1;i<maxn;i++) jc[i]=jc[i-1]*i%mod,jci[i]=ksm(jc[i],mod-2);
    printf("%I64d\n",cal(n,m,g));
    return 0;
}

#include <bits/stdc++.h>
#define int long long
using namespace std;
long long fact[1000005];
void f(int n)
{
    fact[0] = 1;
    for(int i = 1; i <= n; i ++)
    {
        fact[i] = (1LL * fact[i - 1] * 1LL * i) % 1000000007;
        fact[i] %= 1000000007;
    }
}

int invmod(int n, int k)
{
    if(k == 0)
        return 1;
    if((k & 1) == 0)
    {
        long long rez = invmod(n, (k >> 1));
        return (1LL * rez * rez) % 1000000007;
    }
    return (invmod(n, k - 1) * n) % 1000000007;
}

int combinari(int n, int k)
{
    long long fk = fact[k];
    long long fn = fact[n];
    long long fnk = fact[n - k];
    long long total = 1LL * fk * fnk;
    total = total % 1000000007;
    return (fn * invmod(total, 1000000005)) % 1000000007;
}
int32_t main()
{
    int n, m, k;
    cin >> n >> m >> k;
    if(m == 0)
    {
        if(n % 2 != k)
            cout << "1";
        else
            cout << "0";
        return 0;
    }
    if(n == 0)
    {
        if(m > 1)
        {
            if(k == 0)
                cout << "1";
            else
                cout << "0";
        }
        else
        {
            if(k == 1)
                cout << "1";
            else
                cout << "0";
        }
        return 0;
    }
    f(300005);
    long long s = 0;
    for(int i = 0; i <= n; i ++)
    {
        if(n + m - i - 1 > 0)
        {
            if(i % 2 == k)
            {
                s += combinari(n + m - i - 1, m - 1);
                s = s % 1000000007;
            }
        }
        else
        {
            if(i % 2 != k)
            {
                s += combinari(n + m - i - 1, m - 1);
                s = s % 1000000007;
            }
        }
    }
    cout << s;
    return 0;
}
//hellobig_tq//hello

#include <cstdio>
#pragma comment(linker, "/STACK:16000000")
using namespace std;

typedef long long ll;

const int mod = 1000000007;
const int Maxn = 200005;

int fact[Maxn], inv[Maxn];
int n, m, g;
int res;

int Inv(int a)
{
	int p = mod - 2;
	int res = 1;
	while (p) {
		if (p & 1) res = ll(res) * ll(a) % ll(mod);
		p >>= 1; a = ll(a) * ll(a) % ll(mod);
	}
	return res;
}

void getOne(int n, int m);

void getNil(int n, int m)
{
	if (n == 1 && m == 0) res = (res + 1) % mod;
	if (m >= 1 && n + m > 1) res = (res + ll(fact[n + m - 1]) * ll(inv[n]) % ll(mod) * ll(inv[m - 1]) % ll(mod)) % mod;
	if (n >= 1 && n + m > 1) getOne(n - 1, m);
}

void getOne(int n, int m)
{
	if (n == 0 && m == 1) res = (res + 1) % mod;
	if (n >= 1 && n + m > 1) getNil(n - 1, m);
}

int main()
{
	fact[0] = 1; inv[0] = 1;
	for (int i = 1; i < Maxn; i++) {
		fact[i] = ll(fact[i - 1]) * ll(i) % ll(mod);
		inv[i] = Inv(fact[i]);
	}
	scanf("%d %d %d", &n, &m, &g);
	if (g == 0) getNil(n, m);
	else getOne(n, m);
	printf("%d\n", res);
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl
ll n,m,g;
ll f[200005];
ll fi[200005];
ll powmod(ll a,ll b)
{
	ll an=1;
	while(b)
	{
		if(b&1)
		{
			an=(an*a)%MOD;
		}
		b>>=1;
		a=(a*a)%MOD;
	}
	return an;
}
ll khichdi(ll n,ll m)
{
	if(n<0||m<0||n+m==0)return 0;
	ll an=f[(n+m)];
	an=(an*fi[n])%MOD;
	an=(an*fi[m])%MOD;
	return an;
}
ll get1(ll n,ll m)
{
	if(m<0)return 0;
	if(n==0&&m==2)return 1;
	if(m==0&&n==1)return 1;
	return (khichdi(n-1,m-1)+get1(n,m-2))%MOD;
}
ll get0(ll n,ll m)
{
	if(m==1&&n==0)return 1;
	return (khichdi(n-1,m)+get1(n,m-1))%MOD;
}
int main()
{
	SPEED;
	f[0]=fi[0]=1;
	for(int i=1;i<=200000;i++)
	{
		f[i]=(f[i-1]*i)%MOD;
		fi[i]=powmod(f[i],MOD-2);
	}
	cin>>m>>n>>g;
	if(g)
		cout<<get1(n,m)<<endl;
	else
		cout<<get0(n,m)<<endl;
	return 0;
}

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define foru(i,l,r) for(int i=l;i<r;i++)
#define ford(i,l,r) for(int i-l;i>r;i--)
#define re return
#define pb push_back
#define ll long long

const int maxN=2e5+10;
const int base=1e9+7;

int gt[maxN];
int n,m,t;

void init(int n) {
    gt[0]=1;
    foru(i,1,n+1) gt[i]=(1ll*gt[i-1]*i)%base;
}

int lt(int x,int y) {
    if (y==0) re 1;
    if (y==1) re x;
    int tam=lt(x,y/2);
    if (y%2==0)
        re (1ll*tam*tam)%base;
    else
        re ((1ll*tam*tam)%base *x)%base;
}

int cal(int n,int k) {
    ll tam=gt[n];
    tam=(tam*lt(gt[k],base-2))%base;
    tam=(tam*lt(gt[n-k],base-2))%base;
//    printf("%i %i %I64d\n",n,k,tam);
    re tam;
}

int main() {
//    freopen("input.inp","r",stdin);
    cin>>n>>m>>t;
    init(n+m);
    int ans=0;
    if (n==0) {
        if (m==1) ans=(t==1); else
        if (t==0) ans=(m>0); else ans=(m==0);
    } else if (m==1) {
        if (t==0) {
            foru(i,1,n+1) if (i%2==1) ans++;
        } else {
            foru(i,1,n+1) if (i%2==0) ans++;
        }
        if (n%2!=t) ++ans;
    } else if (m==0) {
        if (n%2==t) ans=0; else ans=1;
    } else if (t==0) {
        foru(i,1,n+2) if (i%2==1) ans=(ans+cal(n+m-i,m-1))%base;
        if (m==1 && n%2==1) ans=(ans+1)%base;
        if (m==0 && n%2==1) ++ans;
    } else {
        foru(i,1,n+2) if (i%2==0 && m-1>0) ans=(ans+cal(n+m-i,m-1))%base;
        if (m==0 && n%2==0) ++ans;
    }
    cout<<ans;
    fclose(stdin);
    re 0;
}

#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007ll
using namespace std;
ll fact[200005];
ll bigmod(ll b, ll p)
{
    if(!p)return 1ll;
    ll ret= bigmod(b, p>>1);
    ret= (ret*ret)%mod;
    if(p&1ll)ret= (ret*b)%mod;
    return ret;
}
ll func(int n, int m)
{
    ll nume= fact[n+m];
    ll deno= (fact[n]*fact[m])%mod;
    deno= bigmod(deno, mod-2);
    return (nume*deno)%mod;
}
ll rec(int n, int m, bool f)
{
    if((n+m)==1)
    {
        if(n)return (f==0);
        else return (f==1);
    }
    ll ret= 0;
    if(f)
    {
        if(n)ret= rec(n-1, m, 0);
    }
    else
    {
        if(m)ret= func(n, m-1);
        if(n)ret= (ret+rec(n-1, m, 1))%mod;
    }
    return ret;
}
int main()
{
    fact[0]= 1ll;
    for(ll i=1; i<=200000; i++)
    fact[i]= (fact[i-1]*i)%mod;
    int n, m, g;
    scanf("%d %d %d", &n, &m, &g);
    printf("%lld\n", rec(n, m, g));
    return 0;
}
//hello

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

typedef long long ll;

const int MOD = 1e9 + 7;
const int MAXN = 2e5 + 10;

ll fact[MAXN + 10], ans;

ll power(ll a, ll b){
    if (b == 1)
        return a % MOD;
    ll ans = power(a, b/2);
    ans = (ans * ans) % MOD;
    if (b & 1)
        ans = ans * a % MOD;
    return ans;
}

ll C(ll n, ll k){
    if (k > n || k < 0)
        return 0;
    return fact[n] * (power(fact[k] * fact[n-k] % MOD, MOD - 2)) % MOD;
}

int main(){
    int n, m, g; cin >> n >> m >> g;

    fact[0] = 1;
    for (int i = 1; i <= MAXN; i++)
        fact[i] = fact[i-1] * i % MOD;

    if (n == 0 && g == 1){
        if (m == 1)
            return cout << "1\n" ,0;
        return cout << "0\n", 0;
    }
    if (g == 1)
        n--;

    for (int i = 0; i< n + m; i += 2){
        if (i < n + m-1 && m>=1 && n>=i)
            ans = (ans + C(n + m-i-1, m-1)) % MOD;
        if (n >= i + 1){
            if (i == n + m-2 && m >= 1)
                ans++;
            if (i == n + m-1)
                ans++;
        }
    }

    return cout << ans << '\n' , 0;

}

//2017-7-18 22:10
//2017-7-18 22:21
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
typedef long long LL;
const int MaxN = 2e5;
const int pt = 1e9 + 7;

LL p[MaxN + 5], np[MaxN + 5];

LL qwe(LL x, LL y){
	LL ans = 1;
	while(y != 0){
		if(y & 1) ans = ans * x % pt;
		y >>= 1;
		x = x * x % pt;
	}
	return ans;
}

int cal(int n, int m, bool ty){
	int ret = 0;
	if(n < 0 || m < 0) return 0;
	if(ty && n == 0 && m != 0) return 0;
	if(n == 0 && m == 0) return 1;
	for(int i= 0; 2 * i <= n; i++){
		int j = n - 2 * i, k = m - j;
		if(j < 0 || k < 0) continue;
		 ret=(ret+p[i+j]*np[i]%pt*np[j]%pt*p[i+j+k-ty]%pt*np[k]%pt*np[i+j-ty]%pt)%pt;
	}
	return ret;
}
int main(){
	int n, m, g, ans;
	p[0] = 1, np[0] = 1;
	for(int i = 1; i <= MaxN; i++){
		p[i] = p[i - 1] * i % pt;
		np[i] = qwe(p[i], pt - 2);
	}
	while(~scanf("%d %d %d", &n, &m, &g)){
		ans = 0;
		n--;
		if(g == 1) n--;
		ans = cal(n, m, 0) + cal(n + 2, m - 1, 1);
		printf("%d\n", ans % pt);
	}
	return 0;
}

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int MOD = (int)1e9 + 7;

//---------------------------------------------------------------
template<int MOD> struct ModInt { long long x;
    explicit operator bool() const { return !!x; }
    ModInt(int v = 0) : x(v % MOD) { if (x < 0) x += MOD; }
    ModInt(long long v) : x(v % MOD) { if (x < 0) x += MOD; }
    ModInt &operator+=(const ModInt &r) { if ((x += r.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator-=(const ModInt &r) { if ((x += MOD - r.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator*=(const ModInt &r) { x = x * r.x % MOD; return *this; }
    ModInt &operator/=(const ModInt &r) { return *this *= r.inv(); }
    ModInt operator-() const { return x ? ModInt(MOD - x) : ModInt(x); }
    ModInt operator+(const ModInt &r) const { return ModInt(*this) += r; }
    ModInt operator-(const ModInt &r) const { return ModInt(*this) -= r; }
    ModInt operator*(const ModInt &r) const { return ModInt(*this) *= r; }
    ModInt operator/(const ModInt &r) const { return ModInt(*this) /= r; }
    ModInt inv() const { long long a = x, b = MOD, u = 1, v = 0;
        while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); }
        return ModInt(u); } // (*this).pow(MOD - 2);
    ModInt pow(long long k) const { ModInt r(1), a(x);
        while (k) { if (k & 1) r *= a; a *= a; k >>= 1; } return r; }
    bool operator==(const ModInt r) const { return x == r.x; }
    bool operator!=(const ModInt r) const { return x != r.x; }
    bool operator< (const ModInt r) const { return x <  r.x; }
    friend ostream& operator<<(ostream &os, const ModInt<MOD>& a) { return os << a.x; }
    friend istream& operator>>(istream &is, ModInt<MOD>& a) { return is >> a.x; }
};
template<typename T, int SZ> struct Comb { vector<T> _fac, _ifac, _inv;
    Comb() : _fac(SZ + 1), _ifac(SZ + 1), _inv(SZ + 1) {
        _fac[0] = _ifac[SZ] = _inv[0] = 1;
        for (int i = 1; i <= SZ; i++) _fac[i] = _fac[i - 1] * i;
        _ifac[SZ] /= _fac[SZ];
        for (int i = SZ - 1; i >= 0; i--) _ifac[i] = _ifac[i + 1] * (i + 1);
        for (int i = 1; i <= SZ; i++) _inv[i] = _ifac[i] * _fac[i - 1]; }
    T inv(int n) { return n < 0 ? T(0) : _inv[n]; }
    T fac(int n) { return n < 0 ? T(0) : _fac[n]; }
    T ifac(int n) { return n < 0 ? T(0) : _ifac[n]; }
    T P(int a, int b) { return (b < 0 || a < b) ? T(0) : _fac[a] * _ifac[a - b]; }
    T C(int a, int b) { return b < 0 ? T(0) : P(a, b) * _ifac[b]; }
    T H(int n, int k) { if (n < 0 || k < 0) return T(0);
        return k == 0 ? T(1) : C(n + k - 1, k); }
    T S(int n, int k) { T r = 0;
        for (int i = 0; i <= k; i++) {
            T t = C(k, i) * T(i).pow(n); r += ((k - i) & 1 ? -t : t);
        }
        return r * _ifac[k];
    }
    T B(int n, int k) {
        if (n == 0) return T(1);
        T r = 0; k = min(k, n);
        vector<T> dp(k + 1); dp[0] = T(1);
        for (int i = 1; i <= k; i++) dp[i] = dp[i - 1] + (i & 1 ? -_ifac[i] : _ifac[i]);
        for (int i = 1; i <= k; i++) r += T(i).pow(n) * _ifac[i] * dp[k - i];
        return r;
    }
};
typedef ModInt<MOD> mint;
//---------------------------------------------------------------
Comb<mint, 250000> com;

int main() {
    int zero, one, g; cin >> zero >> one >> g;
    if (one == 0) return !(cout << (zero % 2 != g) << endl);
    mint ans = 0;
    for (int i = 0; i <= zero; i++) {
        int tot = (zero - i) + (one - 1);
        if (tot) {
            if (i % 2 == g) ans += com.C(tot, one - 1);
        } else {
            if (i % 2 != g) ans += com.C(tot, one - 1);
        }
    }
    cout << ans << endl;
    return 0;
}

#include<iostream>
#include<vector>
#include<fstream>
#include<queue>
#include<algorithm>
#include<list>
#include<cstdio>
#include<stack>
#include<cstring>
#include<cmath>
#include<string>
#include <functional>
#include<sstream>
#include<map>
using namespace std;
#define     For(i,a,b)        for (int i=a; i<b; i++)
#define     Rep(i,a)          for (int i=0; i<a; i++)
#define     FIT(it,v)         for (typeof((v).begin())it=(v).begin(); it!=(v).end(); ++it)
#define     ALL(v)            (v).begin(),(v).end()
#define     Set(a,x)          memset((a),(x),sizeof(a))
#define     EXIST(a,b)        find(ALL(a),(b))!=(a).end()
#define     Sort(x)           sort(ALL(x))
#define     GSORT(x)          sort(ALL(x), greater<typeof(*((x).begin()))>())
#define     UNIQUE(v)         Sort(v); (v).resize(unique(ALL(v)) - (v).begin())
#define     MP                make_pair
#define     SF                scanf
#define     PF                printf
#define     MAXN               200001
#define     MAXM               1001
#define     MOD               1000000007
#define     Dbug             cout<<"";
#define     hsh              2654435761 // %1<<x (x=60)
#define     EPS              1e-15
typedef long long ll;
typedef pair<int,int> pii;
ll pw(ll a, ll b)
{
    ll ret=1;
    while (b)
    {
        if(b&1) ret=(ret*a)%MOD;
        a=(a*a)%MOD;
        b/=2;
    }
    return ret;
}
ll fact[MAXN];
ll rec(int n, int m, int g)
{
    if(n+m==1)
    {
        if((g==0 && n==1) || (g==1 && m==1)) return 1;
        return 0;
    }
    if(g) if(n) return rec(n-1, m, 0);
    if(!g)
    {
        ll ret=0;
        if(m) ret=(((fact[n+m-1]*pw(fact[n], MOD-2))%MOD)*pw(fact[m-1], MOD-2))%MOD;
        if(n) ret=(ret+rec(n-1, m, 1))%MOD;
        return ret;
    }
    return 0;
}
int main(){
    //ios_base::sync_with_stdio(false);
    //freopen("a.in","r",stdin);
    int n, m, g;
    fact[0]=1;
    For(i, 1, MAXN) fact[i]=(fact[i-1]*i)%MOD;
    cin>>n>>m>>g;
    cout<<rec(n, m, g);
    return 0;
}

#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
typedef long long ll;

const int mod = 1000000007;
const int N = 200005;
ll C[N];
ll QMod(ll a, ll b) {
    ll r = 1, base = a;
    while (b) {
        if (b & 1)
            r = r * base % mod;
        base = base * base % mod;
        b >>= 1;
    }
    return r;
}
int cal(int a, int b) {
	if(b == 0) return 0;

	return C[b] * QMod((C[b-a] * C[a]) % mod, (ll)mod-2) % mod;
}

int main() {
	C[0] = 1;
	for(int i = 1; i < N; i ++) {
		C[i] = (C[i-1] * i) % mod;
	}
	int n, m, p;
	scanf("%d%d%d", &n, &m, &p);
	ll ans = 0;
	if(p == 0) {
		if(m >= 1) {
			if(m == 1 && (n & 1)) ans ++;
			for(int i = 0; i <= n; i += 2) {
				ans += cal(m-1, n + m - 1 - i);
				ans %= mod;
			}
		} else {
			if(n & 1) {
				ans ++;
			}
		}
	} else {
		if(m >= 1) {
			if(m == 1 && (n & 1) == 0) ans ++;
			for(int i = 1; i <= n; i += 2) {
				ans += cal(m-1, n + m - 1 - i);
				ans %= mod;
			}
		} else {
			if((n & 1) == 0) {
				ans ++;
			}
		}
	}
	printf("%I64d\n", ans % mod);
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define forn(i, x, n) for(int i = int(x); i <= int(n); ++i)
#define for1(i, n, x) for(int i = int(n); i >= int(x); --i)
#define file ""
#define pb push_back
#define F first
#define S second
#define _bits __builtin_popcount

typedef long long ll;
typedef pair <int, int> PII;
typedef double ld;

const int N = 2e6;
const int INF = 1e9 + 9;
const int B = 1e9 + 7;

void relax(ll &a, const ll &b) {
	a = (a + b % B) % B;
}

ll pwr(ll a, ll b) {
	ll res = 1;
	while (b) {
		if (b & 1) res = (res * a) % B;
		a = (a * a) % B, b >>= 1;
	}
	return res;
}

ll fact[N], rfact[N], pwr2[N];

ll Cnk(ll n, ll k) {
	if (k < 0 || n < k) return 0;
	return ((fact[n] * rfact[k]) % B * rfact[n - k]) % B;
}

int d(int n, int m, int g) {
	if (n + m == 1) {
		int f = (n ? 0 : 1);
		return f == g;
	}
	if (g == 1)
		return n ? d(n - 1, m, 0) : 0;
	else
		return ((n ? d(n - 1, m, 1) : 0) + Cnk(n + m - 1, n)) % B;
}

int n, m, g;

int main() {
#ifdef machine42
	freopen(file"in", "r", stdin);
	freopen(file"out", "w", stdout);
#endif
    ios_base :: sync_with_stdio(0);
    cin.tie(0);

    fact[0] = 1, rfact[0] = 1;
    forn(i, 1, 2e5) {
    	fact[i] = (fact[i - 1] * i) % B;
    	rfact[i] = pwr(fact[i], B - 2);
    }

	cin >> n >> m >> g;  /*
	if (g == 1) {
		if (n == 0) {
			cout << "0\n";
			return 0;
		}
		--n;
	}                  */
	ll ans = d(n, m, g);
	//forn(i, 0, n)
	//	relax(ans, Cnk(n - i + m - 1, m - 1));
	cout << ans << "\n";

	return 0;
}

#include<algorithm>
#include<cstring>
#include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;

const int N=1e5+15;
const ll mod=1e9+7;
ll n,m,g;
ll f[N],fac[N<<1];
/*ll mul(ll a,ll b)
{
	ll re=0;
	for (;b;b>>=1,a=(a<<1)%mod) if (b&1) re=(re+a)%mod;
	return re;
}*/
ll qpow(ll a,ll b)
{
	ll re=1;
	for (;b;b>>=1,a=a*a%mod) if (b&1) re=re*a%mod;
	return re;
}
ll C(ll a,ll b)
{
	b=min(b,a-b);
	if (!b) return 1;
	return fac[a]*qpow(fac[b],mod-2)%mod*qpow(fac[a-b],mod-2)%mod;
}
int main()
{
	scanf("%lld%lld%lld",&n,&m,&g);
	if(!n)
    {
        if(g==0)
        {
            if(m==1) cout<<"0";
            else cout<<"1";
        }
        else
        {
            if(m==1) cout<<"1";
            else cout<<"0";
        }
        return 0;
    }
	if (!m)
	{
		if(g==0)
        {
            if(n&1) cout<<"1";
            else cout<<"0";
        }
        else
        {
            if(n&1) cout<<"0";
            else cout<<"1";
        }
		return 0;
	}
	fac[0]=fac[1]=1;
	for (int i=2;i<=n+m;i++) fac[i]=fac[i-1]*i%mod;
	//printf("%d\n",C(3,2));
	if (m==1) f[0]=1;
	else if (m>1) f[0]=0;
	for (int i=1;i<=n;i++)
	{
		f[i]=(C(i-1+m,m)-f[i-1]+mod)%mod;
		//printf("%d %d %d %d\n",i,f[i],i-1+m,m);
	}
	if (g==1) printf("%I64d\n",f[n]);
	else printf("%I64d\n",(C(n+m,m)+mod-f[n])%mod);
	return 0;
}

#include <bits/stdc++.h>
#define MAXN 200005
using namespace std;
typedef long long ll;

const ll MOD =1e9+7;
ll fakt[MAXN];

ll brzos(ll x,ll a){
    if(a==0)return 1;
    if(a%2==0)return (brzos((x*x)%MOD,a/2))%MOD;
    return (x*brzos((x*x)%MOD,a/2))%MOD;
}
ll binomni(ll a,ll b){
    if(a==b || b==0)return 1;
    return (((brzos(fakt[b],MOD-2)*brzos(fakt[a-b],MOD-2))%MOD)*fakt[a])%MOD;
}

ll jedan(ll nu,ll je);

ll nula(ll nu,ll je){
    //printf("    nu %I64d %I64d\n",nu,je);
    if(nu==0 && je==1)return 0;
    if(nu==0)return 1;
    if(je==0)return nu%2;
    return (binomni(nu+je-1,nu)+jedan(nu-1,je))%MOD;
}

ll jedan(ll nu,ll je){
    //printf("    je %I64d %I64d\n",nu,je);
    if(nu==0 && je==1)return 1;
    if(nu==0)return 0;
    if(je==0)return 1-(nu%2);
    return (nula(nu-1,je));
}

ll n,m,g;

int main()
{
    fakt[0]=1;
    for(ll i=1;i<MAXN;i++){
        fakt[i]=(fakt[i-1]*i)%MOD;
    }
    scanf("%I64d %I64d %I64d", &n, &m, &g);
    if(g)printf("%I64d",jedan(n,m));
    else printf("%I64d",nula(n,m));
    return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#define Mod (1000000007)
#define LL long long
using namespace std;
LL Fac[2020202];
LL Ksm(LL x,int a){
	LL res=1;
	while (a){
		if (a&1) res*=x,res%=Mod;
		x=(x*x)%Mod; a>>=1;
	}
	return res;
}
LL C(int n,int m){
	return ((Fac[n]*Ksm(Fac[m],Mod-2))%Mod*Ksm(Fac[n-m],Mod-2))%Mod;
}
int n,m;
int main(){
	LL x=0; int g;
	scanf("%d %d %d",&n,&m,&g);
	Fac[0]=1;
	for (int i=1;i<=n+m;i++)
		Fac[i]=Fac[i-1]*(LL)i,Fac[i]%=Mod;
	if (!n){
		if (m==1) x=1;
		if (!g) cout<<(x^1);
		else cout<<x;
		return 0;
	}
	if (!m){
		if (n%2==0) x=1;
		if (!g) cout<<(x^1);
		else cout<<x;
		return 0;
	}
	if (n%2==0&&m==1) x=1;
	for (int i=1;i<=n;i+=2)
		x+=n+m-i-1>0?C(n+m-i-1,n-i):0,x%=Mod;
	if (g) cout<<x;
	else cout<<(C(n+m,m)-x+Mod)%Mod;
}

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
#include<queue>
#include<vector>
#include<string>
#include<iostream>
#include<map>
#define clr(x,y) memset(x,y,sizeof(x))
#define ll long long
using namespace std ;

int n,m,g;
ll p[200005];
ll mod = 1000000007;

ll power(ll a,int idx){
    ll ans = 1;
    while(idx){
        if(idx&1) ans *= a;
        ans%=mod;
        a*=a;
        a%=mod;
        idx>>=1;
    }
    return ans;
}
ll C(int n,int m){
    ll ans = p[n+m];
    ans = ans * power(p[n],mod-2)%mod;
    ans = ans * power(p[m],mod-2)%mod;
    return ans;
}
ll dfs(int n,int m,int g){
    if (n==0&&m==1&&g) return 1;
    if (n==1&&m==0&&!g) return 1;
    ll ans = 0ll;
    if(g==0){
        ll ans = 0;
        if (n)
            ans += dfs(n-1,m,1);
        if(m>0&&n+m-1>0)
            ans += C(n,m-1);
        return ans %= mod;
    }
    else{
        if (n)
            ans+=dfs(n-1,m,0)%mod;
    }
    return ans%mod;
}
int main(){
//    freopen("/home/zyc/Documents/Code/cpp/in","r",stdin);
    p[0] = 1;
    for(int i=1;i<=200000;i++) p[i] = p[i-1] * i%mod;

    scanf("%d%d%d",&n,&m,&g);
    cout<<dfs(n,m,g)<<endl;
    return 0;
}

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

long long gcd(long long a, long long b, long long & x, long long & y) {
    if (a == 0) {
        x = 0;
        y = 1;
        return b;
    }
    long long x1, y1;
    long long d = gcd(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}

long long inverse(long long a){
    long long x, y;
    long long g = gcd(a, MOD, x, y);
    x = (x % MOD + MOD) % MOD;
    return x;
}

int main(){
    //freopen("a.in", "r", stdin);
    long long n, m, g; cin >> n >> m >> g;
    if(n == 0){
        if(m == 1){
            if(g == 1){
                cout << 1 << endl;
                exit(0);
            }
            else{
                cout << 0 << endl;
                exit(0);
            }
        }
        if(g == 0){
            cout << 1 << endl;
            exit(0);
        }
        else{
            cout << 0 << endl;
            exit(0);
        }
    }
    else if(m == 0){
        if(n % 2 == 1){
            if(g == 0){
                cout << 1 << endl;
                exit(0);
            }
            else{
                cout << 0 << endl;
                exit(0);
            }
        }
        else{
            if(g == 0){
                cout << 0 << endl;
                exit(0);
            }
            else{
                cout << 1 << endl;
                exit(0);
            }
        }
    }

    long long i;
    if(g == 0){
        i = n+m-1;
    }
    else{
        i = n+m-2;
    }
    long long fac[n+m];
    fac[0] = 1;
    for(long long i = 1; i<n+m; i++){
        fac[i] = (fac[i-1]*i)%MOD;
    }
    long long inv[n+m];
    for(long long i = 0; i<n+m; i++){
        inv[i] = inverse(fac[i]);
    }
    long long ans = 0;
    for(; i>=m-1; i-=2){
        long long temp = fac[i];
        temp *= inv[m-1];
        temp %= MOD;
        temp *= inv[i-m+1];
        temp %= MOD;
        ans += temp;
        ans %= MOD;
    }
    if(m == 1 && n%2 == g){
        ans--;
        ans += MOD;
        ans %= MOD;
    }
    else if(m == 1){
        ans++;
        ans += MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}

/*
 * File:   main.cpp
 * Author: DigitalNet
 *
 * Created on 10 آب, 2013, 01:30 ص
 */

#include <cstdlib>
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

/*
 *
 */

typedef unsigned int uint;

#define ll long long
const uint p = 1000000007;
const int maxn = 200000;
int max_n=3;
vector<int> fix(maxn,0);

uint modPow(uint a, uint x) {
// return a^x mod p
ll res = 1,ta = a;
while(x>0) {
if(x & 1) res = (res*ta) % p;
ta=(ta*ta)%p;
x >>= 1;
}

return (uint)res;
}

uint modInverse(uint a) {
// return modular multiplicative of: a mod p, assuming p is prime
return modPow(a, p-2);
}

uint fact(uint a)
{
    while(max_n<=a)
    {
        long long x = fix[max_n-1];
        x*=max_n;
        x%=p;
        fix[max_n]=x;
        max_n++;
    }
    return fix[a];
}

uint binomial(uint n,uint k)
{
    uint numerator = fact(n);

    ll x = ((ll)fact(k)*(ll)fact(n-k))%p;
    uint denominator = (uint)x;

    ll res = modInverse(denominator);
    res = (res*numerator)%p;
    return (uint)res;
}

uint func(uint n,uint m,uint g)
{
    ll rslt = 0;
    for( ;g<=n&&(m>1||g<n);g+=2)
    {
        rslt += binomial((m+n)-g-1,n-g);//3.1.g
        if(rslt>=p)
                rslt%=p;
    }
    return (uint)rslt;
}

uint answerfor(int n,int m,int g)
{
    uint rslt=0;
    if(n==0)//1
    {
        if(m==1)//1.1
            rslt = g;
        else if(m>1)//1.2
            rslt = abs(g-1);
    }
    else if(m==0)//2
    {
        rslt = abs(g-(n%2));//2
    }
    else if(n+m>=2)//3
    {
        rslt = func(n,m,g);//3.1
        if(m == 1)//3.2
        {
            if(g==0 && n%2==1) rslt += 1;//3.2.1
            else if(g==1 && n%2==0) rslt += 1;//3.2.2
        }
    }
    return rslt;
}
int main(int argc, char** argv) {
    fix[0] = 1;
    fix[1] = 1;
    fix[2] = 2;
    int n,m,g;
    cin>>n>>m>>g;
    uint rslt= answerfor(n,m,g);
    cout<<rslt;

    return 0;
}

#include <iostream>
#include <string>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <bitset>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#define INF 2147483647
#define LLINF 9223372036854775807
#define NLLINF -9223372036854775807
#define NINF -2147483647
#define reset(arr,j) memset(arr,j,sizeof(arr));
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define vec vector<int>
#define LL long long
#define fa(i,n) for(int i=0;i<n;i++)
#define take(vec,n) vector<int> vec; for(int i=0;i<n;i++){int a; cin >> a; vec.pb(a)};
#define print(arr,n) fa(i,n) printf("%d ",arr[i]); printf("\n");
#define fd(i,n) for(int i=n-1;i>=0;i--)
#define vpair vector < pair <int ,int> >
using namespace std;
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\////\\//\\//
LL N[200005],D[200005];
LL POWER(int b,int e){
    if(e == 0)
        return 1;
    if(e&1)
        return (POWER(b,e-1) % 1000000007 *b) % 1000000007;
    else{
        LL t = POWER(b,e/2) % 1000000007;
        return t*t % 1000000007;
    }
}
LL C(int n,int r){
    return N[n]*((D[r]*D[n-r]) % 1000000007) % 1000000007;
}
main(){
    D[0] = 1;
    N[1] = 1,D[1] = 1;
    for(int i=2;i<200001;i++){
        N[i] = ((N[i-1]%1000000007)* i) % 1000000007;
        D[i] = POWER(N[i],1000000005);
    }
    int n,m,g;
    cin >> n >> m >> g;
    int all = C(n+m,n);
    int one = 0;
    if(m){
        for(int i=1;i<=n && n-i+m-1 >= m-1;i+=2){
            one += C(n-i+m-1,m-1);
            one %= 1000000007;
        }
    }
    if((!m && n % 2 == 0) || (m == 1 && n%2 == 0))
        one++;
    if(g)
        cout << one;
    else
        cout << ((all-one) % 1000000007 + 1000000007) % 1000000007;
}

#include <bits/stdc++.h>
using namespace std;
long long mod=1e9+7;
struct node
{
	typedef long long ll;
	ll f[1000015],N=1000005,mod=1e9+7;
	void init()
	{
		f[0]=1;
		for(int i=1;i<=N;i++) f[i]=f[i-1]%mod*i%mod,f[i]%=mod;
	}
	node()
	{
		init();
	}
	ll inv(ll a)
	{
		ll base=a,ans=1,b=mod-2;
		while(b)
		{
			if(b&1) ans=ans%mod*base%mod,ans%=mod;
			base=base%mod*base%mod,base%=mod;
			b>>=1;
		}
		return ans%mod;
	}
	ll C(ll a,ll b)
	{
		return f[a]%mod*inv(f[b])%mod*inv(f[a-b])%mod;
	}
}C;
int main()
{
	long long n,m,g,ans1=0,ans2=0;
	scanf("%lld%lld%lld",&n,&m,&g);
	if(n>1&&m>1) //正常情况
	{
		ans2=C.C(n+m,n);
		for(int i=1;i<=n;i++)
		if(i&1) ans1=ans1%mod+C.C(n-i+m-1,n-i)%mod;
		if(g==1) printf("%lld",ans1%mod);
		else
		{
			ans2=ans2%mod-ans1%mod;
			ans2=(ans2%mod+mod)%mod;
			printf("%lld",ans2);
		}
	}
	else if(n==0) //全都是1
	{
		if(m==1)
		{
			if(g==1) printf("1"); //一个1是1
			else printf("0");//其他是0
		}
		else
		{
			if(g==1) printf("0"); //多个1一定是0
			else printf("1");
		}
	}
	else if(m==0) //全都是0
	{
		if(g==1) printf("%d",!(n&1));
		else printf("%d",(n&1));
	}
	else if(n==1) //一个0
	{
		if(m==1) printf("%d",!(g==1)?2:0);
		else
		{
			if(g==1) printf("1");
			else printf("%lld",n+m-1);
		}
	}
	else if(m==1)//一个1
	{
		if(g==0)
		{
			printf("%lld",(n/2)+2*(n%2!=0));

		}
		else
		{
			if(n&1) printf("%lld",n/2);
			else printf("%lld",(n/2+1));
		}
	}
}

// by Balloons
// 为什么别人比你进步的快？ 因为别人比你努力的多！
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)

using namespace std;

typedef long long LL;

const int inf = 1 << 30;
#define int LL

const int maxn=3e5+5,mod=1e9+7;

/*
先讨论 g=0,的情况，g=1同理（C(n+m,n)-(g=0的情况)） 即可
注意到 如果末两位为 10 11 的话，结果都是0
所以我们可以将 1 看做归0符
对于g=0，可以先枚举第一个1的位置，其前面一定有偶数个0（这样得出来的数才是0）
1的后面可以随意排布，记1的前面有2*k的0，那么后面的方案数是C(n+m-2*k-1,m-1)
有两种特殊情况：
1) 只有一个1，那么会出现00001（偶数个0）的情况，答案是1，不符要求，会出现在n为偶数且m=1的情况下
2) 奇数后面跟着一个1（如：0001），答案也是0，但因为1前面有奇数个0，所以没有算进去，会出现在m=1且n为奇数的情况下
感觉自己并不能想出来啊 >_<
*/

int fac[maxn],n,m,g;

void init(){
	fac[0]=1;
	for(int i=1;i<=200000;i++)fac[i]=(fac[i-1]*i)%mod;
}

int ksm(int a,int b){
	if(!b)return 1;
	if(b==1)return a%mod;

	int tmp=ksm(a,b/2);
	if(b&1)return 1ll*tmp*tmp%mod*a%mod;
	return 1ll*tmp*tmp%mod;
}

int C(int x,int y){	// C(x,y)=x!/((x-y)!*y!)
	return fac[x]*ksm((fac[x-y]*fac[y])%mod,mod-2)%mod;
}
void quit(int x){printf("%d\n",x);exit(0);}

// 100000 100000 0
signed main(){
	scanf("%I64d%I64d%I64d",&n,&m,&g);
	if(n==0&&m==0&&g==0)quit(1);
	if(n==0&&m==0&&g==1)quit(0);
	if(n==0&&m==1&&g==0)quit(0);
	if(n==0&&m==1&&g==1)quit(1);
	if((n&1)&&m==0&&g==0)quit(1);
	if((n&1)&&m==0&&g==1)quit(0);
	if(n==1&&m==1&&g==0)quit(2);	// 10 01
	if(n==1&&m==1&&g==1)quit(0);
	init();
	int all=C(n+m,n)%mod;
	int g0=0;
	for(int i=0;i<=n/2;i++)(g0+=C(n+m-2*i-1,m-1))%=mod;
	int ans=g0%mod;
	if(n%2==0&&m==1)ans=(ans-1+mod)%mod;
	if(n%2&&m==1)ans=(ans+1)%mod;
	if(g==0)printf("%I64d\n",ans%mod);
	else printf("%I64d\n",(all-ans+mod)%mod);

	return 0;
}

#include <cstdio>

#define MAX_N 100010

#define MODULO 1000000007

int c[2][MAX_N*2][2];
int n,m,g;
int inv[MAX_N*2];

int pow(long long a, long long b, int MOD) {

  long long x = 1, y = a;
  while(b > 0) {
    if(b%2 == 1) {
      x=(x*y);
      if(x>MOD) x%=MOD;
    }
    y = (y*y);
    if(y>MOD) y%=MOD;
    b /= 2;
  }
  return (int)(x % MOD);
}

int modInverse(int a, int m) {
    return pow(a,m-2,m);
}

void init()
{
  for(int i=2; i<MAX_N*2; i++) {
    inv[i] = modInverse(i,MODULO);
  }
  inv[1] = 1;
}

main()
{
  scanf("%d %d %d",&n,&m,&g);

  long long val = 0;
  init();

  if(m==1)
    val = (m+1)% MODULO;
  else {
    long long vv = 1;

    val = 1;

    int sgn = (n+m-1)%2;

    for(int i=m; i<=n+m-1; i++) {
      vv *= i;
      vv %= MODULO;
      vv *= inv[i-m+1];
      vv %= MODULO;
      //printf("> %lld\n",vv);

      if(i%2 == sgn) {
        val += vv;
        val %= MODULO;
      }
    }
  }

  if(g==0)
    printf("%I64d\n",val);
  else {
    long long vvv = 1;
    for(int i=m+1; i<=n+m; i++) {
      vvv *= i;
      vvv %= MODULO;
      vvv *= inv[i-m];
      vvv %= MODULO;
    }
    //printf("%lld\n",vvv);
    printf("%I64d\n",(vvv-val+MODULO)% MODULO);
  }
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
#include <queue>
#include <vector>
#include <string>
#include <cmath>
#define Mod (1000000007LL)
#define eps (1e-8)
#define Pi (acos(-1.0))
using namespace std;
long long ans;
long long Power(long long x,long long k)
{
    long long tmp=1;
    while(k)
    {
        if(k&1) tmp=tmp*x%Mod;
        x=x*x%Mod;
        k>>=1;
    }
    return tmp;
}
long long Inv(long long x)
{
    return Power(x,Mod-2LL);
}
int n,m,g,s;
long long f[200100];
long long C(long long x,long long y)
{
    if(x==0) return 0;
    long long tmp;
    tmp=f[x]*Inv(f[y])%Mod;
    tmp=tmp*Inv(f[x-y])%Mod;
    return tmp;
}
int main()
{
    f[0]=1;
    for(int i=1;i<=200000;i++)
    f[i]=f[i-1]*i%Mod;
    while(~scanf("%d%d%d",&m,&n,&g))
    {
        ans=0;
        if(n==0)
        {
            ans=m%2;
        }
        else
        {
            s=n+m;
            for(int i=s-1;i>=n-1;i--)
            {
                if((s-i)%2)
                {
                    ans+=C(i,n)+C(i,n-1);
                    ans%=Mod;
                }
                else
                {
                    ans+=2LL*Mod-C(i,n)-C(i,n-1);
                    ans%=Mod;
                }
            }
        }
        if(g==0) printf("%I64d\n",ans);
        else
        {

            ans=C(n+m,n)+Mod-ans;
            ans%=Mod;
            printf("%I64d\n",ans);
        }
    }
    return 0;
}

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <set>
#include <vector>
#include <iomanip>
#include <cmath>
#include <string>

using namespace std;

const int N = 2000000, mod = 1000000007;

int cnt[2], target;
long long fact[N];

#define forn(i,n) for(int i = 0; i < (int) n; i++)
#define sz(a) (int)(a).size()

inline long long bpow(long long v, int power) {
	if (power == 0) return 1;
	if ((power & 1) == 0) {
		long long r = bpow(v, power >> 1);
		return (r * r) % mod;
	}
	return (bpow(v, power - 1) * v) % mod;
}

inline int getC(int n, int k) {
	long long nom = fact[n];
	long long den = (fact[n-k] * fact[k]) % mod;
	return (nom * bpow(den, mod - 2)) % mod;
}

int calculate() {
	if (cnt[1] == 0) {
		if (cnt[0] % 2 != target)
			return 1;
		else
			return 0;
	}
	if (cnt[0] == 0) {
		if (cnt[1] > 1) {
			if (target == 0)
				return 1;
			else
				return 0;
		} else {
			if (target == 1)
				return 1;
			else
				return 0;
		}
	}
	int answer = 0;
	for(int i = 0; i <= cnt[0]; i++) {
		int total = cnt[0] + cnt[1] - 1 - i;
		if (total > 0) {
			if (i % 2 == target) {
				answer += getC(total, cnt[1] - 1);
				if (answer >= mod) answer -= mod;
			}
		} else {
			if (i % 2 != target) {
				answer += getC(total, cnt[1] - 1);
				if (answer >= mod) answer -= mod;
			}
		}
	}
	return answer;
}

inline void solve() {
	fact[0] = 1;
	forn(i, N) {
		if (!i) continue;
		fact[i] = (fact[i-1] * i) % mod;
	}
	cout << calculate() << endl;
}

long long c = 1000000007;

long long inv(long long x){
	long long res = 1;
	long v = c - 2;
	while (v){
		if (v % 2 == 1)
			res = (res * x) % c;
		v /= 2;
		x = (x * x) % c;
	}
	return res;
}

int main(){
	//freopen("input.txt", "rt", stdin);
	//freopen("output.txt", "wt", stdout);

	long i, n, m, g;
	long long fact[200001], ans = 0;

	cin >> n >> m >> g;
	cnt[0] = n;
	cnt[1] = m;
	target = g;

	fact[0] = 1;

	for (i = 1; i <= n + m; i++){
		fact[i] = fact[i - 1] * i;
		fact[i] = fact[i] % c;
	}

	if (m == 0){
		if (g == 0)
			if (n % 2 == 1)
				cout << 1;
			else
				cout << 0;

		if (g == 1)
			if (n % 2 == 1)
				cout << 0;
			else
				cout << 1;

		return 0;
	}

	if (n == 0)
		if (g == 0)
			cout << 1;
		else
			cout << 0;

	for (i = 0; i <= n; i++){
		if ((g == 0)&&((i % 2 == 0)&&(n + m - i - 1 != 0)||(i % 2 == 1)&&(n + m - i - 1 == 0)))
			ans += (fact[n + m - i - 1] * inv((fact[m - 1] * fact[n - i]) % c)) % c;
		else if ((g == 1)&&((i % 2 == 1)&&(n + m - i - 1 != 0)||(i % 2 == 0)&&(n + m - i - 1 == 0)))
			ans += (fact[n + m - i - 1] * inv((fact[m - 1] * fact[n - i]) % c)) % c;
	}

	cout << ans % c << endl;

	//solve();

	return 0;
}

#include <iostream>
#include <cmath>

using namespace std;

typedef long long ll;

const int N = 2e5 + 10;
const ll MOD = 1e9 + 7;

ll inv[N], fact[N];

ll bpow(ll a, ll b)
{
	if (b == 0)
		return 1;
	ll x = bpow(a, b/2);
	return b & 1 ? x * x % MOD * a % MOD : x * x % MOD;
}

ll c(ll a, ll b)
{
	if (a > b)
		return 0;
	return fact[b] * inv[a] % MOD * inv[b-a] % MOD;
}

int main()
{
	int n, m;
	bool g;

	cin >> n >> m >> g;

	fact[0] = inv[0] = 1;
	for (int i=1; i<N; i++)
	{
		fact[i] = fact[i-1] * i % MOD;
		inv[i] = inv[i-1] * bpow(i, MOD-2) % MOD;
	}

	ll ans = 0;
	while (n >= 0)
	{
		if (!g)
		{
			ans += c(n, n+m-1);
			ans %= MOD;
		}
		g = !g;
		n--;
	}
	if (!g && m<=1)
		ans++;

	cout << ans;
}

//Fruit of Light
//FoL CC
//Apple Strawberry

#include<cstdio>
#include<algorithm>
#include<vector>
#include<iostream>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<cstring>

using namespace std;

#define For(i, n) for(int i = 0; i<(n); ++i)
#define ForEach(it, i) for(typeof i.begin() it = i.begin(); it!=i.end(); ++it)

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

#define MOD 1000000007
          // 123456789
#define MAXN 200047

int n,m,q;
ll inv[MAXN], fak[MAXN], ifak[MAXN];

inline ll total(ll a, ll b){
    return (fak[a+b] * (ifak[a] * ifak[b])%MOD) % MOD;
}

ll solve(ll a, ll b, ll c){
    if (b==0){
        return ((a>1)==c);
    }
    if (a==0){
        return (b%2==c);
    }
    if (c) a--;
    return (total(a,b) - solve(a,b,1))%MOD;
}

int main(){
    fak[0] = ifak[0] = 1;
    For(i,MAXN-10){
        {
            ll a = 1, x = i+1, y = MOD-2;
            while(y>0){
                if (y%2) a = (a*x)%MOD;
                x = (x*x)%MOD;
                y/=2;
            }
            inv[i+1] = a;
            ifak[i+1] = (inv[i+1]*ifak[i])%MOD;
        }
        fak[i+1] = (ll(i+1)*fak[i])%MOD;
        //if (i<20)
          // cout << inv[i] << " " << fak[i] << " " << ifak[i] << endl;
    }
    scanf("%d%d%d",&n, &m, &q);
    printf("%d\n", int((solve(n,m,q)%MOD+MOD*2)%MOD));
}

#include <iostream>

using namespace std;

const long long mod = 1e9 + 7;
const long long size = 1e6;

int n, m, g;
long long ans, pp[size];

void solve_1(int n, int m);

void solve_0(int n, int m);

int main() {
	cin >> n >> m >> g;
	pp[0] = 1;
	for (int i = 1; i < n + m + 1; i++)
		pp[i] = (pp[i - 1] * i) % mod;
	if (g == 0)
		solve_0(n, m);
	else
		if (n > 0)
			solve_0(n - 1, m);
	cout << ans;
}

long long Pow(long long i, long long p) {
	if (p == 0)
		return 1;
	if (p == 1)
		return i;
	long long aa;
	if (p % 2 == 1) {
		aa  = Pow(i, (p - 1) / 2);
		aa = (aa * aa)  % mod;
		return (i * aa) % mod;
	}
	aa = Pow(i, (p) / 2);
	return (aa * aa) % mod;
}

void coun(int a, int b) {
//	cout << "I'm wanted to have C: " << a + b << ' ' << a << endl;
	if (a == 0)  {
		ans = (ans + 1) % mod;
		return;
	}
	if (b == 0) {
		ans = (ans + 1) % mod;
		return;
	}
	int N = (a + b);
	int k = a;
	long long answ = pp[N], x = pp[k], y = pp[N - k];
/*	for (int i = 2; i <= N; i++) {
		answ = (answ * i) % mod;
	}
	for (int i = 2; i <= k; i++)
		x = (x * i) % mod;
	for (int i = 2; i <= (N - k); i++)
		y = (y * i) % mod;    */
	x = (x * y) % mod;
	answ = (answ * Pow(x, mod - 2)) % mod;
//	answ = (answ / x) % mod;
//	cout << answ << endl;
	ans = (ans + answ) % mod;
}

void solve_1(int n, int m) {
	//cout << "I'm wanted to have 1: " << n << ' ' << m << endl;
	if (((m == 0) && (n == 2)) || ((n == 0) && (m == 1))) {
		ans = (ans + 1) % mod;
		return;
	}
	if (n > 0)
		solve_0(n - 1, m);
}

void solve_0(int n, int m) {
//	cout << "I'm wanted to have 0: " << n << ' ' << m << endl;
	if (n + m == 2) {
		if ((n == 1) && (m == 1)) {
			ans = (ans + 2) % mod;
			return;
		}
		if (m == 2) {
			ans = (ans + 1) % mod;
			return;
		}
	}
	if ((m == 0) && (n == 1)) {
		ans = (ans + 1) % mod;
		return;
	}
	if (n == 0 && m == 1)
		return;
	if ((m > 0)) {
		coun(n, m - 1);
	}
		if (n > 0) {
		solve_1(n - 1, m);
	}

}

#include<stdio.h>
#include<string.h>
#include<algorithm>

#define mod 1000000007LL

using namespace std;

long long dp[200005], tp[200002];

int main(){
dp[0]=1LL; for(int i=1; i<=200002; i++)
{
    dp[i]=(dp[i-1]*i)%mod; int k=1000000005;
    long long  ret=1LL; long long p=dp[i]; while(k>0)
    {
        if(k%2==1) ret=(ret*p)%mod;
        k/=2;
        p=(p*p)%mod;
    }
    tp[i]=ret;
}
    int n, m, l; scanf("%d%d%d",&n,&m,&l);
    //i

     if(m==0)
    {
        if(l==1 && (n%2)==0) printf("1\n");
        else if(l==0 && (n%2)==1) printf("1\n");
        else printf("0\n");
        return 0;
    }
    if(n==0)
    {
        if(l==1 && m==1) printf("1\n");
        else if(l==0 && m==1) printf("0\n");
        else if(l==0) printf("1\n");
        else printf("0\n");
        return 0;
    }
int tmp=n; n=m; m=tmp;
    long long ans=0LL; for(int i=1; i<n; i+=2)
    {
        ans=(ans+((dp[n+m-i-1]*tp[n-i])%mod*tp[m-1])%mod)%mod;
    }
    long long kk = ( (dp[n+m]*tp[n])%mod*tp[m])%mod+mod;
    if(l==0) ans=(kk-ans)%mod;
    printf("%lld\n",ans);
    return 0;//010100101
}

#include <iostream>
#include <vector>
#include <iomanip>
#include <cassert>
#include <tuple>

int res(int mask, int len) {
    while (len > 1) {
        mask = (((mask & 1) == 0) & ((mask & 3) == 0)) | (mask >> 2 << 1);
        --len;
    }
    return mask;
}

typedef std::vector<int> vi;
typedef std::vector<vi> vvi;
typedef std::vector<vvi> vvvi;

typedef std::pair<int,int> pii;

const int mod = (int)1e9+7;

int& addto(int &a, int b) {
    return (a += b) >= mod ? (a -= mod) : a;
}

int &subfrom(int &a, int b) {
    return (a -= b) < 0 ? (a += mod) : a;
}

int add(int a, int b) {
    return addto(a,b);
}

int sub(int a, int b) {
    return subfrom(a,b);
}

int mul(int a, int b) {
    return int(1LL * a * b % mod);
}

int pow(int a, int n) {
    int res = 1;
    while (n > 0) {
        if (n & 1) {
            res = mul(res, a);
        }
        a = mul(a, a);
        n >>= 1;
    }
    return res;
}

int inverse(int a) {
    return pow(a, mod-2);
}

pii fast(int n1, int n2) {
    if (n1 == 0) {
        return pii((n1+n2)%2, (n1+n2+1)%2);
    } else if (n1 == 1) {
        return (n1+n2) % 2 == 0 ? pii(n1+n2-(n1+n2-2)/2, (n1+n2-2)/2) : pii(n1+n2-(n1+n2+1)/2, (n1+n2+1)/2);
    }
    int cnt0 = 1, cnt1 = 0, bin = 1;
    for (int i1 = n1+n2; i1 > n1; --i1) {
        bin = mul(mul(bin, i1), inverse(n1+n2-i1+1));
        int diff = sub(cnt0, cnt1);
        cnt1 = diff;
        cnt0 = sub(bin, diff);
    }
    return pii(cnt0, cnt1);
}

int main() {
    /*
    const int MXLEN = 20;
    vvvi answ(2, vvi(MXLEN+1, vi(MXLEN+1)));
    for (int len = 1; len <= MXLEN; ++len) {
        for (int mask = 0; mask < (1 << len); ++mask) {
            int cnt1 = __builtin_popcount(mask);
            answ[res(mask,len)][len][cnt1]++;
        }
    }
    for (int len = 1; len <= MXLEN; ++len) {
        std::cout << std::string(40,'-') << std::endl;
        std::cout << "len = " << len << std::endl;
        for (int cnt1 = 0; cnt1 <= len; ++cnt1) {
            std::cout << "\tcnt0 = " << std::setw(9) << len - cnt1 << ", cnt1 = " << std::setw(9) << cnt1;
            std::cout << ", answ for 1 = " << std::setw(9) << answ[1][len][cnt1];
            std::cout << ", answ for 0 = " << std::setw(9) << answ[0][len][cnt1];
            std::cout << ", diff = " << std::setw(9) << answ[0][len][cnt1] - answ[1][len][cnt1];
            std::cout << std::endl;
            assert(pii(answ[0][len][cnt1], answ[1][len][cnt1]) == fast(cnt1, len - cnt1));
        }
    }
    */
    int n1, n2, g;
    while (std::cin >> n1 >> n2 >> g) {
        auto ret = fast(n1,n2);
        std::cout << (g == 0 ? ret.first : ret.second) << std::endl;
    }

    return 0;
}

#include <bits/stdc++.h>
#define msg(x) cout << #x << " = " << (x) << endl
using namespace std;

const int mod = 1000000007;
const int maxN = 200555;

int power(int base, int expo) {
    int res = 1;
    while (expo > 0) {
        if (expo & 1) res = 1LL * res * base % mod;
        base = 1LL * base * base % mod;
        expo >>= 1;
    }
    return res;
}

inline int inverse(int x) {
    return power(x, mod - 2);
}

int n, m, g;
int f[maxN];

int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin >> n >> m >> g;
    if (m == 0) {
        n %= 2;
        cout << (g ^ n) << endl;
        return 0;
    }
    if (n == 0) {
        int ss;
        if (m > 1) {
            ss = 0;
        } else {
            ss = 1;
        }
        if (g == ss) {
            cout << 1 << endl;
        } else {
            cout << 0 << endl;
        }
        return 0;
    }
    f[0] = 1;
    for (int i = 1; i < maxN; i++) {
        f[i] = 1LL * i * f[i - 1] % mod;
    }
    int cnt1 = 0;
    int l = 0;
    if (m > 1) l = 1;
    for (int i = 1; i <= n; i++) {
        if (i % 2 == l) continue;
        cnt1 += 1LL * f[n + m - i - 1] * inverse(f[n - i]) % mod * inverse(f[m - 1]) % mod;
        cnt1 %= mod;
    }
    int cnttot = 1LL * f[n + m] * inverse(f[m]) % mod * inverse(f[n]) % mod;
    int ans;
    if (g == 0) {
        ans = cnttot - cnt1;
    } else {
        ans = cnt1;
    }
    if (ans < 0) ans += mod;
    cout << ans << endl;
    return 0;
}

#include <iostream>
#include <iomanip>
#include <fstream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstring>
#include <string>
#include <sstream>
#include <bitset>
#include <iterator>
#include <list>
#include <functional>

#define FR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,c,n) for(int (i)=(c);(i)<(n);(i)++)
#define REP(it,v,cont) for((cont)::iterator (it)=(v).begin();(it)!=(v).end();++(it))
#define CLR(a,c) memset((a),(c),sizeof (a))
#define ALL(v) (v).begin(),(v).end()
#define VCPRINT(v) for(int iii = 0;iii < (v).size();iii++) cout<<(v)[iii]<<" ";cout<<endl;
#define SETPRINT(v,cont) for((cont)::iterator iiit = (v).begin();iiit != (v).end();iiit++) cout<<*iiit<<" ";cout<<endl;

bool ascending (int i,int j) { return (i<j); }
bool descending (int i,int j) { return (i>j); }

typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
#define PII pair<int,int>
#define PLI pair<long long,int>
#define PULI pair<unsigned long long,int>
#define PIL pair<int,long long>
#define PSI pair<string,int>
#define PSS pair<string,string>

using namespace std;

ll mod = 1000*1000*1000+7;
const ll MAX = 3*100*1000;
ll fact[MAX];
void PreCalc()
{
	fact[0] = 1;
	fact[1] = 1;
	FOR(i,2,MAX)
		fact[i] = (fact[i-1]*i)%mod;
}
ll countFact(ll n, ll p)
{
	ll k=0;
	while (n>=p)
	{
		k+=n/p;
		n/=p;
	}
	return k;
}
ll powmod(ll a , ll b,ll m){

	ll x=a,p=1;
	while(b>0)
	{
		if(b%2)
			p=((p%m)*(x%m))%m;
		b/=2;
		x=((x%m)*(x%m))%m;
	}
	return p;
}
ll inverse(ll n,ll p)
{
	return powmod(n,p-2,p);
}

ll C(ll n,ll k,ll p)
{
	if (countFact(n, p) > countFact(k, p) + countFact(n-k, p))
		return 0;

	return (fact[n] *
			((inverse(fact[k], p) *
			inverse(fact[n-k], p)) % p)) % p;
}

ll f(ll n,ll m,ll i)
{
	if(n < 0 || m < 0) return 0;
	if(i <= 0) return 0;
	return C(n+m,n,mod);
}

ll MOD(ll a)
{
	while(a<0) a+=mod;
	return a%mod;
}
int main()
{
	PreCalc();
	int n,m,g;cin>>n>>m>>g;
	ll ret = 0;
	for(int i = 0;i < n+m+1;i+=2){
		ret += f(n-i,m-1,n+m-i-1);
		ret%=mod;
	}
	if(n == 1 && m == 1) ret++;
	if(n==1 && m == 0) ret = g;
	if(g==0) cout<<ret<<endl;
	else cout<<MOD(f(n,m,n+m)-ret)<<endl;
}

#include <bits/stdc++.h>
#define ll unsigned long long
#define ff first
#define ss second
#define pb push_back
#define MOD 1000000007
#define MAXN 1000000007
#define edl '\n'
#define IOFAST ios::sync_with_stdio(false);cin.tie(0); cout.tie(0);
#define PI 3.14159265
#define all(a) a.begin(), a.end()
using namespace std;

vector<long long> fact;

long long power(long long x, long long y)
{
    long long res = 1; // Initialize result

    x = x % MOD; // Update x if it is more than or

    while (y > 0) {
        if (y & 1)
            res = (res * x) % MOD;

        y = y >> 1; // y = y/2
        x = (x * x) % MOD;
    }
    return res;
}

long long modInverse(long long n)
{
    return power(n, MOD - 2);
}

long long nck(long long n, long long k) {
    if(k == 0)
        return 1;

    long long ans = (fact[n] * modInverse(fact[k]))%MOD;
    ans = (ans * modInverse(fact[n-k]))%MOD;
    return ans;

}

void solve()
{
	ll n, m, g;
	cin>>m>>n>>g;
	fact = vector<long long>(n+m+1, 1);
	for(long long i = 2; i<=n + m; i++) {
        fact[i] = (fact[i-1] * i)%MOD;
    }

    ll getone = 0, getzero = 0;
    if(n + m == 1){if(g && n || (!g && m))cout<<1<<edl; else cout<<0<<edl; return; }
    if(n + m == 2 && n == 1){getzero = 2;}
    else if(n == 0)
    {
    	if(m%2 == 0)getone = 1;
    	else getzero = 1;
    }
    else if(m == 0)
    {
    	getone = 0;
    	getzero = 1;
    }
    else
    {
    	for(int i = 1; i <= m; i = i+2)
    	{
    		getone = (getone + nck(n+m - (i+1), m - i) + MOD)%MOD;
    	}
    	getzero = (nck(n+m,m) - getone + MOD)%MOD;
    }
    if(g == 0)cout<<getzero<<edl;
    else cout<<getone<<edl;
    return;
}

int main()
{
	solve();
	return 0;
}

#include <iostream>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <list>
#include <deque>
#define FOR(i,a,b) for (int i=(a),_b=(b);i<=_b;i++)
#define DOWFOR(i,a,b) for (int i=(a),_b=(b);i>=_b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define Reset(c,x) memset(c,x,sizeof(c))
using namespace std;
//-------------------------------------------------------------------
int gcd(int xx, int yy) // greatest common divisor
{
    while (yy != 0)
    {
        xx = xx%yy;
        swap(xx, yy);
    }
    return xx;
}
//-------------------------------------------------------------------
int lcm(int xx, int yy) // least common mutiple
{
    return (xx / gcd(xx, yy))*yy;
}
//---------------------------------------------------------------------
int Power(int a, int x, int base = -1)
{
    if (base == -1){
        if (x == 1) return a;
        else if (x == 0) return 1;
        int temp = Power(a, x / 2);
        temp = temp * temp;
        if (x % 2 == 1) return temp * a;
        else return temp;
    }
    else{
        if (x == 1) return a % base;
        else if (x == 0) return 1;
        int temp = Power(a, x / 2, base);
        temp = (1ll * temp * temp) % base;
        if (x % 2 == 1) return (1ll * temp * a) % base;
        else return temp;
    }
}
//---------------------------------------------------------------------
const int MAXN = 100 * 1000 + 1;
const int MAXM = 100 * 1000 + 1;
const int base = 1000 * 1000 * 1000 + 7;
int n, m, g, res;
int GT[MAXN + MAXM];
//---------------------------------------------------------------------
int C(int nn, int kk)
{
    if (nn < kk) return 0;
    if (kk == 0) return 1;
    int temp = (1ll * GT[kk] * GT[nn - kk]) % base;
    temp = Power(temp, base - 2, base);
    temp = (1ll * GT[nn] * temp) % base;
    return temp;
}
//---------------------------------------------------------------------
void DoSth()
{
    res = 0;
    FOR(i, 1, n + 1)
    if (g != i % 2)
        res = (1ll * res + C(n + m - i, n - i + 1)) % base;
    cout << res;
}
//---------------------------------------------------------------------
void ReadInput()
{
    cin >> n >> m >> g;
}
//---------------------------------------------------------------------
void Process()
{
    GT[0] = 1;
    FOR(i, 1, n + m) GT[i] = (1ll * GT[i - 1] * i) % base;
    DoSth();
}
//---------------------------------------------------------------------
int main()
{
    ReadInput();
    if (n == 0){
        if (g == 0) cout << 1;
        else cout << 0;
        return 0;
    }
    else if (m == 0){
        if (n % 2 != g) cout << 1;
        else cout << 0;
        return 0;
    }
    Process();
    return 0;
}

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1000000007;
const int maxn=2e5 + 5;
int n,m,g,ans;
int f[maxn];
int inv[maxn];
int fpow(int x,int y)
{
	int ans=1;
	int base=x;
	while(y)
	{
		if(y&1)
		{
			ans=ans*base%mod;
		}
		base=base*base%mod;
		y>>=1;
	}
	return ans;
}
int C(int x,int y)
{
	return f[x]*inv[x-y] % mod *inv[y] %mod;
}
signed main()
{
	cin>>n>>m>>g;
	if(m==0)
	{
		if(n%2)
		{
			cout<<(g==0 ? 1 : 0);
		}
		else
		{
			cout<<(g==1 ? 1 : 0);
		}
	}
	if(n==0)
	{
		if(m==1)
		{
			cout<<(g==1 ? 1 : 0);
		}
		else
		{
			cout<<(g==0 ? 1 : 0);
		}
	}
	f[0]=1;
	for(int i=1;i<=m+n;i++)
	{
		f[i]=f[i-1]*i;
		f[i]%=mod;
	}
	inv[n+m]=fpow(f[n+m],mod-2);
	for(int i=n+m-1;i>=0;i--)
	{
		inv[i]=inv[i+1]*(i+1)%mod;
	}
	if(g)
	{
		for(int i=1;i<=n;i+=2)
		{
			ans+=C(n+m-i-1,m-1) %mod;
			if(m == 1)
			{
				if(n % 2) ans = (ans - 1 + mod) % mod;
				else ans++;
			}
			ans%=mod;
		}
	}
	else
	{
		for(int i=0;i<=n;i+=2)
		{
			ans+=C(n+m-i-1,m-1) %mod;
			if(m == 1)
			{
				if(n % 2) ans++;
				else ans=(ans-1+mod) %mod;
			}
			ans%=mod;
		}
	}
	cout<<ans%mod;
}

#include<cstdio>
using namespace std;
#define md 1000000007
long long jc[200010],inv[200100];
long long ksm(long long a,long long b)
{
	long long res=1;
	while(b)
	{
		if(b&1)
		{
			res=(res*a)%md;
		}
		b>>=1;
		a=(a*a)%md;
	}
    return res;
}
long long C(int x,int y)
{
	if(x==y) return 1;
	return ((jc[y]*inv[x])%md*inv[y-x])%md;
}
int main()
{
	long long ans=0;
	int n,m,g;
	scanf("%d%d%d",&n,&m,&g);
	if(m==0) {
		if(n&1) if(g==1)

		          printf("0");
		            else printf("1");

			    else {
		        	if(g==1)
		        	  printf("1");
		        	  else printf("0");
				}
		  return 0;
	}
	if(n==0) {
		if(m&1) if(g==1)

		          	printf("1");
		          	   else printf("0");

				  else{
				  	if(g==1) printf("0");
				  	  else printf("1");
				  }
				return 0;
	}
	jc[0]=1;
	inv[0]=1;
	for(int i=1;i<=200001;i++)
	  jc[i]=jc[i-1]*i%md;
	inv[200001]=ksm(jc[200001],md-2);
	for(int i=200000;i>=1;i--)
	  inv[i]=inv[i+1]*(i+1)%md;
	if(g)
	{
		for(int i=1;i<=n;i+=2)
		  {
		  	ans=(ans+C(m-1,n+m-i-1))%md;
		  }
		  if(m==1) if(n&1) ans=(ans-1+md)%md;
		    else ans=(ans+1)%md;
	}
	else{
		for(int i=0;i<=n;i+=2)
		  {
		  	ans=(ans+C(m-1,n+m-i-1))%md;
		  }
		if(m==1) if(n&1) ans=(ans+1)%md;
		   else ans=(ans-1+md)%md;
	}

    printf("%lld",ans);
 }

#include <bits/stdc++.h>

#define int long long

using namespace std;

int mod = 1000000007;
const int maxn = 200005;

int fac[maxn];
int binpow(int a, int b) {
    if (b == 0) return 1;
    if (b % 2 == 1) return (a*binpow(a, b-1))%mod;
    int v = binpow(a, b/2);
    return (v*v)%mod;
}
int inverse(int x) {
    return binpow(x, mod-2);
}
long long C(int n, int k) {
    return fac[n] * inverse(fac[k]) % mod * inverse(fac[n - k]) % mod;
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    fac[0] = 1;
    for (int i = 1; i < maxn; i++) fac[i] = (fac[i-1]*i)%mod;
    int n, m, g;
    cin >> n >> m >> g;
    if (n+m == 1) {
        if (g == 0) {
            if (n == 1) cout << "1\n";
            else cout << "0\n";
        } else {
            if (m == 1) cout << "1\n";
            else cout << "0\n";
        }
    } else if (n+m == 2) {
        if (n == 2) {
            if (g == 1) cout << "1\n";
            else cout << "0\n";
        } else if (m == 2) {
            if (g == 0) cout << "1\n";
            else cout << "0\n";
        } else {
            if (g == 0) cout << "2\n";
            else cout << "0\n";
        }
    } else {
        // find amt of ways to form res = 1. s = 01x
        int res = 0;
        int total = C(n+m, n);
        if (n > 0 && m > 0) {
            n--;
            m--;
            res = C(n+m, m);
        }
        if (g == 0) res = total-res;
        while (res < 0) res += mod;
        cout << res << '\n';
    }
}
/*

 */

// by Balloons
// 为什么别人比你进步的快？ 因为别人比你努力的多！
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)

using namespace std;

typedef long long LL;

const int inf = 1 << 30;
#define int LL

const int maxn=3e5+5,mod=1e9+7;

/*
先讨论 g=0,的情况，g=1同理（C(n+m,n)-(g=0的情况)） 即可
注意到 如果末两位为 10 11 的话，结果都是0
所以我们可以将 1 看做归0符
对于g=0，可以先枚举第一个1的位置，其前面一定有偶数个0（这样得出来的数才是0）
1的后面可以随意排布，记1的前面有2*k的0，那么后面的方案数是C(n+m-2*k-1,m-1)
有两种特殊情况：
1) 只有一个1，那么会出现00001（偶数个0）的情况，答案是1，不符要求，会出现在n为偶数且m=1的情况下
2) 奇数后面跟着一个1（如：0001），答案也是0，但因为1前面有奇数个0，所以没有算进去，会出现在m=1且n为奇数的情况下
感觉自己并不能想出来啊 >_<
*/

int fac[maxn],n,m,g;

void init(){
	fac[0]=1;
	for(int i=1;i<=200000;i++)fac[i]=(fac[i-1]*i)%mod;
}

int ksm(int a,int b){
	if(!b)return 1;
	if(b==1)return a%mod;

	int tmp=ksm(a,b/2);
	if(b&1)return 1ll*tmp*tmp%mod*a%mod;
	return 1ll*tmp*tmp%mod;
}

int C(int x,int y){	// C(x,y)=x!/((x-y)!*y!)
	return fac[x]*ksm((fac[x-y]*fac[y])%mod,mod-2)%mod;
}
void quit(int x){printf("%d\n",x);exit(0);}

// 100000 100000 0
signed main(){
	scanf("%I64d%I64d%I64d",&n,&m,&g);
	if(n==0&&m==0&&g==0)quit(1);
	if(n==0&&m==0&&g==1)quit(0);
	if(n==0&&m==1&&g==0)quit(0);
	if(n==0&&m==1&&g==1)quit(1);
	if(n==1&&m==0&&g==0)quit(1);
	if(n==1&&m==0&&g==1)quit(0);
	if(n==1&&m==1&&g==0)quit(2);	// 10 01
	if(n==1&&m==1&&g==1)quit(0);
	init();
	int all=C(n+m,n)%mod;
	int g0=0;
	for(int i=0;i<=n/2;i++)(g0+=C(n+m-2*i-1,m-1))%=mod;
	int ans=g0%mod;
	if(n%2==0&&m==1)ans=(ans-1+mod)%mod;
	if(n%2&&m==1)ans=(ans+1)%mod;
	if(g==0)printf("%I64d\n",ans%mod);
	else printf("%I64d\n",(all-ans+mod)%mod);

	return 0;
}

#ifdef _MSC_VER
#pragma comment(linker, "/STACK:1024000000,1024000000")
#endif
#include <functional>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;

#define REP(i, n) for (int i=0;i<int(n);++i)
#define FOR(i, a, b) for (int i=int(a);i<int(b);++i)
#define DWN(i, b, a) for (int i=int(b-1);i>=int(a);--i)
#define REP_1(i, n) for (int i=1;i<=int(n);++i)
#define FOR_1(i, a, b) for (int i=int(a);i<=int(b);++i)
#define DWN_1(i, b, a) for (int i=int(b);i>=int(a);--i)
#define REP_C(i, n) for (int n____=int(n),i=0;i<n____;++i)
#define FOR_C(i, a, b) for (int b____=int(b),i=a;i<b____;++i)
#define DWN_C(i, b, a) for (int a____=int(a),i=b-1;i>=a____;--i)
#define REP_N(i, n) for (i=0;i<int(n);++i)
#define FOR_N(i, a, b) for (i=int(a);i<int(b);++i)
#define DWN_N(i, b, a) for (i=int(b-1);i>=int(a);--i)
#define REP_1_C(i, n) for (int n____=int(n),i=1;i<=n____;++i)
#define FOR_1_C(i, a, b) for (int b____=int(b),i=a;i<=b____;++i)
#define DWN_1_C(i, b, a) for (int a____=int(a),i=b;i>=a____;--i)
#define REP_1_N(i, n) for (i=1;i<=int(n);++i)
#define FOR_1_N(i, a, b) for (i=int(a);i<=int(b);++i)
#define DWN_1_N(i, b, a) for (i=int(b);i>=int(a);--i)
#define REP_C_N(i, n) for (int n____=(i=0,int(n));i<n____;++i)
#define FOR_C_N(i, a, b) for (int b____=(i=0,int(b);i<b____;++i)
#define DWN_C_N(i, b, a) for (int a____=(i=b-1,int(a));i>=a____;--i)
#define REP_1_C_N(i, n) for (int n____=(i=1,int(n));i<=n____;++i)
#define FOR_1_C_N(i, a, b) for (int b____=(i=1,int(b);i<=b____;++i)
#define DWN_1_C_N(i, b, a) for (int a____=(i=b,int(a));i>=a____;--i)

#define ECH(it, A) for (__typeof(A.begin()) it=A.begin(); it != A.end(); ++it)
#define REP_S(i, str) for (char*i=str;*i;++i)
#define REP_L(i, hd, nxt) for (int i=hd;i;i=nxt[i])
#define REP_G(i, u) REP_L(i,hd[u],suc)
#define REP_SS(x, s) for (int x=s;x;x=(x-1)&s)
#define DO(n) for ( int ____n ## __line__ = n; ____n ## __line__ -- ; )
#define REP_2(i, j, n, m) REP(i, n) REP(j, m)
#define REP_2_1(i, j, n, m) REP_1(i, n) REP_1(j, m)
#define REP_3(i, j, k, n, m, l) REP(i, n) REP(j, m) REP(k, l)
#define REP_3_1(i, j, k, n, m, l) REP_1(i, n) REP_1(j, m) REP_1(k, l)
#define REP_4(i, j, k, ii, n, m, l, nn) REP(i, n) REP(j, m) REP(k, l) REP(ii, nn)
#define REP_4_1(i, j, k, ii, n, m, l, nn) REP_1(i, n) REP_1(j, m) REP_1(k, l) REP_1(ii, nn)

#define ALL(A) A.begin(), A.end()
#define BSC(A, x) (lower_bound(ALL(A), x) - A.begin())
#define CTN(T, x) (T.find(x) != T.end())
#define SZ(A) int(A.size())
#define PB push_back
#define MP(A, B) make_pair(A, B)
#define fi first
#define se second
#define Rush for(int ____T=(scanf("%d",&____T),____T), ____cas=0;++____cas, ____T--;)

typedef long long LL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<string> VS;
typedef vector<LL> VL;
typedef vector<double> VD;
typedef set<int> SI;
typedef set<string> SS;
typedef map<int, int> MII;
typedef map<string, int> MSI;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef vector<VII> VVII;
template<class T> inline void RST(T &A){memset(A, 0, sizeof(A));}
template<class T> inline void FLC(T &A, int x){memset(A, x, sizeof(A));}
template<class T> inline void CLR(T &A){A.clear();}

/** Constant List .. **/ //{
const int dx4[] = {-1, 0, 1, 0};
const int dy4[] = {0, 1, 0, -1};
const int dx8[] = {-1, 0, 1, 0 , -1 , -1 , 1 , 1};
const int dy8[] = {0, 1, 0, -1 , -1 , 1 , -1 , 1};
const int dxhorse[] = {-2 , -2 , -1 , -1 , 1 , 1 , 2 , 2};
const int dyhorse[] = {1 ,  -1 , 2  , -2 , 2 ,-2 , 1 ,-1};
const int mod = 1000000007;
//int mod = 99990001;
const int inf = 0x3f3f3f3f;
const LL inff = 1LL << 60;
const double eps = 1e-9;
const double oo = 1e25;
const double pi = acos(-1.0); //M_PI;
//}
/** Add On .. **/ //{
// <<= '0. Nichi Joo ., //{
template<class T> inline void checkMin(T &a,const T b){if (b<a) a=b;}
template<class T> inline void checkMax(T &a,const T b){if (a<b) a=b;}
template<class T> inline void checkMin(T &a, T &b, const T x){checkMin(a, x), checkMin(b, x);}
template<class T> inline void checkMax(T &a, T &b, const T x){checkMax(a, x), checkMax(b, x);}
template <class T, class C> inline void checkMin(T& a, const T b, C c){if (c(b,a)) a = b;}
template <class T, class C> inline void checkMax(T& a, const T b, C c){if (c(a,b)) a = b;}
template<class T> inline T min(T a, T b, T c){return min(min(a, b), c);}
template<class T> inline T max(T a, T b, T c){return max(max(a, b), c);}
template<class T> inline T min(T a, T b, T c, T d){return min(min(a, b), min(c, d));}
template<class T> inline T max(T a, T b, T c, T d){return max(max(a, b), max(c, d));}
template<class T> inline T sqr(T a){return a*a;}
template<class T> inline T cub(T a){return a*a*a;}
template<class T> inline T ceil(T x, T y){return (x - 1) / y + 1;}
inline int sgn(double x){return x < -eps ? -1 : x > eps;}
inline int sgn(double x, double y){return sgn(x - y);}
inline double cot(double x){return 1./tan(x);};
inline double sec(double x){return 1./cos(x);};
inline double csc(double x){return 1./sin(x);};
//}
// <<= '1. Bitwise Operation ., //{
namespace BO{
inline bool _1(int x, int i){return bool(x&1<<i);}
inline bool _1(LL x, int i){return bool(x&1LL<<i);}
inline LL _1(int i){return 1LL<<i;}
inline LL _U(int i){return _1(i) - 1;};
inline int reverse_bits(int x){x = ((x >> 1) & 0x55555555) | ((x << 1) & 0xaaaaaaaa);x = ((x >> 2) & 0x33333333) | ((x << 2) & 0xcccccccc);x = ((x >> 4) & 0x0f0f0f0f) | ((x << 4) & 0xf0f0f0f0);x = ((x >> 8) & 0x00ff00ff) | ((x << 8) & 0xff00ff00);x = ((x >>16) & 0x0000ffff) | ((x <<16) & 0xffff0000);return x;}
inline LL reverse_bits(LL x){x = ((x >> 1) & 0x5555555555555555LL) | ((x << 1) & 0xaaaaaaaaaaaaaaaaLL);x = ((x >> 2) & 0x3333333333333333LL) | ((x << 2) & 0xccccccccccccccccLL);x = ((x >> 4) & 0x0f0f0f0f0f0f0f0fLL) | ((x << 4) & 0xf0f0f0f0f0f0f0f0LL);x = ((x >> 8) & 0x00ff00ff00ff00ffLL) | ((x << 8) & 0xff00ff00ff00ff00LL);x = ((x >>16) & 0x0000ffff0000ffffLL) | ((x <<16) & 0xffff0000ffff0000LL);x = ((x >>32) & 0x00000000ffffffffLL) | ((x <<32) & 0xffffffff00000000LL);return x;}
template<class T> inline bool odd(T x){return x&1;}
template<class T> inline bool even(T x){return !odd(x);}
template<class T> inline T low_bit(T x) {return x & -x;}
template<class T> inline T high_bit(T x) {T p = low_bit(x);while (p != x) x -= p, p = low_bit(x);return p;}
template<class T> inline T cover_bit(T x){T p = 1; while (p < x) p <<= 1;return p;}
template<class T> inline int cover_idx(T x){int p = 0; while (_1(p) < x ) ++p; return p;}
#ifdef __GNUC__
inline int clz(int x){return __builtin_clz(x);}
inline int clz(LL x){return __builtin_clzll(x);}
inline int ctz(int x){return __builtin_ctz(x);}
inline int ctz(LL x){return __builtin_ctzll(x);}
inline int lg2(int x){return !x ? -1 : 31 - clz(x);}
inline int lg2(LL x){return !x ? -1 : 63 - clz(x);}
inline int low_idx(int x){return !x ? -1 : ctz(x);}
inline int low_idx(LL x){return !x ? -1 : ctz(x);}
inline int high_idx(int x){return lg2(x);}
inline int high_idx(LL x){return lg2(x);}
inline int parity(int x){return __builtin_parity(x);}
inline int parity(LL x){return __builtin_parityll(x);}
inline int count_bits(int x){return __builtin_popcount(x);}
inline int count_bits(LL x){return __builtin_popcountll(x);}
#endif
} using namespace BO;//}
// <<= '2. Number Theory .,//{
namespace NT{
template<class T> inline T lowbit(T x) {return x & -x;}///lowbit(x)
template <class T>inline T GCD(T A,T B){T C;while(B!=0)C=B,B=A%B,A=C;return A;}///GCD(a,b)
template <class T>inline T LCM(T A,T B){return A*(B/GCD(A,B));}///LCM(a,b)
template<class T>inline T Mod(T a,T b){a%=b;return a<0?a+b:a;}///计算a%b,支持a<=0
template<class T>inline T MulMod(T a,T b,T c)/**二分计算a*b mod c 可以处理c+c不溢出的情况*/{if(c==1)return 0;if(c<=0)return -1;T ret=0,tmp;tmp=a=Mod(a,c);b=Mod(b,c);while(b){if(b&0x1)if((ret+=tmp)>=c)ret-=c;if((tmp<<=1)>=c)tmp-=c;b>>=1;}return ret;}
template<class T,class Tb> inline T PowMod(Tb a,T b,T c)/**a^b mod c 要求c*c不溢出*/{if(c==1)return 0;if(c<=0)return -1;a=Mod(a,(Tb)c);Tb ret(1L%c);while(b){if(b&0x1)ret=ret*a%c;a=a*a%c;b>>=1;}return (T)ret;}
template<class T> inline T HPowMod(T a,T b,T c)/**二分计算a^b mod c 要求c+c不溢出*/{if(c==1)return 0;if(c<=0)return -1;a=Mod(a,c);T ret(1L%c);while(b){if(b&0x1)ret=MulMod(ret,a,c);a=MulMod(a,a,c);b>>=1;}return ret;}
template<class T,class Tb> inline T Pow(T a, Tb b)/**a^b*/{T c(1); while (b){if (b&1) c *= a;a *= a, b >>= 1;}return c;}
template <class T>inline T EXT_GCD(T a,T b,T& x,T& y)/**ax+by=gcd(a,b)*/{T t,ret;if (!b){x=1,y=0;return a;}ret=EXT_GCD(b,a%b,x,y);t=x,x=y,y=t-a/b*y;return ret;}
template <class T>inline T Inv(T a,T n)/**返回一个数a对于n的乘法逆元*/{if(n<=0)return -1;T d,x,y;d=EXT_GCD(a,n,x,y);if(d!=1)return -1;return Mod(x,n);}
template<class T, int MAXN, T MOD=-1>class Matrix/**Matrix*/ {public:T m[MAXN][MAXN];Matrix(){}void init(T num[MAXN][MAXN]){for(int i = 0 ; i < MAXN ; i++){for(int j = 0 ; j < MAXN ; j++){m[i][j] = num[i][j];if (MOD!=-1)  m[i][j] %= MOD;}}}
friend Matrix operator*(const Matrix &m1 ,const Matrix &m2) {int i, j, k;Matrix ret;memset(ret.m, 0, sizeof(ret.m));for (i = 0; i < MAXN; i++) {for (j = 0; j < MAXN; j++)if ( m1.m[i][j] ){for(k = 0 ; k < MAXN ; k++){ret.m[i][k] += m1.m[i][j] * m2.m[j][k];if (MOD!=-1) ret.m[i][k] %= MOD;}}}return ret;}
friend Matrix operator+(const Matrix &m1 ,const Matrix &m2) {int i, j;Matrix ret;for (i = 0; i < MAXN; i++) {for (j = 0; j < MAXN; j++) {ret.m[i][j] = 0;ret.m[i][j] = m1.m[i][j]+m2.m[i][j];if (MOD!=-1)  ret.m[i][j] %= MOD;}}return ret;}
friend Matrix operator^(const Matrix &_M , LL nx){Matrix ret,M(_M);for(int i = 0 ; i < MAXN ; i++){for(int j = 0 ; j < MAXN ; j++){if(i == j)ret.m[i][j] = 1;else ret.m[i][j] = 0;}}while(nx){if(nx & 1)ret = ret * M;nx = nx >> 1;M = M * M;}return ret;}
};///end of matrix
const int PMAX = 1000;VI Prime; bitset<PMAX> isnotPrime;///Prime:sieve(),phi(),
void sieve(){if (!Prime.empty()) return ;FOR(i, 2, PMAX){if (!isnotPrime[i]) Prime.PB(i);for (int j=0;j<SZ(Prime)&&i*Prime[j]<PMAX;++j){isnotPrime[i*Prime[j]]=1; if (!(i%Prime[j])) break;}}}
inline bool isPrime(int n){return !isnotPrime[n];}
template<class T>T phi(T n){T ret=1,i;for (i=2;i*i<=n;i++)if (n%i==0){n/=i,ret*=i-1;while (n%i==0)n/=i,ret*=i;}if (n>1)ret*=n-1;return ret;}

} using namespace NT;//}

// <<= '3. Date .,//{
namespace Date{
int days[12]={31,28,31,30,31,30,31,31,30,31,30,31};
struct date{int year,month,day;};
inline int leap(int year)/**判闰年**/{return (year%4==0&&year%100!=0)||year%400==0;}
inline int legal(date a)/**判合法性**/{if (a.month<0||a.month>12) return 0;if (a.month==2)return a.day>0&&a.day<=28+leap(a.year);return a.day>0&&a.day<=days[a.month-1];}
inline int datecmp(date a,date b)/**比较日期大小**/{if (a.year!=b.year)return a.year-b.year;if (a.month!=b.month)return a.month-b.month;return a.day-b.day;}
int weekday(date a)/**返回指定日期是星期几**/{int tm=a.month>=3?(a.month-2):(a.month+10);int ty=a.month>=3?a.year:(a.year-1);return (ty+ty/4-ty/100+ty/400+(int)(2.6*tm-0.2)+a.day)%7;}
int date2int(date a)/**日期转天数偏移**/{int ret=a.year*365+(a.year-1)/4-(a.year-1)/100+(a.year-1)/400,i;days[1]+=leap(a.year);for (i=0;i<a.month-1;ret+=days[i++]);days[1]=28;return ret+a.day;}
date int2date(int a)/**天数偏移转日期**/{date ret;ret.year=a/146097*400;for (a%=146097;a>=365+leap(ret.year);a-=365+leap(ret.year),ret.year++);days[1]+=leap(ret.year);for (ret.month=1;a>=days[ret.month-1];a-=days[ret.month-1],ret.month++);days[1]=28;ret.day=a+1;return ret;}
}//using namespace Date;//}

//}
/*************************密封线****************************************/
const int N = 200100;
//int dp[N][N][2];
int q[N],fact[N];
inline int C(int n, int k){
    if (n<k || n<0 || k<0) return 0;
    LL ret = fact[n];
    ret = ret * Inv(fact[k], mod) % mod;
    ret = ret * Inv(fact[n-k], mod) % mod;
    return ret;
}
int main(){
    int i,j,k,n,m,g;
    LL s=0;
    q[0] = 1;
    for (i=1; i<N; i++) q[i] = (q[i-1]*2)%mod;
    fact[0] = 1;
    for (i=1; i<N; i++) fact[i] = ((LL)fact[i-1]*i)%mod;

    cin>>n>>m>>g;
    if (n+m==1){
        puts("1");
        return 0;
    }

    if (m==0){
        s = (bool)(n&1)!=0;
        cout<<s<<endl;
        return 0;
    }
    if (n==0){
        s = (g==0);
        cout<<s<<endl;
        return 0;
    }

    for (i=0; i<=n; i++)
    {
        if ( m==1 && n==i ){
            if ( (bool)(i&1) != g  ) s+=1;
            continue;
        }
        if ( (bool)(i&1) != g ) continue;
        s += C(n+m-1-i, n-i);
        s %= mod;
    }
    cout<<s<<endl;

    return 0;
}
/*************************密封线****************************************/

#include <iostream>
#include <vector>
#include <string>
#include <fstream>
#include <set>

using namespace std;

int mod = 1e9 + 7;
vector <long long int> fact(1e6, 1);

inline long long bpow(long long v, int power) {
        if (power == 0) return 1;
        if ((power & 1) == 0) {
                long long r = bpow(v, power >> 1);
                return (r * r) % mod;
        }
        return (bpow(v, power - 1) * v) % mod;
}

inline int getC(int n, int k) {
    if (n < k)
        return 0;
        long long nom = fact[n];
        long long den = (fact[n-k] * fact[k]) % mod;
        return (nom * bpow(den, mod - 2)) % mod;
}

int main()
{
    long long answer = 0;
    int n, m, g;
    cin >> n >> m >> g;
    for (int i = 1; i < 1e6; ++i)
    {
        fact[i] = (fact[i - 1] * i) % mod;
    }
    if (m == 0)
    {
        if ((n + m) % 2 == 0 && g == 1)
        {
            cout << "1" << endl;
        return 0;
        }
        else if ((n + m) % 2 == 1 && g == 0)
        {
            cout << "1" << endl;
        return 0;
        }
        else
        {
            cout << "0" << endl;
        return 0;
        }
    }
    else if (n == 0 && g == 0)
    {
        cout << "1" << endl;
        return 0;
    }
    else if (n == 0 && g == 1)
    {
        cout << "0" << endl;
        return 0;
    }
    for (int i = 0; i < n + m - 1; i++)
    {
        if ((i % 2 == 0 && g == 0))
        {
            //cout << "LOL1" << endl;
            answer += getC(n + m - i - 1, m - 1);
        }
        else if ((i % 2 == 1 && g == 1))
        {
            //cout << "LOL2" << endl;
            answer += getC(n + m - i - 1, m - 1);
        }
        answer %= mod;
    }
    if ((m + n - 1) % 2 == 0 && g == 1 && m == 1)
    {
        answer++;
    }
    else if ((m + n - 1) % 2 == 1 && g == 0 && m == 1)
    {
        answer++;
    }
    cout << answer % mod;
    return 0;
}

#include<cstdio>
#define LL long long
#define N 100000
#define M 1000000007LL
LL f[2*N+1],fi[2*N+1];

void gcdEx(LL a, LL b, LL& x, LL& y, LL& g)
{
	if (!b) { x = 1; y = 0; g = a; return; }
    	gcdEx(b, a%b, x, y, g);
    	LL x1 = y;
    	LL y1 = x-(a/b)*y;
    	x = x1;
    	y = y1;
}

LL inverse(LL a, LL mod){
	LL x,y,g;
	gcdEx(a,mod,x,y,g);
	return  (x+mod)%mod;
}

void calc(){
	f[0]=fi[0]=1;
	for(int i=1;i<=2*N;++i)
		f[i]=(i*f[i-1])%M, fi[i]=(inverse(i,M)*fi[i-1])%M;
}
LL mod(LL v){
	return v%M;
}
int main(){
	calc();
	int z,o,d;scanf("%d%d%d",&z,&o,&d);
	LL ans=0;
	while(1){
		//want 1
		if(d){
			if(z)
				d=0,--z;
			else{
				ans=mod(ans+(o==1));
				break;
			}
		}
		//want 0

		// 1
		if(o && (o-1+z) ){
				ans+=mod(mod(f[o-1+z]*fi[o-1])*fi[z]);
				ans%=M;
		}
		// 0
		if(z){
			--z,d=1;
		}else
			break;
	}
	printf("%d\n",(int)ans);
	return 0;
}

#include <bits/stdc++.h>
#define msg(x) cout << #x << " = " << (x) << endl
using namespace std;

const int mod = 1000000007;
const int maxN = 200555;

int power(int base, int expo) {
    int res = 1;
    while (expo > 0) {
        if (expo & 1) res = 1LL * res * base % mod;
        base = 1LL * base * base % mod;
        expo >>= 1;
    }
    return res;
}

inline int inverse(int x) {
    return power(x, mod - 2);
}

int n, m, g;
int f[maxN];

int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin >> n >> m >> g;
    if (m == 0) {
        n %= 2;
        cout << (g ^ n) << endl;
        return 0;
    }
    if (n == 0) {
        int ss;
        if (m > 1) {
            ss = 0;
        } else {
            ss = 1;
        }
        if (g == ss) {
            cout << 1 << endl;
        } else {
            cout << 0 << endl;
        }
        return 0;
    }
    f[0] = 1;
    for (int i = 1; i < maxN; i++) {
        f[i] = 1LL * i * f[i - 1] % mod;
    }
    int cnt1 = 0;
    for (int i = 1; i <= n; i++) {
        if (i % 2 == 0) continue;
        if (n + m - i - 1 == 0) continue;
        cnt1 += 1LL * f[n + m - i - 1] * inverse(f[n - i]) % mod * inverse(f[m - 1]) % mod;
        cnt1 %= mod;
    }
    int cnttot = 1LL * f[n + m] * inverse(f[m]) % mod * inverse(f[n]) % mod;
    int ans;
    if (g == 0) {
        ans = cnttot - cnt1;
    } else {
        ans = cnt1;
    }
    if (ans < 0) ans += mod;
    cout << ans << endl;
    return 0;
}

#include <stdio.h>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <string.h>
#include <string>
#include <math.h>
#define MOD 1000000007
using namespace std;
//d[minus+j][j]=c[minus+j-1][j]+d[minus+j-2][j-2];
long long fact[200010];
long long fast_pow(long long a,int p)
{
	long long t=a,ret=1;
	while(p)
	{
		if(p&1)
			ret=(ret*t)%MOD;
		t=(t*t)%MOD;
		p>>=1;
	}
	return ret;
}
long long rev(long long a,int b)
{
	return fast_pow(a,b-2);
}
long long C(int a,int b)
{
	return (fact[b]*rev((fact[b-a]*fact[a])%MOD,MOD))%MOD;
}
int solve(int n,int m)
{
	long long f=0;
	if(m==0)
		return n%2;
	if(n==0)
		return (m+1)%2;
	for(int i=n+m; i>=m; i-=2)
	{
		f=(f+C(m-1,i-1))%MOD;
		//printf("  %I64d\n",f);
	}
	if(m==1)
		f++;
	return (int)f;
}
int main()
{
	fact[0]=1;
	for(long long i=1; i<=200000; i++)
		fact[i]=(fact[i-1]*i)%MOD;
	int n,m,g;
	scanf("%d%d%d",&n,&m,&g);
	if(g==0)
		printf("%d\n",(solve(n,m)%MOD+MOD)%MOD);
	else
	{
		if(n==0)
			printf("0\n");
		else
			printf("%d\n",(solve(n-1,m)%MOD+MOD)%MOD);
	}
	return 0;
}

#include <bits/stdc++.h>
#define maxn 200010
#define INF 0x3f3f3f3f
typedef long long ll;
using namespace std;
const ll mod = 1e9+7;
ll fac[maxn], inv[maxn];
void init(){
    fac[0] = inv[0] = inv[1] = 1;
    for(ll i=1;i<maxn;i++) fac[i] = fac[i-1]*i%mod;
    for(ll i=2;i<maxn;i++)inv[i]=mod-(ll)(mod/i)*inv[mod%i]%mod;
    for(ll i=1;i<maxn;i++)inv[i]=(ll)inv[i-1]*inv[i]%mod;
}
ll c(ll a,ll b){
    return fac[a]*inv[b]%mod*inv[a-b]%mod;
}
int main(){
    ll n, m, q, ans = 0, g;
    scanf("%lld%lld%lld", &n, &m, &g);
    init();
    if(n == 0){
        if(n == 1) printf("%d\n", g);
        else printf("%d\n", !g);
    }
    else if(m == 0){
        if(n%2) printf("0\n");
        else printf("%d\n", g);
    }
    else{
        for(ll i=1;i<=n;i+=2)
            if(n+m-i-1 != 0)
            ans = (ans+c(n+m-i-1, m-1))%mod;
        if(m == 1&&n%2 == 0) ans++;
        printf("%lld\n", g?((ans+mod)%mod):((c(n+m, n)-ans+mod)%mod));
    }
    return 0;
}

#include <cstdlib>
#include <cstring>
#include <memory>
#include <cstdio>
#include <fstream>
#include <iostream>
#include <cmath>
#include <string>
#include <sstream>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
using namespace std;

typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)

#define FOR(x,to) for(x=0;x<to;x++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ZERO(a) memset(a,0,sizeof(a))
void _fill_int(int* p,int val,int rep) {int i;  FOR(i,rep) p[i]=val;}
#define FILL_INT(a,val) _fill_int((int*)a,val,sizeof(a)/4)
#define MINUS(a) _fill_int((int*)a,-1,sizeof(a)/4)
ll GETi() { ll i;scanf("%lld",&i); return i;}
//-------------------------------------------------------

int N,M,G;
ll mo=1000000007;
vector<ll> rev;

vector<ll> list_mod_inverse(ll n, ll m) {
    vector<ll> inv(n + 1);
    inv[1] = 1;
    for (int i=2;i<=n;++i) inv[i] = inv[m % i] * (m - m / i) % m;
    return inv;
}

ll get_p0(int n,int m) {
    ll r=0,t=1,i;
    n+=m;
    FOR(i,m) t = (t*(n-i) % mo) *rev[i+1] % mo;
    r=t;
    while(n>m+1) {
        t= t*rev[n]%mo;
        t= t*rev[n-1]%mo;
        t= t*(n-m)%mo;
        t= t*(n-m-1)%mo;
        r = (r+t) % mo;
        n-=2;
    }

    return r;

}

void solve() {
    int f,i,j,k,l, x,y;
    ll r=0;

    cin>>N>>M>>G;

    if(M==0) {
        cout << ((N%2)!=G) << endl;
        return;
    }
    if(N==0) {
        if(M==1) cout << G << endl;
        else cout << 1-G << endl;
        return;
    }

    rev = list_mod_inverse(200001,mo);

    ll ret=get_p0(N,M-1);

    if(N%2==0) ret = (ret + 0) % mo;
    else ret = (ret + M + (M%2)) % mo;

    if(G==1) {
        ll tot=1;
        // C[N+M][M]
        FOR(i,M) tot=(tot*(N+M-i) % mo) *rev[i+1]%mo;
        ret = (mo+tot-ret)%mo;
    }
    cout << ret << endl;

    return;
}

int main(int argc,char** argv){
    if(argc>1) freopen(argv[1], "r", stdin);
    solve();
    return 0;
}

#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <queue>
#include <list>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <sstream>

#define mp make_pair
#define pb push_back

using namespace std;

typedef int i;
typedef long long ll;

typedef double d;
typedef long double ld;

typedef pair<int, int> pii;
typedef vector<int> vi;

typedef vector <vector<int> > graph;

ll F[2 * 100 * 1000];
ll MOD = 1000 * 1000 * 1000 + 7;
ll ANS = 0;

ll POW(ll a, ll b)
{
	if (b == 1)
		return a % MOD;
	if (b % 2 == 0)
	{
		ll tmp = POW(a, b / 2);
		tmp *= tmp;
		return tmp % MOD;
	}
	else
		return (POW(a, b - 1) * a) % MOD;
}

ll inv(ll a)
{
	return POW(a, MOD - 2);
}

ll C(ll n, ll k)
{
	return ((F[n]) * inv((F[k] * F[n - k]) % MOD)) % MOD;
}

void print(int a)
{
	cout << a << endl;
}

int main()
{
	ios_base::sync_with_stdio(0);
	F[0] = 1;
	for (int i = 1; i < 2 * 100 * 1000; i++)
		F[i] = (F[i - 1] * i) % MOD;
	int n, m, g, L;
	cin >> n >> m >> g;
	L = n + m;
	if (m == 0)
	{
		if ((g + 1) % 2 == n % 2)
			print(0);
		else
			print(1);
		exit(0);
	}
	if (n == 0)
	{
		print(0);
		exit(0);
	}
	if (L == 2)
	{
		if (g == 0)
			print(2);
		else
			print(0);
		exit(0);
	}
	for (int i = 0; i <= n; i++)
	{
		if (L - i - 1 > 0)
		{
			if (i % 2 == g)
				ANS += C(L - i - 1, m - 1);
		}
		else
			if (i % 2 == (g + 1) % 2)
				ANS += C(L - i - 1, m - 1);
	}
	print(ANS % MOD);
	#ifdef HOME
		cerr << "\ntime = " << clock() / 1000 << " ms\n";
	#endif
	return 0;
}

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#include<cstdlib>
#include<utility>
#include<cctype>
#include<cstring>
#include<cmath>
#include<iomanip>
#include<stack>
#include<map>
#include<set>

#define  ll     long long
#define  pp     pair<ll,ll>
#define  ppp    pair<pp,int>
#define  pb     push_back
#define  mp     make_pair
#define  mod    1000000007
#define  fi     first
#define  se     second
#define  fr     front()

using namespace std;

ll POW(ll n, ll p) {
    if (p == 0) return 1;
    ll t = POW(n, p / 2);
    if (p & 1) return n * t * t;
    return t * t;
}

ll POW_MOD(ll n, ll p, ll M) {
    if (p == 0) return 1;
    ll t = POW_MOD(n, p / 2,M);
    if (p & 1) return ((((n % M) * (t % M)) % M) * (t % M)) % M;
    return ((t % M) * (t % M)) % M;
}

ll ans,store[200005];

int main()
{
   ll n,m,g,i;

   cin>>m>>n>>g;

   if(n == 1 && m == 1)
   {
        if(g == 0)
        cout<<2<<endl;
        else
        cout<<0<<endl;
        return 0;
   }
   if(n == 0 && g == 0)
   {
       if(m%2==1)
       cout<<1<<endl;
       else
       cout<<0<<endl;
       return 0;
   }
   if(n == 1 && g == 1)
   {
        cout<<m/2 + 1<<endl;
        return 0;
   }
   if(n == 0 && g == 1)
   {
        if(m%2 == 0)
        cout<<1<<endl;
        else
        cout<<0<<endl;
        return 0;
   }
   if(m == 0)
   {
       if(g == 0)
       cout<<1<<endl;
       else
       cout<<0<<endl;
       return 0;
   }
   if( n == 1 && g == 0)
   {
       cout<<m/2<<endl;
       return 0;
   }

   store[0]=1;

   for(i=1;i<200001;i++)
   store[i]=(store[i-1]*i)%mod;

   for(i=1;i<=n+m;i++)
   {
      if(m-i+1 >= 0 && n > 0 && g==0 && i%2 == 1)
      ans=(ans+(store[n+m-i]*POW_MOD((store[n-1]*store[m-i+1])%mod,mod-2,mod))%mod)%mod;

      else if(m-i+1 >= 0 && n > 0 && g==1 && i%2 == 0)
      ans=(ans+(store[n+m-i]*POW_MOD((store[n-1]*store[m-i+1])%mod,mod-2,mod))%mod)%mod;

   }

   cout<<ans<<endl;

  // system("pause");

   return 0;
}

#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <queue>
#include <list>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <sstream>

#define mp make_pair
#define pb push_back

using namespace std;

typedef int i;
typedef long long ll;

typedef double d;
typedef long double ld;

typedef pair<int, int> pii;
typedef vector<int> vi;

typedef vector <vector<int> > graph;

ll F[2 * 100 * 1000];
ll MOD = 1000 * 1000 * 1000 + 7;
ll ANS = 0;

ll POW(ll a, ll b)
{
	if (b == 1)
		return a % MOD;
	if (b % 2 == 0)
	{
		ll tmp = POW(a, b / 2);
		tmp *= tmp;
		return tmp % MOD;
	}
	else
		return (POW(a, b - 1) * a) % MOD;
}

ll inv(ll a)
{
	return POW(a, MOD - 2);
}

ll C(ll n, ll k)
{
	return ((F[n]) * inv((F[k] * F[n - k]) % MOD)) % MOD;
}

void print(int a)
{
	cout << a << endl;
}

int main()
{
	ios_base::sync_with_stdio(0);
	F[0] = 1;
	for (int i = 1; i < 2 * 100 * 1000; i++)
		F[i] = (F[i - 1] * i) % MOD;
	int n, m, g, L;
	cin >> n >> m >> g;
	L = n + m;
	if (m == 0)
	{
		if ((g + 2) % 2 == n % 2)
			print(0);
		else
			print(1);
		exit(0);
	}
	if (n == 0)
	{
		if ((g + 1) % 2 == m % 2)
			print(0);
		else
			print(1);
		exit(0);
	}
	if (L == 2)
	{
		if (g == 0)
			print(2);
		else
			print(0);
		exit(0);
	}
	for (int i = 0; i <= n; i++)
	{
		if (L - i - 1 > 0)
		{
			if (i % 2 == g)
				ANS += C(L - i - 1, m - 1);
		}
		else
			if (i % 2 == (g + 1) % 2)
				ANS += C(L - i - 1, m - 1);
	}
	print(ANS % MOD);
	#ifdef HOME
		cerr << "\ntime = " << clock() / 1000 << " ms\n";
	#endif
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define MOD 1000000007
int len;
#define MAXI 2*100000
map< pair<int,int> , LL > dp;
LL F[MAXI+10];
LL P[MAXI+10];
#define offset 10
LL PowMod(LL N,LL P)
{
	if(P==0)
		return 1;
	LL Res = PowMod(N,P/2);
	Res = (Res*Res)%MOD;
	if(P&1)
		return (Res*N)%MOD;
	return Res;
}
void Preprocess()
{
	F[0] = 1;
	for(int i = 1;i<=MAXI;i++)
		F[i] = (F[i-1]*i)%MOD;
	for(int i = 0;i<=MAXI;i++)
		P[i] = PowMod(F[i],MOD-2);
}
LL C(LL N,LL R)
{
	if(N<R)
		return 0;
	if(N==0||R==0)
		return 1;
	return ((F[N]*P[N-R])%MOD*P[R])%MOD;
}
LL calc(int zeros,int ones)
{
	LL &Res = dp[make_pair(zeros,ones)];
	if(Res==0)
	{
		Res = offset;
		if(ones==1&&zeros==1)
			Res+=2;
		else
		{
			if(ones+zeros>=2)
				Res+=C(zeros+ones-1,zeros);
			if(zeros>=2)
				Res+=calc(zeros-2,ones);
		}
		Res%=MOD;
	}
	return (Res - offset + MOD)%MOD;
}
int main()
{
	Preprocess();
	int zeros,ones,req;
	cin>>zeros>>ones>>req;
	LL Res = calc(zeros,ones);
	if(req)
		Res = (C(zeros+ones,zeros) - Res + MOD)%MOD;
	cout<<Res<<endl;
	return 0;
}

#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <limits.h>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <assert.h>
#include <cstring>
using namespace std;
#define rep(i, n) for (int (i) = 0, j123 = n; (i) < j123; (i) ++)
#define rep1(i, n) for (int (i) = 1, j123 = n; (i) <= j123; (i) ++)
#define db(x) {cout << #x << " = " << (x) << endl;}
#define dba(a, x, y) {cout << #a << " :";for(int i123=(x);i123<=(y);i123++) cout<<setw(4)<<(a)[i123];cout<<endl;}
#define clr(x) memset(x,0,sizeof(x));
#define mp make_pair
#define pb push_back
#define sz(x) int(x.size())
#define endl '\n'
typedef long long ll;
typedef long double ld;
const int INF = INT_MAX;
const ll INFL = LLONG_MAX;
const ld pi = acos(-1);
const int MOD = 1e9+7;

inline int add(int& a, int b)
{
  a += b;
  if (a >= MOD) a -= MOD;
  return a;
}
int N, M, G;
int inv[200100];
int fac[200100];
int inverse(int a)
{
  if (a == 1) return 1;
  return int(((MOD-MOD/a) * 1LL * inverse(MOD%a)) % MOD);
}
int comb(int n, int k)
{
//  cout << n << " : " << k << endl;
  if (k == n || k == 0)
    return 1;
  return int( ( (fac[n] * 1LL * inverse(fac[n-k])) % MOD) * inverse(fac[k]) % MOD );
}
int init()
{
  fac[0] = 1;
  for (int i = 1; i <= 200100 - 100; i++)
  {
//    inv[i] = inverse(i);
    fac[i] = int((i * 1LL * fac[i-1]) % MOD);
  }
}
int main()
{
  ios_base::sync_with_stdio(0); cout.precision(15); cout << fixed; cout.tie(0);
  cin >> N >> M >> G;
  if (N == 0 && (M&1) == 1 && G == 1)
  {
    cout << 1 << endl;
    return 0;
  }
  init();
  if (G == 1)
  {
    N --;
    G = 0;
  }
  if (N < 0)
  {
    cout << 0 << endl;
    return 0;
  }
  if (M == 1)
  {
    int ans = 0;
    if (N&1) ans++;
    for (int n = 0; n < N; n+=2)
        ans++;
    cout << ans << endl;
    return 0;
  }
  if (M == 0)
  {
    if (N&1)
      cout << 1 << endl;
    else
      cout << 0 << endl;
    return 0;
  }
  // even number of 0's
  int ans = 0;
//  db(N);
//  db(M);
  for (int numzero = 0; numzero <= N; numzero+=2)
  {
    add(ans, comb(N+M-numzero-1,M-1) );
//    cout << N+M-numzero-1 << " " << M-1 << endl;
  }
  cout << ans << endl;
  return 0;
}

#include<iostream>
#define M 1000000009
#define llu long long int
using namespace std;
llu f[200002],inf[200002],n,m,g,i;
llu pow(llu a,llu b)
{
    llu ans=1,y=a;
    while(b!=0)
    {
        if(b%2)ans=(ans*y)%M;
        b=b/2;
        y=(y*y)%M;
    }
    return ans;
}
int main()
{
    f[0]=1;inf[0]=1;
    for(i=1;i<=200000;i++)
    {
        f[i]=f[i-1]*i;
        inf[i]=pow(f[i],M-2);
    }
    cin>>n>>m>>g;
    llu ans=0;
    for(i=0;i<n;i++)
    {
        llu a=0;
        if((m-1)>=0)a=(((f[n-i+m-1]*inf[m-1])%M)*inf[n-i])%M;
        //cout<<f[n-i]<<inf[m-1]<<inf[n-i-m+1]<<endl;
        if((i%2)==g)ans=(ans+a)%M;
       // cout<<a<<ans<<endl;
    }
    if(n%2!=g && m==1)ans=(ans+1)%M;
    if(n%2==g && m>1)ans=(ans+1)%M;
    cout<<ans<<endl;
}

#include <cstdio>
#include <iostream>

using namespace std;

typedef long long ll;
const ll MOD = 1000000007;
// 00001...
// 00000
// 0001
// 000
// 01
// 0
//
// 000001...
// 000000
// 00001
// 0000
// 001
// 00
// 1

const int MAXN = 200100;

int N, M, K;
ll fact[MAXN];
ll pow(int x, int p) {
  if (p == 0) return 1;
  ll k = pow(x, p / 2);
  (k *= k) %= MOD;
  if (p & 1) (k *= x) %= MOD;
  return k;
}

ll inv(int x) {
  return pow(x, MOD - 2);
}

ll choose(int a, int b) {
  if (b > a || a < 0) return 0;
  ll up = fact[a];
  ll down = (fact[b] * fact[a - b]) % MOD;
  return (up * inv(down)) % MOD;
}

int main() {
  cin >> N >> M >> K;
  ll sum = 0;
  fact[0] = 1;
  for(int i = 0; i + 1 < MAXN; ++i) {
    fact[i + 1] = fact[i] * (i + 1) % MOD;
  }

  for(int i = 1; i <= N && i + 1 < N + M; i += 2) {
    int a = N - i;
    int b = M - 1;
    ll add = choose(a + b, a);
    cout << "adding " << add << endl;
    (sum += choose(a + b, a)) %= MOD; // (a+b)!/a!b!
  }

  if (M == 1) {
    if (N % 2 == 0)
      (++sum) %= MOD;
  }

  ll tot = choose(N + M, N);
  if (K == 0) {
    sum = (tot - sum) % MOD;
    (sum += MOD) %= MOD;
  }
  cout << sum << endl;
  return 0;
}

#include<stdio.h>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include <time.h>
using namespace std;
long long int mod=1e9+7;

long long int a[200200],inv[200200],c[200200];
long long int q0=0,q1=0;

long long int qwe(int n,int k){
	if(k<0||n<k||n<0)
		return 0;
	long long int ans=1;
	ans=c[n];
	ans=(ans*a[k])%mod;
	ans=(ans*a[n-k])%mod;
	return ans;
}

void check(int n,int m){
	if(m==0){
		q0++;
	} else {
		if(m%2==1)
			q0++;
		else
			q1++;
	}
}

void solve(int m,int n,int k) {
	int i,j,x,y,z=0,lc,lv,tw,th;
	inv[1]=1;
	a[0]=1;
	a[1]=1;
	c[1]=1;
	c[0]=1;
	for(i=2;i<=200000;i++){
		inv[i]=(mod*mod-(mod/i)*inv[mod%i])%mod;
		a[i]=(a[i-1]*inv[i])%mod;
		c[i]=(c[i-1]*i)%mod;
	}
	q0=0,q1=0;

	for(i=0;i<1e6;i++){
		if(n>0&&m+m>1){
			q0+=qwe(n+m-1,n-1);
			m--;
			if(n>0&&m+n>1){
				q1+=qwe(n+m-1,n-1);
				m--;
			} else {
				check(n,m);
				i=1e6;
			}
		} else {
			check(n,m);
			i=1e6;
		}
	}

	if(k==0)
		printf("%I64d\n",q0);
	else
		printf("%I64d\n",q1);
}

int main() {
#pragma comment(linker,"/STACK:268435456")
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
#ifdef ONLINE_JUDGE
	//freopen("reading.in","r",stdin);
	//freopen("reading.out","w",stdout);
#endif
	int n,m,k;
	while(scanf("%d%d%d",&n,&m,&k)!=EOF)//{
		//while(gets(c))//{
			solve(n,m,k);
	//}
	return 0;
}

#include<stdio.h>
#include<string.h>
#include<algorithm>

#define mod 1000000007LL

using namespace std;

long long dp[200005], tp[200002];

int main(){
dp[0]=1LL; for(int i=1; i<=200002; i++)
{
    dp[i]=(dp[i-1]*i)%mod; int k=1000000005;
    long long  ret=1LL; long long p=dp[i]; while(k>0)
    {
        if(k%2==1) ret=(ret*p)%mod;
        k/=2;
        p=(p*p)%mod;
    }
    tp[i]=ret;
}
    int n, m, l; scanf("%d%d%d",&n,&m,&l);
    //i

     if(m==0)
    {
        if(l==1 && (n%2)==0) printf("1\n");
        else if(l==0 && (n%2)==1) printf("1\n");
        else printf("0\n");
        return 0;
    }
    if(n==0)
    {
        if(l==1 && m==1) printf("1\n");
        else if(l==0 && m==1) printf("0\n");
        else if(l==0) printf("1\n");
        else printf("0\n");
        return 0;
    }
int tmp=n; n=m; m=tmp;
    long long ans=0LL; for(int i=1; i<=n; i+=2)
    {
        ans=(ans+((dp[n+m-i-1]*tp[n-i])%mod*tp[m-1])%mod)%mod;
    }
    long long kk = ( (dp[n+m]*tp[n])%mod*tp[m])%mod+mod;
    if(l==0) ans=(kk-ans)%mod;
    printf("%lld\n",ans);
    return 0;//010100101
}

/*#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<string>
#include<map>
#include<set>
using namespace std;

#define INF 99999999
#define max(a,b) (a > b?a:b)
#define min(a,b) (a < b?a:b)
int const nMax = 110;
vector<int> ans[nMax];
int mark[20000];
int main()
{
    int n;
    scanf("%d",&n);
    memset(mark,0,sizeof(mark));
    int temp = (n*n+1)/2;
    int x = temp,y = temp+1;
    for(int i = 1;i <= n;i++){
        int total = n/2;
        while(total){
            ans[i].push_back(x);
            ans[i].push_back(y);
            x--;
            y++;
            total--;
        }
    }
    for(int i = 1;i <= n;i++){
        for(int j = 0;j < n;j++)
            printf("%d ",ans[i][j]);
        puts("");
    }
    return 0;
}
*/
/*
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<string>
#include<map>
#include<set>
using namespace std;

#define INF 99999999
#define max(a,b) (a > b?a:b)
#define min(a,b) (a < b?a:b)
int const nMax = 1e5+10;
double ans[nMax];
int main()
{
    double n,a,d;
    scanf("%lf%lf%lf",&n,&a,&d);
    double ans = 0;
    double t,v;
    double cmp = sqrt(2*d/a);
    for(int i = 1;i <= n;i++){
        scanf("%lf%lf",&t,&v);
        double tmp;
        if( v/a > cmp ){
            tmp = t+cmp;
        }
        else
            tmp = (d-v*v/2/a)/v+t+v/a;
        printf("%.6lf\n",ans = max(ans,tmp));
    }
}
*/
/*
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<string>
#include<map>
#include<set>
using namespace std;

#define INF 99999999
#define max(a,b) (a > b?a:b)
#define min(a,b) (a < b?a:b)
int const nMax = 2000;
int mark[nMax];
int main()
{
    int n,x;
    scanf("%d",&n);
    memset(mark,0,sizeof(mark));
    for(int i = 1;i <= n;i++){
        scanf("%d",&x);
        mark[x]++;
    }
    int total = 0;
    int maxans = 0;
    for(int i = 1;i < 2000;i++){
        if( mark[i] )
            total++;
        maxans = max(maxans,mark[i]);
    }
    cout << maxans << " " << total<<endl;
}

*/
/*
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<map>
#include<set>
using namespace std;

#define INF 99999999
#define max(a,b) (a > b?a:b)
#define min(a,b) (a < b?a:b)
#define Low_bit(x) (x&(-x))
#define Get_bit(x,n) (1&(x>>n))
int const nMax = 2000;
double const eps = 1e-8;
int n,m;
struct Node{
    int num,pen;
}node[60];
int cmp(Node a,Node b)
{
    if( a.num == b.num ){
        return a.pen < b.pen;
    }
    else
        return a.num > b.num;
}
int main()
{
    int k;
    scanf("%d%d",&n,&k);
    for(int i = 1;i <= n;i++){
        scanf("%d%d",&node[i].num,&node[i].pen);
    }
    sort(node+1,node+1+n,cmp);
    int ans = 0;
    for(int i = 1;i <= n;i++){
        if( node[i].num == node[k].num && node[i].pen == node[k].pen )
            ans++;
    }
    cout<<ans<<endl;
    return 0;
}
*/
/*
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<map>
#include<set>
using namespace std;

#define INF 99999999
#define max(a,b) (a > b?a:b)
#define min(a,b) (a < b?a:b)
#define Low_bit(x) (x&(-x))
#define Get_bit(x,n) (1&(x>>n))
int const nMax = 200;
double const eps = 1e-8;
int num[nMax];
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i = 1;i <= n;i++){
        scanf("%d",&num[i]);
    }
    int ans = 0;
    for(int i = 1;i <= n;i++){
        if( num[i] > 0 && num[i] >= num[k] )
            ans++;
    }
    cout<<ans<<endl;
}
*/
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<map>
#include<set>
using namespace std;
#define mod 1000000007
const int nMax = 5e5+10;
long long fac[nMax];
long long inv[nMax];
long long extend_gcd(long long a,long long b,long long &x,long long &y)
{
    if( b == 0 ){
        x = 1,y = 0;
        return a;
    }else{
        long long r = extend_gcd(b,a%b,y,x);
        y-=x*(a/b);
        return r;
    }
}
long long C(long long a,long long b)
{
    long long ret = fac[b];
    ret*=inv[a],ret%=mod;
    ret*=inv[b-a],ret%=mod;
    return ret;
}
int main()
{
    long long n,m,g;
    long long ans = 0;
    fac[1] = inv[1] = 1;
    fac[0] = inv[0] = 1;
    for(long long i = 2;i < nMax;i++){
        fac[i] = (fac[i-1]*i)%mod;
        long long x,y;
        extend_gcd(mod,i,x,y);
        y%=mod;
        y+=mod;
        y%=mod;
        inv[i] = (inv[i-1]*y)%mod;
    }
    for(int i = 1;i <= 200000;i++){
        if( (fac[i]*inv[i])%mod != 1 )
            cout<<i<<endl;
    }
    scanf("%I64d%I64d%I64d",&n,&m,&g);
    long long total = n+m;
    if( m == 1 && n == 1 ){
        if( g == 1 )
            cout<<0<<endl;
        else
            cout<<2<<endl;
        return 0;
    }
    if( n == 0 && m == 1 && g == 0 ){
        cout<<0<<endl;
        return 0;
    }
    if( g == 0 )
    {
        for(long long i = 1;i <= n+1;i+=2){
            if( i == m+n )
                break;
            ans+=C(m-1,m+n-i);
            ans%=mod;
        }
    }
    else{
        for(long long i = 0;i <= n+1;i+=2){
            ans+=C(m-1,m+n-i);
            ans%=mod;
        }
    }
    cout<<ans<<endl;
}

#include<iostream>
#include<cstdio>
#include<cstdlib>

using namespace std;

typedef long long ll;

ll pr = 1000000007;

ll powmodn(ll n, ll pow, ll mod)    {
    ll ans = 1;
    ll mul = n;
    n %= mod;
    while (pow) {
        if (pow & 1)    {
            ans *= mul;
        }
        mul *= mul;
        mul %= mod;
        ans %= mod;
        pow >>= 1;
    }
    return ans;
}

ll inverse(ll n, ll prime)  {
    return powmodn(n, prime - 2, prime);
}

ll minv = 0;

ll perform(ll m, ll n)  {
    ll init = 1;
    ll low = n + 1;
    ll up = m + n - 1;
    for (ll mul = n + 1; mul <= m + n -1; ++mul)    {
        init *= mul;
        init %= pr;
    }
    ll ans = 0;
    ans += init;
    // cerr << (init * minv) % pr << endl;
    for (ll shift = 2; shift < n; shift += 2)    {
        init *= inverse(up, pr);
        up -= 2;
        low -= 2;
        init %= pr;
        init *=  low;
        init %= pr;
        ans += init;
    }
    return ans;
}

ll doit(ll n, ll m, ll g)   {
    cerr << n << " " << m <<" " << g << endl;
    ll one_ret, zero_ret;
    if (n == 0) {
        if (m == 1) {
            zero_ret = 0;
            one_ret = 1;
        } else {
            zero_ret = 1;
            one_ret = 0;
        }
    }
    if (m == 0) {
        if (!(n&1)) {
            zero_ret = 0;
            one_ret = 1;
        } else {
            zero_ret = 0;
            one_ret = 1;
        }
    }

    if (m != 0 && n != 0)   {
        if (g == 1) {
            return doit( n - 1, m, 0);
        }

        // now g == 0;
        if (n == 1) {
            ll mid = doit(n - 1,m, 1) + doit(n,m-1, 1);
            mid %= pr;
            mid += doit(n,m-1, 0);
            mid %= pr;
            return mid;
        }
        // now g == 0 && n >= 2

        ll mid = minv * perform(n, m);
        mid %= pr;
        mid += doit(n%2, m, 0);
        mid %= pr;
        return mid;
    }
    if (g == 0) {
        return zero_ret;
    } else {
        return one_ret;
    }

}

int main()  {
    ll m, n, g;
    // n = # of 0
    // m = # of 1
    cin >> n >> m >> g;

    ll mfac = 1;
    for (ll i = 1; i < m; ++i)  {
        mfac *= i;
        mfac %= pr;
    }
    minv = inverse(mfac, pr);
    cout << doit(m, n, g) << endl;
}

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#define MOD 1000000007
#define int long long
using namespace std;
const int N = 100000;
int n, m, g, inv[N + 5], fac[N + 5], invf[N + 5];
inline void prework() {
	inv[0] = inv[1] = fac[1] = invf[1] = fac[0] = invf[0] = 1;
	for(int i = 2; i <= N; i++) fac[i] = (fac[i - 1] * i) % MOD;
	for(int i = 2; i <= N; i++) inv[i] = (MOD - MOD / i) * inv[MOD % i] % MOD;
	for(int i = 2; i <= N; i++) invf[i] = invf[i - 1] * inv[i] % MOD;
}
inline int C(int a, int b) {
	return fac[a] * invf[b] % MOD * invf[a - b] % MOD;
}
signed main() {
	prework();
	scanf("%lld%lld%lld", &n, &m, &g);
	if(n == 0) {
		printf("%lld\n", g ^ 1);
		return 0;
	}
	if(m == 0) {
		printf("%d\n", ( (n % 2) ^ 1 ) == g );
		return 0;
	}
	int ans = 0;
	if(m == 1 && n % 2 == 0) ans = 1;
	for(int i = 1; i <= n; i += 2) {
		int num0, num1;
		num0 = n - i, num1 = m - 1;
		if(num1 + num0)
		    ans = (ans + C(num1 + num0, num0)) % MOD;
	}
	if(g == 1) printf("%lld\n", ans);
	else printf("%lld\n", (C(n + m, m) - ans + MOD) % MOD);
	return 0;
}

#include <bits/stdc++.h>

#define N 200500
#define MOD 1000000007

using namespace std;

int n,m,g,f[N+5],r[N+5],res;
int pow(int x,int y){
	int res=1;
	while (y){
		if (y%2==1)res=((long long)(res)*x)%MOD;
		x=((long long)(x)*x)%MOD;
		y/=2;
	}
	return res;
}
// calculation of nCr
int C(int k,int n){
	int res=((long long)f[n])*r[k]%MOD;
	res=((long long)res)*r[n-k]%MOD;
	return res;
}

int main(){
	int n,m,g,ans=0,total;
	cin>>n>>m>>g;

	f[0]=1;
	for (int i=1;i<=N;i++)
	f[i]=(((long long)f[i-1])*i)%MOD;

	for (int i=0;i<=N;i++)
	r[i]=pow(f[i],MOD-2);

	total = C(m,n+m);

	if(n==0)
	ans=0;
	else if(m==0 && n%2==0)
	ans=1;
	else
	{
		n=n-1;
		m=m-1;
		if(n>0 || m>0)
		for(int x=n+m;n>=0;x-=2,n-=2)
		ans += C(m,x);
	}
	if(g==1)
	cout<<ans;
	else
	{
		ans = ((MOD + total) - ans)%MOD ;
		cout<<ans;
	}
	return 0;
}

/***********************************************\
 |Author: WiYR
 |Created Time: 2013/8/10 0:41:22
 |File Name: Bear Vasily and Beautiful Strings.cpp
 |Description:
\***********************************************/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>

using namespace std;
const int mod=1e9+7;
int bs(__int64 x,int bit){
    __int64 ans=1;
    while(bit){
        if(bit&1)
            ans=ans*x%mod;
        x=x*x%mod;
        bit>>=1;
    }
    return ans;
}

int main() {
//freopen("input.txt","r",stdin);
    int n,m,k,i;
    __int64 ans=1;
    scanf("%d%d%d",&n,&m,&k);
    if(k==1&&n<2||k==0&&n+m<2){puts("0");return 0;}
    if(k==1){
        int t=n-2;
        int mint=min(t,m);
        for(i=1;i<=mint;i++){
                ans=ans*(m+n-2-i+1)%mod;
                ans=ans*bs(i,mod-2)%mod;
            }
        printf("%I64d\n",ans);
    }
    else {
        n--,m--;
        int mint=min(n,m);
        for(i=1;i<=mint;i++){
           ans=ans*(m+n-i+1)%mod;
           ans=ans*bs(i,mod-2)%mod;
            }
        printf("%I64d\n",ans*2%mod);
    }
    return 0;
}

#include <bits/stdc++.h>
#define maxn 200010
#define INF 0x3f3f3f3f
typedef long long ll;
using namespace std;
const ll mod = 1e9+7;
ll fac[maxn], inv[maxn];
void init(){
    fac[0] = inv[0] = inv[1] = 1;
    for(ll i=1;i<maxn;i++) fac[i] = fac[i-1]*i%mod;
    for(ll i=2;i<maxn;i++)inv[i]=mod-(ll)(mod/i)*inv[mod%i]%mod;
    for(ll i=1;i<maxn;i++)inv[i]=(ll)inv[i-1]*inv[i]%mod;
}
ll c(ll a,ll b){
    return fac[a]*inv[b]%mod*inv[a-b]%mod;
}
int main(){
    ll n, m, q, ans = 0, g;
    scanf("%lld%lld%lld", &n, &m, &g);
    init();
    if(n == 0){
        if(n == 1) printf("%d\n", g);
        else printf("0\n");
    }
    else if(m == 0){
        if(n%2) printf("0\n");
        else printf("%d\n", g);
    }
    else{
        for(ll i=1;i<=n;i+=2)
            if(n+m-i-1 != 0)
            ans = (ans+c(n+m-i-1, m-1))%mod;
        if(m == 1&&n%2 == 0) ans++;
        printf("%lld\n", g?((ans+mod)%mod):((c(n+m, n)-ans+mod)%mod));
    }
    return 0;
}

#include <iostream>
#include <math.h>
using namespace std;
typedef long long ll;

int n,m,g;
int mod = 1e9 + 7;

ll fact[500009];

ll value[1000];

ll potencia(ll a, int pot)
{
    if(pot < 3)
        return pow(a,pot);

    ll res = potencia(a,pot/2);

    res = ((res%mod)*(res%mod))%mod;
    if(pot % 2 == 1)
        res = (res*a)%mod;

    return res;
}

ll nck(ll num, ll k)
{
    if(num == 0)return num;
    if(k == 1)
        return num;

    ll div = (fact[num - k]*fact[k])%mod;
    ll res = (fact[num]*potencia(div,mod - 2))%mod;
    return res;
}

ll cero()
{
    ll comb = nck(n + m - 1,m - 1);
    for(int i = 2; i <= n; i += 2)
    {
        comb += nck(n + m - i - 1, m - 1);
        comb %= mod;
    }
    return comb;
}

ll uno()
{
    ll res = nck(n + m - 2, m - 1);
    for(int i = 2; i <= n; i++)
    {
        res += nck(n + m - 2 - i, m - 1);
        res %+ mod;
    }
    return res;
}

int main()
{
    fact[0] = 1;
    fact[1] = 1;
    for(int i = 2; i < 500003; i++)
        fact[i] = (fact[i - 1]*i)%mod;
    cin >> n >> m >> g;

    if(n == 0)
    {
        if(g == 0)
            cout << 1 << endl;
        else
            cout << 0 << endl;
        return 0;
    }
    if(m == 0)
    {
        value[1] = n % 2;
        value[0] = 1 - value[0];
        cout << value[g] << endl;
        return 0;
    }

    if(g == 0)
    {
        if(n == 1 && m == 1)
        {
            cout << 2 << endl;
            return 0;
        }
        cout << cero() << endl;
    }
    else
    {
        cout << uno() << endl;
    }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define F first
#define S second
#define hell 1000000007

// To find GCD of a and b
ll gcd(ll a, ll b);

// To compute x raised to power y under modulo m
ll power(ll x, unsigned ll y, unsigned ll m);

// Function to find modular inverse of a under modulo m
// Assumption: m is prime
ll modInverse(ll a, ll m)
{
    ll g = gcd(a, m);
    if (g != 1)
        cout << "Inverse doesn't exist";
    else
    {
        // If a and m are relatively prime, then modulo inverse
        // is a^(m-2) mode m
        return power(a, m-2, m);
    }
}

// To compute x^y under modulo m
ll power(ll x, unsigned ll y, unsigned ll m)
{
    if (y == 0)
        return 1;
    ll p = power(x, y/2, m) % m;
    p = (p * p) % m;

    return (y%2 == 0)? p : (x * p) % m;
}

// Function to return gcd of a and b
ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b%a, a);
}

std::vector<ll> fac(200005);

void calcfac()
{
  ll ans=1;
  fac[0]=1;
  for(ll i=1;i<=200000;i++)
  {
    fac[i]=(fac[i-1]*i)%hell;
  }
  return ;
}

ll ncr(ll n, ll r)
{
  ll num1 = fac[n];
  ll den1 = modInverse(fac[n-r],hell);
  ll den2 = modInverse(fac[r],hell);

  return ((num1*den1)%hell*den2)%hell;

}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  ll i,j,k,n,m,p,q,t,ans=0,sum=0,ct=0,flag=0;
  ll g;
  calcfac();
  ll ct0=0,ct1=0;
  cin>>n>>m>>g; //0->n, 1->m
  ct0=n; ct1=m-1;
  while(ct0+ct1>0 && ct1>=0 && ct0>=0)
  {
    //if(ct0==0) {ans=(ans+1)%hell; break;}
    //else if(ct1==0) {ans=(ans+1)%hell; break;}
    ans=(ans+ncr(ct0+ct1,min(ct0,ct1)))%hell;
    ct0-=2;
  }
  if(n%2!=0 && m==1) ans+=1;
  if(g==0) cout<<ans;
  else
  {
    cout<<(ncr(n+m,min(n,m))-ans+hell)%hell;
  }

  return 0;
}

#include <iostream>
#include <cmath>

using namespace std;

typedef long long ll;

const int N = 2e5 + 10;
const ll MOD = 1e9 + 7;

ll inv[N], fact[N];

ll bpow(ll a, ll b)
{
	if (b == 0)
		return 1;
	ll x = bpow(a, b/2);
	return b & 1 ? x * x % MOD * a % MOD : x * x % MOD;
}

ll c(ll a, ll b)
{
	if (a > b)
		return 0;
	return fact[b] * inv[a] % MOD * inv[b-a] % MOD;
}

int main()
{
	int n, m;
	bool g;
	cin >> n >> m >> g;

	fact[0] = inv[0] = 1;
	for (int i=1; i<N; i++)
	{
		fact[i] = fact[i-1] * i % MOD;
		inv[i] = inv[i-1] * bpow(i, MOD-2) % MOD;
	}

	ll ans = 0;
	while (n >= 0)
	{
		if (!g)
			ans += c(n, n+m-1);
		g = !g;
		n--;
	}
	if (!g)
		ans++;

	cout << ans;
}

#include<iostream>
#include<vector>
#include<fstream>
#include<queue>
#include<algorithm>
#include<list>
#include<cstdio>
#include<stack>
#include<cstring>
#include<cmath>
#include<string>
#include <functional>
#include<sstream>
#include<map>
using namespace std;
#define     For(i,a,b)        for (int i=a; i<b; i++)
#define     Rep(i,a)          for (int i=0; i<a; i++)
#define     FIT(it,v)         for (typeof((v).begin())it=(v).begin(); it!=(v).end(); ++it)
#define     ALL(v)            (v).begin(),(v).end()
#define     Set(a,x)          memset((a),(x),sizeof(a))
#define     EXIST(a,b)        find(ALL(a),(b))!=(a).end()
#define     Sort(x)           sort(ALL(x))
#define     GSORT(x)          sort(ALL(x), greater<typeof(*((x).begin()))>())
#define     UNIQUE(v)         Sort(v); (v).resize(unique(ALL(v)) - (v).begin())
#define     MP                make_pair
#define     SF                scanf
#define     PF                printf
#define     MAXN               200001
#define     MAXM               1001
#define     MOD               1000000007
#define     Dbug             cout<<"";
#define     hsh              2654435761 // %1<<x (x=60)
#define     EPS              1e-15
typedef long long ll;
typedef pair<int,int> pii;
ll pw(ll a, ll b)
{
    ll ret=1;
    while (b)
    {
        if(b&1) ret=(ret*a)%MOD;
        a=(a*a)%MOD;
        b/=2;
    }
    return ret;
}
ll fact[MAXN];
ll rec(int n, int m, int g)
{
    if(n+m<=2)
    {
        if(g==1 && n==2) return 1;
        if(g==0 && n==1 && m==1) return 2;
        else if(g==0 && m==2) return 1;
        return 0;
    }
    if(g) if(n) return rec(n-1, m, 0);
    if(!g)
    {
        ll ret=0;
        if(m) ret=(((fact[n+m-1]*pw(fact[n], MOD-2))%MOD)*pw(fact[m-1], MOD-2))%MOD;
        if(n) ret=(ret+rec(n-1, m, 1))%MOD;
        return ret;
    }
    return 0;
}
int main(){
    //ios_base::sync_with_stdio(false);
    //freopen("a.in","r",stdin);
    int n, m, g;
    fact[0]=1;
    For(i, 1, MAXN) fact[i]=fact[i-1]*i;
    cin>>n>>m>>g;
    cout<<rec(n, m, g);
    return 0;
}

#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define N 200005
using namespace std;
int n,m,g;
ll ans;
ll jiesum[N],inv[N];
inline ll qpow(ll a,ll b){
	ll res = 1,base = a;
	while(b){
		if(b&1) res = res*base%mod;
		base = base*base%mod;
		b >>= 1;
	}
	return res;
}

inline ll C(int y,int x){
	return (jiesum[y]*qpow(jiesum[y-x],mod-2)%mod)*qpow(jiesum[x],mod-2)%mod;
}
int main(){
	scanf("%d%d%d",&n,&m,&g);
	jiesum[0] = jiesum[1] = 1;
	for(int i = 2;i<=n+m;++i) jiesum[i] = jiesum[i-1]*i%mod;
	if(n == 0) return printf("%d",m==1?g^1:g),0;
	if(m == 0) return printf("%d",n%2==0?g:g^1),0;
	/*
	g = 0:
	01011...100000
	最后一个1一定在从后往前数第2,4,6个位置
	*/
	if(g == 0){
		for(int i = 0;i<=n;i+=2) ans = (ans+C(n+m-i-1,m-1))%mod;
		if(m == 1){
			if(n%2 == 0) ans = (ans-1+mod)%mod;
			else ans = (ans+1)%mod;
		}
	}else{
		for(int i = 1;i<=n;i+=2) ans = (ans+C(n+m-i-1,m-1))%mod;
		if(m == 1){
			if(n%2 == 0) ans = (ans+1)%mod;
			else ans = (ans-1+mod)%mod;
		}
	}
	printf("%lld",ans);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define x first
#define y second
#define rep(x,s,to) for(int x=(s);x<(to);x++)
#define itr(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define all(a) (a.begin()),(a.end())
typedef  pair<int,int> pii;
typedef vector<pair<int, int>> vpii;
 ll mod=(ll)(1e9+7);
ll f[200005],fi[200005];

ll pow(ll a, ll b)
{
    if(b==0) return 1;
    if(b%2==1)
    return (a*pow((a*a)%mod,b/2))%mod;
    return pow((a*a)%mod,b/2);
}
ll inv(ll a)
{
    return pow(a,mod-2);
}

ll c(ll a,ll b)
{
    return (((f[a+b]*fi[a])%mod)*fi[b])%mod;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);

int n,m,g;
cin>>n>>m>>g;
f[0]=1; fi[0]=1;
for(int i=1;i<=(n+m);i++) {f[i]=(f[i-1]*i)%mod; fi[i]=(fi[i-1]*inv(i))%mod;}
ll dp[n+1];
if(m>1)dp[1]=1; else dp[1]=0;
dp[0]=0;
for(int i=2;i<=n;i++)
{
    dp[i]=(dp[i-2]+c(i-1,m-1))%mod;
}
if(g)
{
    cout<<dp[n]<<endl;
}
else
{
    cout<<(dp[n-1]+(m>0 ? c(n,m-1) : 0))%mod;
}
}

#include <iostream>
#include <math.h>
using namespace std;
typedef long long ll;

int n,m,g;
int mod = 1e9 + 7;

ll fact[500009];

ll value[2];

ll potencia(ll a, int pot)
{
    if(pot < 3)
        return pow(a,pot);

    ll res = potencia(a,pot/2);

    res = ((res%mod)*(res%mod))%mod;
    if(pot % 2 == 1)
        res = (res*a)%mod;

    return res;
}

ll nck(ll num, ll k)
{
    if(num == 0)return num;
    if(k == 1)
        return num;

    ll div = (fact[num - k]*fact[k])%mod;
    ll res = (fact[num]*potencia(div,mod - 2))%mod;
    return res;
}

void solve()
{
    for(int i = 0; i <= n; i++)
    {
        value[i%2] += nck(n + m - 1 - i,m - 1);
        value[i%2] %= mod;
    }
}

int main()
{
    fact[0] = 1;
    fact[1] = 1;
    for(int i = 2; i < 500003; i++)
        fact[i] = (fact[i - 1]*i)%mod;
    cin >> n >> m >> g;

    if(n == 0)
    {
        if(g == 0)
            cout << 1 << endl;
        else
            cout << 0 << endl;
        return 0;
    }
    if(m == 0)
    {
        value[1] = n % 2 + 1;
        value[0] = 1 - value[0];
        cout << value[g] << endl;
        return 0;
    }
    value[0] = 1;
    solve();
    cout << value[g] << endl;

    return 0;
}

#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
typedef long long LL;
const int MaxN = 2e5;
const LL Pt = 1e9 + 7;
int g, n, m;
LL f[MaxN + 10];
LL qwe(LL x, LL y){
	LL t = 1;
	while(y){
		if(y & 1) t = t * x % Pt;
		y /= 2;
		x = x * x % Pt;
	}
	return t;
}
LL C(LL a, LL b){
	if(a < b)return 0;
	return (f[a] * qwe(f[b] * f[a - b] % Pt, Pt - 2)) % Pt;
}
LL Get(LL n, LL m, int g){
	if(n == 0){
		if(g == 1){
			if(m == 1)return 1;
			return 0;
		}
		else {
			if(m == 1)return 0;
			return 1;
		}
	}
	if(m == 0){
		if(g == 1){
			if(n & 1)return 0;
			return 1;
		}
		else if(g == 0){
			if(n & 1)return 1;
			return 0;
		}
	}
	if(g == 1)return Get(n - 1, m, 0);
	else return (Get(n - 1, m, 1) + C(n + m - 1, n)) % Pt;
}
int main() {
	scanf("%lld%lld%d", &n, &m, &g);
	f[0] = 1;
	for(int i = 1; i <= MaxN; i++)f[i] = f[i - 1] * (LL)i;
	LL ans = Get(n, m, g);
	printf("%lld\n", ans);
}

/*
 * File:   main.cpp
 * Author: DigitalNet
 *
 * Created on 10 آب, 2013, 01:30 ص
 */

#include <cstdlib>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

/*
 *
 */

typedef unsigned int uint;

#define ll long long
const uint p = 1000000007;
uint modPow(uint a, uint x) {
// return a^x mod p
ll res = 1;
while(x>0) {
if(x & 1) res = (res*a) % p;
a=(a*a)%p;
x >>= 1;
}

return (uint)res;
}

uint modInverse(uint a) {
// return modular multiplicative of: a mod p, assuming p is prime
return modPow(a, p-2);
}

vector<uint> llf;
uint llfact(uint a)
{
    ll x;
    while(llf.size()<=a)
    {
        x=(llf[llf.size()-1]*llf.size())%1000000007;
        llf.push_back((uint)x);
    }
    return llf[a];
}
uint modbinomial(uint n,uint k)
{
    uint numerator = llfact(n);

    ll x = ((ll)llfact(k)*(ll)llfact(n-k))%1000000007;
    uint denominator = (uint)x;

    ll res = modInverse(denominator);
    res = (res*numerator)%1000000007;
    return (uint)res;
}
uint llfuncy(uint n,uint m,uint g)
{
    ll rslt = 0;
    for( ;n>=g;g+=2)
    {
        rslt += modbinomial(m+n-g-1,n-g);
        if(rslt>=1000000007)
                rslt%=1000000007;
    }
    return (uint)rslt;
}
int main(int argc, char** argv) {
    llf.push_back(1);
    llf.push_back(1);
    llf.push_back(2);
    int n=100000,m=100000,g=0;
    //cin>>n>>m>>g;
    uint rslt=0;
    if(n+m>2)
        rslt = llfuncy(n,m,g);//when m+n>2
    else if(n==0)
    {
        rslt = (m+g==2?1:0);
    }
    else if(m==0)
    {
        rslt = (n-g==1?1:0);
    }
    else
        rslt = (g==0?2:0);
    cout<<rslt;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
long long int mod=1000000007;
//vector<vector<long long int>> dp;
int mul(int a, int b, long long int mod = mod) {
  return int((long long) a * b % mod);
}
int mpow(long long int base, long long int ex, long long int mod=mod) {
  int res = 1;
  while (ex > 0) {
    if (ex & 1) res = mul(res, base, mod);
    base = mul(base, base, mod);
    ex >>= 1;
  }
  return res;
}
int inv(long long int a, long long int mod=mod) {
  return mpow(a, mod - 2, mod);
}
vector<long long int> fac, ifac;
long long int ncr(long int n, long int r) {
  if (n < r || r < 0) return 0;
  return (fac[n]*((ifac[n - r]* ifac[r])%mod))%mod;
}
void prepare_factorial(int nax = 1e6 + 10) {
  fac.resize(nax);
  ifac.resize(nax);
  fac[0] = 1;
  for (int i = 1; i < nax; ++i) fac[i] = (i* (fac[i - 1]%mod))%mod;;
  ifac[nax - 1] = inv(fac[nax - 1]);
  for (int i = nax - 1; i > 0; --i) ifac[i - 1] = (i* (ifac[i]%mod))%mod;
}
long long int fun(long int n,long int m,long int g)
{
    if(n==0&&g==0)
    {
        return 1;
    }
    if(n==0&&g==1)
    {
        return 0;
    }
    if(m==0)
    {
        if(n%2==0)
        {
            if(g==1)
            {
                return 1;
            }
            else
            {
              return 0;
            }
        }
        else
        {
          if(g==1)
            {
                return 0;
            }
            else
            {
              return 1;
            }
        }

    }
    if(n==1&&m==1)
    {
        if(g==0)
        {
            return 2;
        }
        else
        {
            return 0;
        }
    }
    if(n==2&&m==0)
    {
       if(g==0)
        {
            return 0;
        }
        else
        {
            return 1;
        }
    }
    if(n==0&&m==2)
    {
       if(g==0)
        {
            return 1;
        }
        else
        {
            return 0;
        }
    }
    if(g==1)
    {
        return fun(n-1,m,0)%mod;
    }
    else
    {
        return (fun(n-1,m,1)%mod+ncr(n+m-1,max(n,m)+1)%mod)%mod;
    }
}

int main()
{
    long int n,m,g;
    cin>>n>>m>>g;
    if(n+m==1)
    {
        if(n==1&&g==0)
        {
            cout<<1<<endl;
            return 0;
        }
        if(m==1&&g==1)
        {
            cout<<1<<endl;
            return 0;
        }
    }
    /*dp.resize(n+m+1,vector<long long int>(max(n,m)+1));
    //long long int dp[n+m+1][max(n,m)+1];
    for(long long int i=0;i<=n+m;i++)
    {
        for(long long int j=0;j<=max(n,m);j++)
        {
            if(j==0)
            {
                dp[i][j]=1;
                continue;

            }
            if(i==0)
            {
                dp[i][j]=0;
                continue;
            }
            dp[i][j]=((dp[i-1][j]%mod)+(dp[i-1][j-1]%mod))%mod;
        }
    }*/
    prepare_factorial(2e5 + 42);
    long long int ans=fun(n,m,g)%mod;
    cout<<ans<<endl;
    return 0;
}

#include <iostream>
#include <vector>
#include <string>
#include <fstream>
#include <set>

using namespace std;

int mod = 1e9 + 7;
vector <long long int> fact(1e5 + 7, 1);

long long int f(long long int n, long long int k)
{
    long long answer = fact[n] / fact[k] / fact[n - k];
    return answer;
}

int main()
{
    long long answer = 0;
    int n, m, g;
    cin >> n >> m >> g;
    for (int i = 1; i < 1e5 + 7; ++i)
    {
        fact[i] = (fact[i - 1] * i) % mod;
    }
    if (m == 0)
    {
        if ((n + m) % 2 == 0 && g == 1)
        {
            cout << "1" << endl;
        return 0;
        }
        else if ((n + m) % 2 == 1 && g == 0)
        {
            cout << "1" << endl;
        return 0;
        }
    }
    else if (n == 0 && g == 0)
    {
        cout << "1" << endl;
        return 0;
    }
    for (int i = 0; i < n + m - 1; i++)
    {
        if ((i % 2 == 0 && g == 0))
        {
            cout << "LOL1" << endl;
            answer += f(n + m - i - 1, m - 1);
        }
        else if ((i % 2 == 1 && g == 1))
        {
            cout << "LOL2" << endl;
            answer += f(n + m - i - 1, m - 1);
        }
    }
    if ((m + n - 1) % 2 == 0 && g == 1 && m == 1)
    {
        answer++;
    }
    else if ((m + n - 1) % 2 == 1 && g == 0 && m == 1)
    {
        answer++;
    }
    cout << answer;
    return 0;
}

#include <bits/stdc++.h>

#define N 200500
#define MOD 1000000007

using namespace std;

int n,m,g,f[N+5],r[N+5],res;
int pow(int x,int y){
	int res=1;
	while (y){
		if (y%2==1)res=((long long)(res)*x)%MOD;
		x=((long long)(x)*x)%MOD;
		y/=2;
	}
	return res;
}
// calculation of nCr
int C(int k,int n){
	int res=((long long)f[n])*r[k]%MOD;
	res=((long long)res)*r[n-k]%MOD;
	return res;
}

int main(){
	int n,m,g,ans=0,total;
	cin>>n>>m>>g;

	f[0]=1;
	for (int i=1;i<=N;i++)
	f[i]=(((long long)f[i-1])*i)%MOD;

	for (int i=0;i<=N;i++)
	r[i]=pow(f[i],MOD-2);

	total = C(m,n+m);

	if(n==0)
	ans=0;
	else if(m==0 && n%2==0)
	ans=1;
	else
	{
		n=n-1;
		m=m-1;
		if(n>0 || m>0)
		{
		for(int x=n+m;n>=0;x-=2,n-=2)
		ans = ((long long)ans + C(n ,x))%MOD;
		if(m==0)
		ans++;
	    }
	}
	if(g==1)
	cout<<ans;
	else
	{
		ans = ((MOD + (long long)total) - ans)%MOD ;
		cout<<ans;
	}
	return 0;
}

#include <cstdio>

#define MAX_N 100010

#define MODULO 1000000007

int c[2][MAX_N*2][2];
int n,m,g;
int inv[MAX_N*2];

int pow(long long a, long long b, int MOD) {

  long long x = 1, y = a;
  while(b > 0) {
    if(b%2 == 1) {
      x=(x*y);
      if(x>MOD) x%=MOD;
    }
    y = (y*y);
    if(y>MOD) y%=MOD;
    b /= 2;
  }
  return (int)(x % MOD);
}

int modInverse(int a, int m) {
    return pow(a,m-2,m);
}

void init()
{
  for(int i=2; i<MAX_N*2; i++) {
    inv[i] = modInverse(i,MODULO);
  }
  inv[1] = 1;
}

main()
{
  scanf("%d %d %d",&n,&m,&g);

  long long val = 0;
  init();

  if(m==1)
    val = (n/2) % MODULO;
  if(m==0) {
    val = (n%2==0) ? 0 : 1;
  }else {
    long long vv = 1;

    val = 1;

    int sgn = (n+m-1)%2;

    for(int i=m; i<=n+m-1; i++) {
      vv *= i;
      vv %= MODULO;
      vv *= inv[i-m+1];
      vv %= MODULO;

      if(i%2 == sgn) {
        val += vv;
        val %= MODULO;
      }
    }
  }

  if(g==0)
    printf("%I64d\n",val);
  else {
    long long vvv = 1;
    for(int i=m+1; i<=n+m; i++) {
      vvv *= i;
      vvv %= MODULO;
      vvv *= inv[i-m];
      vvv %= MODULO;
    }
    printf("%I64d\n",(vvv-val+MODULO)% MODULO);
  }
}

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;

int n,m,g;
long long fac[200010];

void init()
{
    fac[0]=fac[1]=1;
    for(int i=2;i<=200000;i++)
        fac[i]=fac[i-1]*i%mod;
    return;
}

long long quick_pow(long long base, long long pow)
{
    long long ret=1;
    while(pow)
    {
        if(pow&1)
            ret=(ret*base)%mod;
        base=base*base%mod;
        pow>>=1;
    }
    return ret;
}

long long C(int r,int k)
{
    return fac[r]*quick_pow(fac[k]*fac[r-k]%mod,mod-2)%mod;
}

int main()
{
    cin>>n>>m>>g;
    if(n==0)
    {
       if(g==0) cout<<1<<endl;
       if(g==1) cout<<0<<endl;
    }
    if(m==0)
    {
        if(g==0)
        {
            if(n%2==1)
               cout<<1<<endl;
            else
               cout<<0<<endl;
        }
        else
        {
            if(n%2==1)
                cout<<1<<endl;
            else
                cout<<0<<endl;;
        }
        return 0;
    }
    init();
    long long all=C(n + m,n);
    long long ans=0;
    for(int t=0;t<=n;t+=2)
        ans=(ans+C(n+m-1-t,m-1))%mod;
    if(m==1&&(n&1)==0)
        ans=(ans-1+mod)%mod;
    if(m==1&&(n&1)) ans=(ans+1%mod);
    if(g==0) cout<<ans<<endl;
       else cout<<(all-ans+mod)%mod<<endl;
    return 0;
}

#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#define MP make_pair
#define PB push_back

using namespace std;

const long long oo = 1000000009;

const int maxN = 100011;
int g, n, m;
long long gt[maxN];

long long pow(long long p, long long x) {
    if (x == 0) return 1;
    if (x == 1) return p;
    long long ans = pow(p, x/2);
    ans = (ans*ans) % oo;
    if (x % 2) ans *= p;
        return ans % oo;
}

long long C(long long n, long long k) {
    long long ans = gt[n] * pow(gt[k], oo-2) * pow(gt[n-k], oo-2);
    return ans % oo;
}

long long cal(int g, int i, int j) {
    if (i < 0 || j < 0)
        return 0;
    if (i + j == 1) {
        if (g == 0)
            if (i==1) return 1;
                else return 0;
        if (g == 1)
            if (j==1) return 1;
                else return 0;
    }
    long long ans;
    if (g == 0)
        ans = cal(1,i-1,j) + C(i+j-1,i);
    else
        ans = cal(0,i-1,j);
    return ans % oo;
}

int main() {
//    freopen("a.in.c", "r", stdin);
    while (cin >> n >> m >> g) {
        gt[0] = 1;
        for(int i=1; i<=m+n; i++)
            gt[i] = (gt[i-1] * i) % oo;
        cout << cal(g, n, m) << endl;
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define sd(x) scanf("%d", &x)
#define boost ios_base::sync_with_stdio(false);
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define f first
#define s second

typedef pair<int, int> pii;
typedef long long ll;

const int mod = 1000000007;
const int inf = 50000000;
const int maxn = 300010;

ll fact[maxn], mfact[maxn];

ll modpow(ll a, ll b)
{
	ll x=1, y=a;
	while(b){
		if(b&1)
			x = (x*y)%mod;
		y = (y*y)%mod;
		b/=2;
	}
	return x;
}

int main()
{
	//freopen("i.txt", "r", stdin);
	//freopen("o.txt", "w", stdout);
	int n, m, g, i, j;
	fact[0] = mfact[0] = 1;
	for(i=1; i<maxn; i++){
		fact[i] = (fact[i-1]*1ll*i)%mod;
		mfact[i] = modpow(fact[i], mod-2);
	}
	ll ans = 0, x, y, temp;
	scanf("%d%d%d", &n, &m, &g);
	if(g){
		if(n==0){
			if(m==1)
				printf("1\n");
			else
				printf("0\n");
			return 0;
		}
		if(m==0){
			if(!(n&1))
				printf("1\n");
			else
				printf("0\n");
			return 0;
		}
		for(i=1; i<n; i+=2){
			x = (((fact[n+m-(i+1)]*mfact[m-1])%mod)*mfact[n-i])%mod;
			ans = (ans+x)%mod;
		}
		if(m==1){
			if(!(n&1))
				ans = (ans+1)%mod;
		}
		else{
			if(n&1)
				ans = (ans+1)%mod;
		}
	}
	else{
		if(n==0){
			printf("1\n");
			return 0;
		}
		if(m==0){
			if(n&1)
				printf("1\n");
			else
				printf("0\n");
			return 0;
		}
		if(n==1){
			printf("%d\n", (n+m));
			return 0;
		}
		for(i=2; i<n; i+=2){
			x = (((fact[n+m-(i+1)]*mfact[m-1])%mod)*mfact[n-i])%mod;
			ans = (ans+x)%mod;
		}
		if(m==1){
			if(n&1)
				ans = (ans+1)%mod;
		}
		else{
			if(!(n&1))
				ans = (ans+1)%mod;
		}
		for(i=1; i<=m; i++){
			x = (((fact[n+m-(i+1)]*mfact[n-1])%mod)*mfact[m-i])%mod;
			ans = (ans+x)%mod;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

//Fruit of Light
//FoL CC
//Apple Strawberry

#include<cstdio>
#include<algorithm>
#include<vector>
#include<iostream>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<cstring>

using namespace std;

#define For(i, n) for(int i = 0; i<(n); ++i)
#define ForEach(it, i) for(typeof i.begin() it = i.begin(); it!=i.end(); ++it)

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

#define MOD 1000000007
          // 123456789
#define MAXN 2000047

int n,m,q;
ll inv[MAXN], fak[MAXN], ifak[MAXN];

inline ll total(ll a, ll b){
    return (fak[a+b] * (ifak[a] * ifak[b])%MOD) % MOD;
}

ll solve(ll a, ll b, ll c){
    if (b==0){
        return ((a>1)==c);
    }
    if (a==0){
        return b%2;
    }
    if (c) a--;
    return total(a,b) - solve(a,b,1);
}

int main(){
    fak[0] = ifak[0] = 1;
    For(i,MAXN){
        if (i<MAXN/2) {
            ll a = 1, x = i+1, y = MOD-2;
            while(y>0){
                if (y%2) a = (a*x)%MOD;
                x = (x*x)%MOD;
                y/=2;
            }
            inv[i+1] = a;
            ifak[i+1] = (inv[i+1]*ifak[i])%MOD;
        }
        fak[i+1] = (ll(i+1)*fak[i])%MOD;
        //if (i<10)
        //    cout << inv[i] << " " << fak[i] << " " << ifak[i] << endl;
    }
    scanf("%d%d%d",&n, &m, &q);
    printf("%d\n", int((solve(n,m,q)+MOD*2)%MOD));
}

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#define M 1000000007
using namespace std;
typedef long long LL;
const int maxn = 100005;
LL n,m,g;
LL C,dp[maxn];

void extend_gcd(LL a, LL b, LL &x, LL &y, LL d=1)
{
    if (b == 0)
    {
        d = a, x = 1, y = 0;
    }
    else
    {
        extend_gcd(b, a%b, y, x, d);
        y -= a/b*x;
    }
}

LL ni(LL x)
{
    LL p,q;
    extend_gcd(x,M,p,q);
    return p;
}

int main()
{
    while(cin>>n>>m>>g)
    {
        if(n == 0)
        {
            if(m % 2 == 1 - g) puts("1");
            else puts("0");
            continue;
        }

        m -= g;
        C = n + 1;  // C[n+1][1]
        if(n == 1) dp[1] = 2;
        else dp[1] = n;

        for(int i=2; i<=m; i++)
        {
            C = C * (n + i) % M;
            C = C * ni(i) % M;
            C %= M;

            dp[i] = (C - dp[i-1]) % M;
            dp[i] = (dp[i] + M) % M;
        }
        cout << dp[m] << endl;
    }
    return 0;
}

#include <iostream>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <list>
#include <deque>
#define FOR(i,a,b) for (int i=(a),_b=(b);i<=_b;i++)
#define DOWFOR(i,a,b) for (int i=(a),_b=(b);i>=_b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define Reset(c,x) memset(c,x,sizeof(c))
using namespace std;
//-------------------------------------------------------------------
int gcd(int xx, int yy) // greatest common divisor
{
    while (yy != 0)
    {
        xx = xx%yy;
        swap(xx, yy);
    }
    return xx;
}
//-------------------------------------------------------------------
int lcm(int xx, int yy) // least common mutiple
{
    return (xx / gcd(xx, yy))*yy;
}
//---------------------------------------------------------------------
int Power(int a, int x, int base = -1)
{
    if (base == -1){
        if (x == 1) return a;
        else if (x == 0) return 1;
        int temp = Power(a, x / 2);
        temp = temp * temp;
        if (x % 2 == 1) return temp * a;
        else return temp;
    }
    else{
        if (x == 1) return a % base;
        else if (x == 0) return 1;
        int temp = Power(a, x / 2, base);
        temp = (1ll * temp * temp) % base;
        if (x % 2 == 1) return (1ll * temp * a) % base;
        else return temp;
    }
}
//---------------------------------------------------------------------
const int MAXN = 100 * 1000 + 1;
const int MAXM = 100 * 1000 + 1;
const int base = 1000 * 1000 * 1000 + 7;
int n, m, g, res;
int GT[MAXN + MAXM];
//---------------------------------------------------------------------
int C(int nn, int kk)
{
    if (nn < kk || nn < 0) return 0;
    if (kk == 0) return 1;
    int temp = (1ll * GT[kk] * GT[nn - kk]) % base;
    temp = Power(temp, base - 2, base);
    temp = (1ll * GT[nn] * temp) % base;
    return temp;
}
//---------------------------------------------------------------------
void DoSth()
{
    res = 0;
    if ((n + m) % 2 == g && m == 1) res++;
    if (n == 0 && g == 0) res++;
    if (m == 0) res = res + (n + 1) % 2;
    FOR(i, 1, n + 1)
    if (g != i % 2)
        res = (1ll * res + C(n + m - i, n - i + 1) ) % base;
    cout << res;
}
//---------------------------------------------------------------------
void ReadInput()
{
    cin >> n >> m >> g;
}
//---------------------------------------------------------------------
void Process()
{
    GT[0] = 1;
    FOR(i, 1, n + m) GT[i] = (1ll * GT[i - 1] * i) % base;
    DoSth();
}
//---------------------------------------------------------------------
int main()
{
    ReadInput();
    Process();
    return 0;
}

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;

int n,m,g;
long long fac[200010];

void init()
{
    fac[0]=fac[1]=1;
    for(int i=2;i<=200000;i++)
        fac[i]=fac[i-1]*i%mod;
    return;
}

long long quick_pow(long long base, long long pow)
{
    long long ret=1;
    while(pow)
    {
        if(pow&1)
            ret=(ret*base)%mod;
        base=base*base%mod;
        pow>>=1;
    }
    return ret;
}

long long C(int r,int k)
{
    return fac[r]*quick_pow(fac[k]*fac[r-k]%mod,mod-2)%mod;
}

int main()
{
    cin>>n>>m>>g;
    if(n==0)
    {
       if(g==0) cout<<1<<endl;
       if(g==1) cout<<0<<endl;
    }
    if(m==0)
    {
        if(g==0)
        {
            if(n%2==1)
               cout<<1<<endl;
            else
               cout<<0<<endl;
        }
        else
        {
            if(n%2==1)
                cout<<0<<endl;
            else
                cout<<1<<endl;;
        }
        return 0;
    }
    init();
    long long all=C(n + m,n);
    long long ans=0;
    for(int t=0;t<=n;t+=2)
        ans=(ans+C(n+m-1-t,m-1))%mod;
    if(m==1&&(n&1)==0)
        ans=(ans-1+mod)%mod;
    if(m==1&&(n&1)) ans=(ans+1%mod);
    if(g==0) cout<<ans<<endl;
       else cout<<(all-ans+mod)%mod<<endl;
    return 0;
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
#include <queue>
#include <vector>
#include <string>
#include <cmath>
#define Mod (1000000007LL)
#define eps (1e-8)
#define Pi (acos(-1.0))
using namespace std;
long long ans;
long long Power(long long x,long long k)
{
    long long tmp=1;
    while(k)
    {
        if(k&1) tmp=tmp*x%Mod;
        x=x*x%Mod;
        k>>=1;
    }
    return tmp;
}
long long Inv(long long x)
{
    return Power(x,Mod-2LL);
}
int n,m,g,s;
long long f[200100];
long long C(int x,int y)
{
    if(n>1)printf("(%d %d)\n",x,y);
    if(x==0) return 0;
    long long tmp;
    tmp=f[x]*Inv(f[y])%Mod;
    tmp=tmp*Inv(f[x-y])%Mod;
    return tmp;
}
int main()
{
    f[0]=1;
    for(long long i=1;i<=200000LL;i++)
    f[i]=f[i-1]*i%Mod;
    while(~scanf("%d%d%d",&m,&n,&g))
    {
        ans=0;
        if(n==0)
        {
            ans=m%2;
        }
        else
        {
            s=n+m;
            for(int i=s-1;i>=n-1;i--)
            {
                if((s-i)%2)
                {
                    ans+=C(i,n)+C(i,n-1);
                    ans%=Mod;
                }
                else
                {
                    ans+=2LL*Mod-C(i,n)-C(i,n-1);
                    ans%=Mod;
                }
            }
        }
        if(g==0) printf("%I64d\n",ans);
        else
        {

            ans=C(n+m,n)+Mod-ans;
            ans%=Mod;
            printf("%I64d\n",ans);
        }
    }
    return 0;
}

#include<iostream>
#include<vector>
#include<fstream>
#include<queue>
#include<algorithm>
#include<list>
#include<cstdio>
#include<stack>
#include<cstring>
#include<cmath>
#include<string>
#include <functional>
#include<sstream>
#include<map>
using namespace std;
#define     For(i,a,b)        for (int i=a; i<b; i++)
#define     Rep(i,a)          for (int i=0; i<a; i++)
#define     FIT(it,v)         for (typeof((v).begin())it=(v).begin(); it!=(v).end(); ++it)
#define     ALL(v)            (v).begin(),(v).end()
#define     Set(a,x)          memset((a),(x),sizeof(a))
#define     EXIST(a,b)        find(ALL(a),(b))!=(a).end()
#define     Sort(x)           sort(ALL(x))
#define     GSORT(x)          sort(ALL(x), greater<typeof(*((x).begin()))>())
#define     UNIQUE(v)         Sort(v); (v).resize(unique(ALL(v)) - (v).begin())
#define     MP                make_pair
#define     SF                scanf
#define     PF                printf
#define     MAXN               200001
#define     MAXM               1001
#define     MOD               1000000007
#define     Dbug             cout<<"";
#define     hsh              2654435761 // %1<<x (x=60)
#define     EPS              1e-15
typedef long long ll;
typedef pair<int,int> pii;
ll pw(ll a, ll b)
{
    ll ret=1;
    while (b)
    {
        if(b&1) ret=(ret*a)%MOD;
        a=(a*a)%MOD;
        b/=2;
    }
    return ret;
}
ll fact[MAXN];
ll rec(int n, int m, int g)
{
    if(n+m<=2)
    {
        if(g==1 && n==2) return 1;
        if(g==0 && n==1 && m==1) return 2;
        else if(g==0 && m==2) return 1;
        return 0;
    }
    if(g) if(m) return rec(n-1, m, 0);
    if(!g)
    {
        ll ret=0;
        if(n) ret=(((fact[n+m-1]*pw(fact[n], MOD-2))%MOD)*pw(fact[m-1], MOD-2))%MOD;
        if(m) ret=(ret+rec(n-1, m, 1))%MOD;
        return ret;
    }
    return 0;
}
int main(){
    //ios_base::sync_with_stdio(false);
    //freopen("a.in","r",stdin);
    int n, m, g;
    fact[0]=1;
    For(i, 1, MAXN) fact[i]=fact[i-1]*i;
    cin>>n>>m>>g;
    if(g) cout<<rec(n, m, 1)+rec(n-1, m, 0)<<endl;
    else cout<<rec(n, m, 0)<<endl;
    return 0;
}

#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
using namespace std;
int const MOD = 1000000007;
int const N = 100010;
typedef long long LL;
LL fac[N];
int n,m,g;
LL pow(LL a,LL p)
{
   LL x=1;
   while(p)
   {
         if(p&1)
         x=(x*a)%MOD;
         p>>=1;
         a=(a*a)%MOD;
   }
   return x;
}
void pre()
{
    fac[1]=1;
    for(int i=2;i<=100000;i++)fac[i]=(fac[i-1]*i)%MOD;
}
LL cnm(int i,int j)
{
   LL up=fac[i];
   LL down=(fac[j]*fac[i-j])%MOD;
   return (up*((pow(down,MOD-2))%MOD))%MOD;
}
int main()
{
    pre();
    int i,j;
    while(~scanf("%d %d %d",&n,&m,&g))
    {
          LL ans=0;
          if(n==0&&g==0)ans=1;
          if(m==0)
          {
             int l=n&1,r=g&1;
             if(l!=r)ans=1;
          }
          if(n!=0&&m!=0)
          {
             if(g==1)n--;
             if(n==0)ans=0;
             else
             {
                m--;
                int cnt=n+m;
                if(n==1)
                {
                   ans=2;
                }
                else
                while(n>=0)
                {
                      ans=(ans+cnm(cnt,n))%MOD;
                      n-=2;
                      cnt-=2;
                }
             }
          }
          printf("%I64d\n",ans);
    }
    return 0;
}

#include<iostream>
#include<cstring>
#include<cstdio>
#include<map>
#include<string>
#include <algorithm>
#include<vector>
using namespace std;
typedef long long int64;
#define SZ(x) (int)x.size()
#define two(x) ((1)<<(x))

const int mod = int(1e9) + 7 ;
int n , m , g;
const int maxn =2* 100000 + 10 ;
int64 fac[ maxn ];
int64 inv[ maxn ];

int64 fast_power( int64 x, int y ){
    int64 res = 1, tmp= x % mod ;
    for( ; y ; y >>= 1 ){
        if( y & 1 ) res = (res* tmp ) % mod ;
        tmp = tmp*tmp % mod ;
    }
    return res;
}

void init (){
    fac[0]=1;
    for(int i=1; i < maxn ; ++i)
        fac[i] = 1LL*fac[i-1] * i % mod ;
    for(int i=0; i < maxn ; ++i)
        inv[i] = fast_power( fac[i], mod-2) ;
    return ;
}

int64 cal( int x,  int y ){
    if( x < 0 || y < 0 || x < y ) return 0;
    return fac[x] * inv[y] % mod * inv[ x- y ] % mod;
}

int gao( string x, int g){

    if(x=="") return 0;
    if(SZ(x)==3 && x[0]=='1') return 0;
    reverse(x.begin(),x.end());
    int res = (x[0]-'0');
    for(int i=1; i < SZ(x); ++i){
        res |= (x[i]-'0');
        res ^=1;
    }
    return res ==g ;
}

int main (){
    init();
    while( cin >> n >> m >> g ){
        int64 ans = 0 ;
        int tot = n + m ;
        int bg = 2 + ((tot & 1)==g);
       // cout << bg << endl;
        for(int i = bg ; i < tot ; i+=2){
            int left0 = n - ( tot - i -1) , left1 = m - 1;
            ans = ans + cal(i, left1 )  ;
            if( ans >= mod) ans-=mod;
        }
           // if( g == 0 ) ans += m==0 ;
        //vector< string > x;
        string x = "" ;

        if( m <= 2 ){
            for(int i =0 ; i < m ; ++i)
                    x +="1";
            //for(int i=0;  i < min(n,(tot%2));++i)
            if( tot  % 2 == 0 ||SZ(x)==0) ;
            else{
                if(SZ(x)%2==1) ;
                else{

                    x = "0"+x;
                }
            }

        }

        do{
            ans = ans + gao( x, g) ;
        } while(next_permutation(x.begin(), x.end())) ;
        cout << ans % mod << endl ;
    }
    return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

typedef __int64 ll;

const ll MOD = 1000000007;
int n, m, g;
ll f[200010];

ll power(ll b, int n)
{
    if(n == 0 || b == 0) return 1;
    if(n == 1) return b;
    ll ret = power(b, n/2);
    ret = ret*ret%MOD;
    if(n&1) ret = (ret*b)%MOD;
    return ret;
}

ll C(int n, int m)
{
    return f[n]*power(f[n-m], MOD-2)%MOD*power(f[m], MOD-2)%MOD;
}

int main()
{
    while(scanf("%d %d %d", &n, &m, &g) != EOF){
        if(n == 0){printf("%d\n", 1-g); continue;}
        if(m == 0 && n%2 == 1-g){puts("1"); continue;}
        if(m == 0 && n%2 == g){puts("0"); continue;}
        f[0] = 1;
        for(int i = 1; i <= n+m; i++) f[i] = (f[i-1]*i)%MOD;

        ll ans = 0;
        for(int i = 0; i <= n; i++){
            if(m == 1 && i == n){ans += (g == (i%2==0));}
            else if(i%2 == g){
                ans += C(n+m-i-1, m-1);
                ans %= MOD;
            }
        }
        printf("%I64d\n", ans);
    }
    return 0;
}

#include <cstdio>
#define MAXN 200005
#define MOD 1000000007

typedef long long llint;

int f[MAXN];
int n, m;
char g;

int inverse(const int& x){
    int ret = 1;
    for (int i=30; i>=0; i--){
        ret = ((llint)ret * ret) % MOD;
        if ((MOD-2) & (1 << i)) ret = ((llint)ret * x) % MOD;
    }

    return ret;
}

void calc(void){
    f[0] = f[1] = 1;
    for (int i=2; i<MAXN; i++) f[i] = ((llint)f[i-1] * i) % MOD;
}

int main(void){
    scanf ("%d%d %c", &n, &m, &g);

    int G = g - '0';
    calc();

    if (!m){
        if (n%2 != G) printf ("1\n");
        else printf ("0\n");
        return 0;
    }

    int sol = 0;
    for (int i=1; i<=n+1; i++){
        if (i == (n+1) && (m == 1)) { if ((i%2) == G) sol++; continue; }

        int N = n + m - i;
        int K = m - 1;
        if ((i%2) != G)
            sol += ((llint)f[N] * inverse(((llint)f[N-K] * f[K])%MOD))%MOD;
    }

    printf ("%d\n", sol);

    return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<queue>
#include<vector>
#define ll long long
using namespace std;
const int mo=1000000007;
int n,m,g;
ll f[100005],k[200005];
//f[i][j] + g[i][j] = C(m+n,m);(1有i个，0有j个,f表示变化后为1,g表示为0)
//i+j 前面加上0，则f[i][j]=g[i][j-1]= C(i+j-1,i-1)-f[i][j-1]
//f和j无关
ll pw(ll a,int p){
	if(p==0)	return 1;
	ll t=pw(a,p/2);
	if(p%2)	return ((t*t)%mo*a)%mo;
	else	return t*t%mo;
}

ll calc(int i,int j){
    if(j==0||j==i)	return 1;
    return k[i]*pw(k[j]*k[i-j]%mo,mo-2)%mo;
}
ll ans;
int main(){
//	freopen("i.txt","r",stdin);
	scanf("%d%d%d",&n,&m,&g);
	f[0]= m==1? 1:0;
	k[1]=1;
	for(int i=2;i<=n+m;i++)
		k[i]=(k[i-1]*i)%mo;
	for(int i=1;i<=n;i++)
		f[i]=(calc(i+m-1,i-1)-f[i-1])%mo;
	if(g)	ans=f[n];
	else	ans=(calc(n+m,n)-f[n]+mo)%mo;
	cout<<ans;
	return 0;
}

#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <ctime>
#include <cmath>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd paur<double, double>
#define fi first
#define se second
#define forn(i,a,b) for( int i = (a); i < (b); i++ )
#define rep(i,n) for( int i = 0; i < (n); i++ )
#define forever for(;;)

const int MXN = 100100;
const int MXK = 510;
const int inf = (int)1e9+5;
const ll linf = (ll)1e18;

const int mod = 1000000007;

int cnt [2], target;
ll fact [MXN];
ll rfact [MXN];

ll mul( ll a, ll b ){
    return (a*b)%mod;
}

ll powmod(ll a, int n){
    ll res = 1;
    while(n){
        if(n&1){
            res = mul(res,a);
        }
        a = mul(a,a);
        n>>=1;
    }
    return res;
}

int getC( int n, int k ){
    if(k==0) return 1;
    if(n==0) return 0;

    ll res = fact[n];
    res = mul(res,rfact[n-k]);
    res = mul(res,rfact[k]);
    return res;
}

void solve() {
    fact[0] = 1;
    rfact[0] = 1;
    rep(i,MXN){
        if(!i) continue;
        fact[i] = mul(fact[i-1], i);
        rfact[i] = powmod(fact[i], mod-2);
    }
    if( cnt[1] == 0 ){
        if( (cnt[0]&1)!=target ){
            cout<<1;
            return;
        }
        else{
            cout<<0;
            return;
        }
    }
    if( cnt[0] == 0 ){
        if( cnt[1] > 1 ){
            if( target == 0 ){
                cout<<1;
                return;
            }
            else{
                cout<<0;
                return;
            }
        }
        else{
            if( target == 1 ){
                cout<<1;
                return;
            }
            else{
                cout<<0;
                return;
            }
        }
    }
    int answer = 0;
    for( int i = 0; i<=cnt[0]; i++ ){
        int total = cnt[0] + cnt[1] - 1 - i;
        if( total > 0 ){
            if( (i&1)==target ){
                answer+=getC(total, cnt[1] - 1);
                if( answer >= mod ) answer -= mod;
            }
        }
        else{
            if( (i&1)!= target ){
                answer+=getC(total, cnt[1] - 1);
                if( answer >= mod ) answer -= mod;
            }
        }
    }
    cout<<answer;
}
int main() {
    cin>>cnt[0]>>cnt[1]>>target;
    solve();
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

#define mod 1000000007
#define oo 0x3f3f3f3f
#define LL long long

int fac[200005];
int inv[200005];

int PowMod( LL a, int b ) {
	LL res = 1;
	while( b ) {
		if( b & 1 )
			res = res * a % mod;
		b >>= 1;
		a = a * a % mod;
	}
	return res;
}

int C(int n, int m) {
	n += m;
	LL res = 1;
	res = res * fac[n] % mod;
	res = res * inv[m] % mod;
	res = res * inv[n-m] % mod;
	return res;
}

int main()
{
	fac[1] = 1;
	for( int i = 2; i <= 200001; ++i ) fac[i] = (fac[i-1] + 0LL) * i % mod;
	for( int i = 0; i <= 200001; ++i ) inv[i] = PowMod(i, mod - 2);
	int n, m, g;
	cin >> n >> m >> g;
	if( m == 0 ) {
		if( n & 1 )
			printf( "%d\n", 1 - g );
		else printf( "%d\n", g );
		return 0;
	}
	if( n == 0 ) {
		if( m == 1 )
			cout << g << endl;
		else cout << 1 - g << endl;
		return 0;
	}
	int ans = 0;
	for( int i = 1; i <= n; ++i ) {
		if( i & 1 ) {
			if( i == n && m == 1 ) {
				if( (n & 1) == 0 )
					ans = (ans + 1 ) % mod;
			}
			else ans = (ans + C(n - i, m - 1) ) % mod;
		}
	}
	if( g ) printf( "%d\n", ans );
	else printf( "%d\n", ((C(n, m) - ans) % mod + mod) % mod );
    return 0;
}

#include<iostream>
#include<cstdio>
#include<cstdlib>

using namespace std;

typedef long long ll;

ll pr = 1000000007;

ll powmodn(ll n, ll pow, ll mod)    {
    ll ans = 1;
    ll mul = n;
    n %= mod;
    while (pow) {
        if (pow & 1)    {
            ans *= mul;
        }
        mul *= mul;
        mul %= mod;
        ans %= mod;
        pow >>= 1;
    }
    return ans % mod;
}

ll fact[1000000];

ll inverse(ll n)  {
    return powmodn(n, pr - 2, pr);
}

ll cnk(ll n, ll k)  {
    ll x = fact[n+k];
    x  *= inverse(fact[k]);
    x %= pr;
    x *= inverse(fact[n]);
    x %= pr;
    return x;
}

ll have_zero(ll n, ll m, ll g)  {
    ll one_ret = 0, zero_ret = 0;
    if (n == 0) {
        if (m == 1) {
            zero_ret = 0;
            one_ret = 1;
        } else {
            zero_ret = 1;
            one_ret = 0;
        }
    }
    if (m == 0) {
        if (n&1) {
            zero_ret = 1;
            one_ret = 0;
        } else {
            zero_ret = 0;
            one_ret = 1;
        }
    }
    if (g == 0) {
        return zero_ret;
    } else {
        return one_ret;
    }
}

ll doit(ll n, ll m, ll g)   {
    if (n * m == 0) {
        return have_zero(n, m, g);
    }
    if (g == 1) return doit(n-1, m, 0);
    return doit(n-1, m, 1) + cnk(n, m-1) % pr;
}

int main()  {
    ll m, n, g;
    cin >> n >> m >> g;
    fact[0] = 1;
    for (int i = 1; i < n + m + 2; ++i)	{
    	fact[i] = fact[i-1] * i;
	fact[i] %= pr;
    }

    cout << doit(n, m, g) << endl;
}

//			be name khoda

#include <iostream>

using namespace std;

typedef long long ll;
const ll maxN = 321123;
const ll MOD = 1000000007;

ll fact[maxN], ans;

ll pw(ll p, int t)
{
	if(!t)
		return 1;
	ll now = pw(p, t / 2);
	now *= now;
	if(t % 2)
		now *= p;
	return now % MOD;
}

ll c(int i, int j)
{
	if(!j || i > j)
		return 0;
	if(!i)
		return 1;
	return fact[j] * pw(fact[i] * fact[j - i], MOD - 2) % MOD;
}

int main()
{
	int n, m, g;
	cin >> n >> m >> g;

	fact[0] = 1;
	for(int i = 1; i < maxN; i++)
		fact[i] = fact[i - 1] * i % MOD;

	if(!m)
	{
		cout << (n % 2 != g) << endl;
		return 0;
	}

	if(n == 1 && m == 1)
	{
		cout << 2 * (1 - g) << endl;
		return 0;
	}

	for(int i = 0; min(n + m - 2 * i - 1 - g, n - 2 * i - g) >= 0; i++)
		ans = (ans + c(n - 2 * i - g, n + m - 1 - g - 2 * i)) % MOD;
	cout << ans << endl;
	cin >> n;
}

#include <iostream>
using namespace std;
#define Maxn 200010
#define Mo 1000000007
#define ll long long
ll r[Maxn],fac[Maxn];
int n,m,g;

int pw(int n,int w)
{
    if (!w) return 1;
    ll ans=pw(n,w/2);
    ans=ans*ans%Mo;
    if (w&1) ans*=n;
    return ans%Mo;
}
int rev(int n)
{
    return pw(n,Mo-2);
}
int C(int n,int m)
{
    ll ans=fac[n];
    ans=ans*r[m]%Mo;
    ans=ans*r[n-m]%Mo;
    return ans;
}
int main()
{
    ios::sync_with_stdio(0);
    //freopen("1.txt","r",stdin);
    cin>>n>>m>>g;
    int ans=0;
    fac[0]=1;
    r[0]=rev(1);
    for (int i=1;i<=n+m;i++)
    {
        fac[i]=fac[i-1]*i%Mo;
//        cout<<fac[i]<<endl;
        r[i]=rev(fac[i]);
        //cout<<r[i]<<endl;
    }
    for (;n;n--)
    {
        //cout<<n+m-1<<' '<<n<<endl;
        //cout<<C(n+m-1,n)<<endl;
        if (!g) ans+=C(n+m-1,n);
        if (ans>Mo) ans-=Mo;
        g=1-g;
    //    cout<<n<<endl;
    }
    if (g&&m==1) ans++;
    if (!g&&m>1) ans++;
    cout<<ans<<endl;
}

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define MOD 1000000007

LL fact[111111];
LL invfact[111111];

LL inverse(LL a, LL mod){
	LL d0 = a, d1 = mod;
	LL x0 = 1, x1 = 0;
	LL dt, xt;
	while(d1 != 0){
		dt = d1;
		xt = x1;
		d1 = d0-(d0/dt)*dt;
		x1 = x0-(d0/dt)*xt;
		d0 = dt;
		x0 = xt;
	}
	if(x0 < 0)x0 = x0+mod;
	if(d0 == 1)return x0;
	else return -1;
}

LL comb(int p, int q){
	if(p<q)return 0;
	LL ret=fact[p];
	ret *= invfact[q];
	ret %= MOD;
	ret *= invfact[p-q];
	ret %= MOD;
	return ret;
}

LL C(int p, int q, int r){
	LL ret = 0;
	while(p>1){
		if(r==0){
			ret += comb(p+q-1, p);
			ret %= MOD;
		}else{
			ret += comb(p+q-2, p-1);
			ret %= MOD;
		}
		p-=2;
	}
	if(p==0){
		if(r==0){
			if(q!=1)ret+=1;
		}else{
			if(q==1)ret+=1;
		}
	}else{
		if(r==0){
			if(q==1)ret+=q+1;
			else ret+=q;
		}else{
			if(q!=1)ret+=1;
		}
	}
	ret %= MOD;
	return ret;
}

int main(){
	fact[0]=fact[1]=invfact[0]=invfact[1]=1;
	FOR(i,2,111111)fact[i] = (fact[i-1]*i)%MOD;
	FOR(i,2,111111)invfact[i] = inverse(fact[i], MOD);
	int n,m,g;
	cin>>n>>m>>g;
	cout << C(n,m,g) << endl;
	return 0;
}

#include <iostream>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <list>
#include <deque>
#define FOR(i,a,b) for (int i=(a),_b=(b);i<=_b;i++)
#define DOWFOR(i,a,b) for (int i=(a),_b=(b);i>=_b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define Reset(c,x) memset(c,x,sizeof(c))
using namespace std;
//-------------------------------------------------------------------
int gcd(int xx, int yy) // greatest common divisor
{
    while (yy != 0)
    {
        xx = xx%yy;
        swap(xx, yy);
    }
    return xx;
}
//-------------------------------------------------------------------
int lcm(int xx, int yy) // least common mutiple
{
    return (xx / gcd(xx, yy))*yy;
}
//---------------------------------------------------------------------
int Power(int a, int x, int base = -1)
{
    if (base == -1){
        if (x == 1) return a;
        else if (x == 0) return 1;
        int temp = Power(a, x / 2);
        temp = temp * temp;
        if (x % 2 == 1) return temp * a;
        else return temp;
    }
    else{
        if (x == 1) return a % base;
        else if (x == 0) return 1;
        int temp = Power(a, x / 2, base);
        temp = (1ll * temp * temp) % base;
        if (x % 2 == 1) return (1ll * temp * a) % base;
        else return temp;
    }
}
//---------------------------------------------------------------------
const int MAXN = 100 * 1000 + 1;
const int MAXM = 100 * 1000 + 1;
const int base = 1000 * 1000 * 1000 + 7;
int n, m, g, res;
int GT[MAXN + MAXM];
//---------------------------------------------------------------------
int C(int nn, int kk)
{
    if (nn < kk || nn < 0) return 0;
    if (kk == 0) return 1;
    int temp = (1ll * GT[kk] * GT[nn - kk]) % base;
    temp = Power(temp, base - 2, base);
    temp = (1ll * GT[nn] * temp) % base;
    return temp;
}
//---------------------------------------------------------------------
void DoSth()
{
    res = 0;
    if ((n + m) % 2 == g) res++;
    FOR(i, 1, n)
    if (g != i % 2)
        res = (1ll * res + C(n + m - i, n - i + 1)) % base;
    cout << res;
}
//---------------------------------------------------------------------
void ReadInput()
{
    cin >> n >> m >> g;
}
//---------------------------------------------------------------------
void Process()
{
    GT[0] = 1;
    FOR(i, 1, n + m) GT[i] = (1ll * GT[i - 1] * i) % base;
    DoSth();
}
//---------------------------------------------------------------------
int main()
{
    ReadInput();
    if (n == 0){
        if (g == 0) cout << 1;
        else cout << 0;
        return 0;
    }
    else if (m == 0){
        if (n % 2 != g) cout << 1;
        else cout << 0;
        return 0;
    }
    Process();
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define ll 		long long
#define mp 		make_pair
#define sz(v) 	(int)v.size()
#define pb    	push_back
#define first_time  1
#define s second
#define f first

ll const mod = 1000000007;
ll bst = 1, mkm = 1;
ll Pow(ll base, ll power) {
	if (power <= 0)
		return 1;
	if (power % 2)
		return (base * Pow((base * base) % mod, power / 2) % mod) % mod;
	return (Pow((base * base) % mod, power / 2) % mod) % mod;
}
ll Div(ll x, ll y) {

	x = (x + mod * 100LL) % mod;
	y = (y + mod * 100LL) % mod;
	return (Pow(y, mod - 2) * x) % mod;
}
ll C(ll &sz, ll &oth, bool time = 0) {
	if (sz < 0)
		return 0;
	if (first_time == time) {
		for (ll i = sz, T = 1; i > oth; --i, T++) {
			bst = (bst * i) % mod;
			mkm = (mkm * T) % mod;
		}
		if (sz == 0)
			return 0;
		return Div(bst, mkm);
	}

	bst = Div(bst, sz * (sz - 1));
	mkm = Div(mkm, oth * (oth - 1));
	return Div(bst, mkm);
}
bool valid(string s, bool wanted) {
	bool b = s[0] - '0';
	for (int i = 1; i < sz(s); ++i)
		if (!b && s[i] == '0')
			b = 1;
		else
			b = 0;
	return wanted == b;
}
int get_ans(string s, int ones, int zeros, int wanted, bool B) {
	if (zeros < 0 || ones < 0)
		return 0;
	if (sz(s) == wanted)
		if (ones == 0 && zeros == 0 && valid(s, B))
			return 1;
	return get_ans(s + '0', ones, zeros - 1, wanted, B)
			+ get_ans(s + '1', ones - 1, zeros, wanted, B);

}
int main() {
	ll ones, zeros, target;
	cin >> zeros >> ones >> target;
	if (zeros + ones <= 5) {
		cout << get_ans("", ones, zeros, ones + zeros, target);
		return 0;
	}
	ll tmpones = ones, tmpzeros = zeros;
	ll sz = ones + zeros - target - 1;
	zeros -= target;
	ll res = C(sz, zeros, first_time);
	while (sz - 2 > 0 && ones > 0) {
		res = (res + C(sz, zeros)) % mod;
		sz -= 2, zeros -= 2;
	}

	if (tmpones == 1 && (tmpones + tmpzeros) % 2 && target)
		res++;
	if (tmpones == 1 && (tmpones + tmpzeros) % 2 == 0 && !target)
		res++;
	cout << res << endl;
	return 0;
}

/*
ID : moreda
PROG : contest 336 D
LANG : C++
*/
/*
{I'm just a step away
I'm just a breath away
Losing my faith today
(Falling off the edge today)
I am just a man
Not superhuman
(I'm not superhuman)
Someone save me from the hate!

It's just another war
Just another family torn
(Falling from my faith today)
Just a step from the edge
Just another day in the world we live

I need a hero to save me now
I need a hero
(Save me now)

I need a hero to save my life
A hero'll save me
(Just in time)

I gotta fight today
To live another day
Speaking my mind today
(My voice will be heard today)
I've gotta make a stand
But I am just a man
(I'm not superhuman)
My voice will be heard today!

It's just another war
Just another family ton
(My voice will be heard today)
It's just another kill
The countdown begins to destroy ourselves

I need a hero to save me now
I need a hero
(Save me now)
I need a hero to save my life
A hero will save me
(just in time)

I need a hero to save my life
I need a hero
Just in time!
Save me just in time
Save me just in time

Who's gonna fight for what's right
Who's gonna help us survive
We're in the fight of our lives
(And we're not ready to die)

Who's gonna fight for the weak
Who's gonna make 'em believe
I've got a hero
(I've got a hero)
Living in me

I'm gonna fight for what's right
Today I'm speaking my mind
And if it kills me tonight
(I will be ready to die)

A hero's not afraid to give his life
A hero's gonna save me just in time

I need a hero to save me now
I need a hero
(Save me now)
I need a hero to save my life
A hero will save me
(Just in time)
I need a hero!

Who's gonna fight for what's right
Who's gonna help us survive

I need a hero!

Who's gonna fight for the weak
Who's honna make 'em believe

I need a hero!
I need a hero!

A hero's gonna save me just in in time!!!}*/
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

#define pii pair<int,int>
#define pil pair<int,ll>
#define piu pair<int,ull>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define ppl pair<pii,ll>
#define plp pair<ll,pii>
#define pip pair<int,pii>
#define ppi pair<pii,int>
#define ppp pair<pii,pii>
#define pdi pair<double,int>
#define pid pair<int,double>
#define pdp pair<double,pii>
#define pdd pair<double,double>
#define pd3 pair<pdd,double>
#define vi vector<int>
#define mat vector<vi>
#define vs vector<string>

#define pb         push_back
#define fo(i,a,b)  for(int i=a; i<b; ++i)
#define fr(i,a,b)  for(int i=b-1; i>=a; --i)
#define mp(a,b)    make_pair(a,b)
#define xx         first
#define yy         second
#define pi         3.141592653589793
#define ee         2.71828
#define BE(a)      a.begin(),a.end()
#define rev(a)     reverse(BE(a))
#define ss(a)      stable_sort(BE(a))
#define st(a)      sort(BE(a))
#define point      complex <long double>
#define X          real()
#define Y          imag()
#define lb(a,b,c)  lower_bound(a,b,c)

const double eps = 1e-15;
const int maxN = 2 * 100000 + 10, mod = (int) 1e9 + 7;

int n, m, g;
int d[maxN];

ll var(int p, int n1)
{
	if(n1==0)
		return 1;
	ll jj = var(p,n1/2);
	if(n1%2 == 0)
		return (jj*jj)%mod;
	else
		return ((jj*jj)%mod)*p%mod;
}

ll x(int m1, int n1)
{
	return (((ll)d[m1+n1] * var(d[n1],mod-2))%mod * var(d[m1],mod-2))%mod;
}

ll f(int n1, int m1, int g1)
{
	if(n1 == 2 && m1 == 0 && g == 1)
		return 1;
	if(n1 == 2 && m1 == 0 && g == 0)
		return 0;
	if(n1 == 0 && ((g1 == 1 && m1 != 1)||(g1  == 0 && m1 == 1)))
		return 0;
	if(n1 == 0)
		return 1;
	if(g1 == 0)
		return (f(n1-1,m1,1) + x(n1,m1-1))% mod;
	else
		return f(n1-1,m1,0) % mod;
}

int main(void)
{
	//ifstream cin("input.txt");
    ios_base::sync_with_stdio (0);
	cin >> n >> m >> g;
	d[0] = 1;
	fo(i,1,maxN)
		d[i] = ((ll)d[i-1]*i)%mod;
	if(n == 0 && m == 0)
		cout << 0;
	else
		cout << f(n,m,g);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MD = 1000000007;
int N, M, G;

int mpow(int a, int b)
{
	int r = 1;
	while(b){
		if(b & 1) r = (ll)r * a % MD;
		a = (ll)a * a % MD; b >>= 1;
	}
	return r;
}
int mdiv(int a, int b)
{
	return (ll)a * mpow(b, MD-2) % MD;
}

int main()
{
//	freopen("in.txt", "r", stdin);
	scanf("%d%d%d", &N, &M, &G);
	if(G == 1) N--;
	if(N < 0 || N + M < 1) printf("0\n");
	else{
		int t = 1;
		for(int i = N+1; i <= N+M-1; i++) t = (ll)t * i % MD;
		int ans = t;
		for(int i = N+M-1; i > M; i -= 2){
			t = mdiv(t, (ll)i*(i-1));
			t = (ll)t * (i-M+1) % MD;
			t = (ll)t * (i-M) % MD;
			ans = (ans+t) % MD;
		}
		t = 1;
		for(int i = 2; i <= M-1; ++i) t = (ll)t * i % MD;
		ans = mdiv(ans, t);
		if((N & 1) && (M == 1)) ans++;
		printf("%d\n", ans % MD);
	}
	return 0;
}

/*
ID : moreda
PROG : contest 336 D
LANG : C++
*/
/*
{I'm just a step away
I'm just a breath away
Losing my faith today
(Falling off the edge today)
I am just a man
Not superhuman
(I'm not superhuman)
Someone save me from the hate!

It's just another war
Just another family torn
(Falling from my faith today)
Just a step from the edge
Just another day in the world we live

I need a hero to save me now
I need a hero
(Save me now)

I need a hero to save my life
A hero'll save me
(Just in time)

I gotta fight today
To live another day
Speaking my mind today
(My voice will be heard today)
I've gotta make a stand
But I am just a man
(I'm not superhuman)
My voice will be heard today!

It's just another war
Just another family ton
(My voice will be heard today)
It's just another kill
The countdown begins to destroy ourselves

I need a hero to save me now
I need a hero
(Save me now)
I need a hero to save my life
A hero will save me
(just in time)

I need a hero to save my life
I need a hero
Just in time!
Save me just in time
Save me just in time

Who's gonna fight for what's right
Who's gonna help us survive
We're in the fight of our lives
(And we're not ready to die)

Who's gonna fight for the weak
Who's gonna make 'em believe
I've got a hero
(I've got a hero)
Living in me

I'm gonna fight for what's right
Today I'm speaking my mind
And if it kills me tonight
(I will be ready to die)

A hero's not afraid to give his life
A hero's gonna save me just in time

I need a hero to save me now
I need a hero
(Save me now)
I need a hero to save my life
A hero will save me
(Just in time)
I need a hero!

Who's gonna fight for what's right
Who's gonna help us survive

I need a hero!

Who's gonna fight for the weak
Who's honna make 'em believe

I need a hero!
I need a hero!

A hero's gonna save me just in in time!!!}*/
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

#define pii pair<int,int>
#define pil pair<int,ll>
#define piu pair<int,ull>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define ppl pair<pii,ll>
#define plp pair<ll,pii>
#define pip pair<int,pii>
#define ppi pair<pii,int>
#define ppp pair<pii,pii>
#define pdi pair<double,int>
#define pid pair<int,double>
#define pdp pair<double,pii>
#define pdd pair<double,double>
#define pd3 pair<pdd,double>
#define vi vector<int>
#define mat vector<vi>
#define vs vector<string>

#define pb         push_back
#define fo(i,a,b)  for(int i=a; i<b; ++i)
#define fr(i,a,b)  for(int i=b-1; i>=a; --i)
#define mp(a,b)    make_pair(a,b)
#define xx         first
#define yy         second
#define pi         3.141592653589793
#define ee         2.71828
#define BE(a)      a.begin(),a.end()
#define rev(a)     reverse(BE(a))
#define ss(a)      stable_sort(BE(a))
#define st(a)      sort(BE(a))
#define point      complex <long double>
#define X          real()
#define Y          imag()
#define lb(a,b,c)  lower_bound(a,b,c)

const double eps = 1e-15;
const int maxN = 2 * 100000 + 10, mod = (int) 1e9 + 7;

int n, m, g;
int d[maxN];

ll var(int p, int n1)
{
	if(n1==0)
		return 1;
	ll jj = var(p,n1/2);
	if(n1%2 == 0)
		return (jj*jj)%mod;
	else
		return ((jj*jj)%mod)*p%mod;
}

ll x(int m1, int n1)
{
	return (((ll)d[m1+n1] * var(d[n1],mod-2))%mod * var(d[m1],mod-2))%mod;
}

ll f(int n1, int m1, int g1)
{
	if(n1 == 2 && m1 == 0 && g == 1)
		return 1;
	if(n1 == 2 && m1 == 0 && g == 0)
		return 0;
	if(n1 == 1 && m1 == 1 && g == 1)
		return 0;
	if(n1 == 1 && m1 == 1 && g == 0)
		return 2;
	if(n1 == 0 && m1 == 2 && g == 1)
		return 0;
	if(n1 == 0 && m1 == 2 && g == 0)
		return 1;
	if(n1 == 0 && g == 0)
		return 1;
	if(n1 == 0 && g == 1)
		return 0;
	if(g1 == 0)
		return (f(n1-1,m1,1) + x(n1,m1-1))% mod;
	else
		return f(n1-1,m1,0) % mod;
}

int main(void)
{
	//ifstream cin("input.txt");
    ios_base::sync_with_stdio (0);
	cin >> n >> m >> g;
	d[0] = 1;
	fo(i,1,maxN)
		d[i] = ((ll)d[i-1]*i)%mod;
	if(n == 0 && m == 0)
		cout << 0;
	else
		cout << f(n,m,g);
	return 0;
}

#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

vector<ll> sil(500000);

ll Pot(ll a, ll b)
{
    if (b == 0)
        return 1;
    if (b % 2 == 0)
    {
        ll x = Pot(a, b / 2);
        return x * x % MOD;
    }
    else
        return Pot(a, b - 1) * a % MOD;
}

ll Inv(ll a)
{
    return Pot(a, MOD - 2);
}

ll C(ll n, ll k)
{
    return sil[n] * (Inv(sil[n - k]) * Inv(sil[k]) % MOD) % MOD;
}

int main()
{
    ios_base::sync_with_stdio(0);
    sil[0] = 1;
    for (ll i = 1; i < 500000; ++i)
        sil[i] = (sil[i - 1] * i) % MOD;
    ll z, j, kon;
    cin >> z >> j >> kon;
    ll kon1 = 0, kon0 = 0;
    if (z == 0)
    {
        kon0 = 1;
        kon1 = 0;
        if (kon == 0)
            cout << kon0;
        else
            cout << kon1;
        return 0;
    }
    if (j == 0)
    {
        if (z % 2 == 0)
        {
            kon1 = 1;
            kon0 = 0;
        }
        else
        {
            kon1 = 0;
            kon0 = 1;
        }
        if (kon == 0)
            cout << kon0;
        else
            cout << kon1;
        return 0;
    }
    for (ll i = 1; i <= z; i += 2)
        if (i + 1 < z + j)
            kon1 = (kon1 + C((z + j) - (i + 1), z - i)) % MOD;
    if (z % 2 == 0 && j == 1)
        ++kon1;
    kon0 = C(z + j, z) - kon1;
    if (kon0 < 0)
        kon0 += MOD;
    if (kon == 0)
        cout << kon0;
    else

        cout << kon1;
    return 0;
}

//Fruit of Light
//FoL CC
//Apple Strawberry

#include<cstdio>
#include<algorithm>
#include<vector>
#include<iostream>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<cstring>

using namespace std;

#define For(i, n) for(int i = 0; i<(n); ++i)
#define ForEach(it, i) for(typeof i.begin() it = i.begin(); it!=i.end(); ++it)

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

#define MOD 1000000007
          // 123456789
#define MAXN 200047

int n,m,q;
ll inv[MAXN], fak[MAXN], ifak[MAXN];

inline ll total(ll a, ll b){
    return (fak[a+b] * ((ifak[a] * ifak[b])%MOD)) % MOD;
}

ll solve(ll a, ll b, ll c){
    if (b==0){
        return ((a>1)==c);
    }
    if (a==0){
        return ((b==1)==c);
    }
    if (c) a--;
    return (total(a,b) - solve(a,b,1))%MOD;
}

int main(){
    fak[0] = ifak[0] = 1;
    For(i,MAXN-10){
        {
            ll a = 1, x = i+1, y = MOD-2;
            while(y>0){
                if (y%2) a = (a*x)%MOD;
                x = (x*x)%MOD;
                y/=2;
            }
            inv[i+1] = a;
            ifak[i+1] = (inv[i+1]*ifak[i])%MOD;
        }
        fak[i+1] = (ll(i+1)*fak[i])%MOD;
        //if (i<20)
          // cout << inv[i] << " " << fak[i] << " " << ifak[i] << endl;
    }
    //cout << total(2, 3) << endl;
    scanf("%d%d%d",&n, &m, &q);
    printf("%d\n", int((solve(n,m,q)%MOD+MOD*2)%MOD));
}

#include <bits/stdc++.h>
#define int long long
using namespace std;
long long fact[1000005];
void f(int n)
{
    fact[0] = 1;
    for(int i = 1; i <= n; i ++)
    {
        fact[i] = (1LL * fact[i - 1] * 1LL * i) % 1000000007;
        fact[i] %= 1000000007;
    }
}

int invmod(int n, int k)
{
    if(k == 0)
        return 1;
    if((k & 1) == 0)
    {
        long long rez = invmod(n, (k >> 1));
        return (1LL * rez * rez) % 1000000007;
    }
    return (invmod(n, k - 1) * n) % 1000000007;
}

int combinari(int n, int k)
{
    long long fk = fact[k];
    long long fn = fact[n];
    long long fnk = fact[n - k];
    long long total = 1LL * fk * fnk;
    total = total % 1000000007;
    return (fn * invmod(total, 1000000005)) % 1000000007;
}
int32_t main()
{
    int n, m, k;
    cin >> n >> m >> k;
    if(m == 0)
    {
        if(n % 2 != k)
            cout << "1";
        else
            cout << "0";
        return 0;
    }
    if(n == 0)
    {
        if(m)
        {
            if(k == 0)
                cout << "1";
            else
                cout << "0";
        }
        else
        {
            if(k == 1)
                cout << "1";
            else
                cout << "0";
        }
        return 0;
    }
    f(300005);
    long long s = 0;
    for(int i = 0; i <= n; i ++)
    {
        if(n + m - i - 1 > 0)
        {
            if(i % 2 == k)
            {
                s += combinari(n + m - i - 1, m - 1);
                s = s % 1000000007;
            }
        }
        else
        {
            if(i % 2 != k)
            {
                s += combinari(n + m - i - 1, m - 1);
                s = s % 1000000007;
            }
        }
    }
    cout << s;
    return 0;
}

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#define MOD 1000000007
#define int long long
using namespace std;
const int N = 100000;
int n, m, g, inv[N + 5], fac[N + 5], invf[N + 5];
inline void prework() {
	inv[0] = inv[1] = fac[1] = invf[1] = fac[0] = invf[0] = 1;
	for(int i = 2; i <= N; i++) fac[i] = (fac[i - 1] * i) % MOD;
	for(int i = 2; i <= N; i++) inv[i] = (MOD - MOD / i) * inv[MOD % i] % MOD;
	for(int i = 2; i <= N; i++) invf[i] = invf[i - 1] * inv[i] % MOD;
}
inline int C(int a, int b) {
	return fac[a] * invf[b] % MOD * invf[a - b] % MOD;
}
signed main() {
	prework();
	scanf("%lld%lld%lld", &n, &m, &g);
	if(n == 0) {
		if(m == 1 && g == 1 || m > 1 && g == 0)
			printf("1\n");
		else printf("0\n");
		return 0;
	}
	if(m == 0) {
		printf("%d\n", ( (n % 2) ^ 1 ) == g );
		return 0;
	}
	int ans = 0;
	if(m == 1 && n % 2 == 0) ans = 1;
	for(int i = 1; i <= n; i += 2) {
		int num0, num1;
		num0 = n - i, num1 = m - 1;
		if(num1 + num0)
		    ans = (ans + C(num1 + num0, num0)) % MOD;
	}
	if(g == 1) printf("%lld\n", ans);
	else printf("%lld\n", (C(n + m, m) - ans + MOD) % MOD);
	return 0;
}

//satyaki3794
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <algorithm>
#include <climits>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cctype>
#include <cassert>
#include <bitset>
#include <iomanip>
#define gc getchar_unlocked
#define pc putchar_unlocked
#define PI (3.14159265)
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define INF (100000005)
#define SIZE (2)
#define TREESIZE (302144)
#define LEFT(n) (2*n)
#define RIGHT(n) (2*n+1)
#define epsilon 1e-8 //add to double before casting to integer

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;

#define matrix vector< vector<ll> >

matrix matmul(matrix &a, matrix &b){
    int i, j, k, n = a.size();
    matrix ans (n, vector<ll>(n));
    for(i=0;i<n;i++)
        for(j=0;j<n;j++){
            ll temp = 0;
            for(k=0;k<n;k++)    temp = (temp + a[i][k] * b[k][j]) % MOD;
            ans[i][j] = temp;
        }

    return ans;
}

matrix matpwr(matrix &a, ll p){
    int n = a.size();
    matrix ans(n, vector<ll> (n));
    for(int i=0;i<n;i++)    ans[i][i] = 1;

    while(p){
        if(p&1) ans = matmul(ans, a);

        a = matmul(a, a);
        p >>= 1;
    }
    return ans;
}

ll pwr(ll base, ll p, ll mod = MOD){
    ll ans = 1;
    while(p){
        if(p & 1)   ans = (ans * base) % mod;
        base = (base * base) % mod;
        p /= 2;
    }
    return ans;
}

ll gcd(ll a, ll b){
    if(b == 0)  return a;
    return gcd(b, a%b);
}

ll lcm(ll a, ll b){
    return (a*b) / gcd(a, b);
}

ll invMod(ll n, ll mod = MOD){
    return pwr(n, mod-2);
}

ll fac[200005], invFac[200005];

ll C(int n, int r){

    if(r > n || n-r > n || n-r < 0 || r < 0)    return 0;

    ll ans = fac[n];
    ans = (ans * invFac[r]) % MOD;
    ans = (ans * invFac[n-r]) % MOD;
    return ans;
}

int main()
{
    ios_base::sync_with_stdio(0);
    // freopen("input.txt", "r", stdin);

    int ones, zeroes, g;
    cin>>zeroes>>ones>>g;

    fac[0] = invFac[0] = 1;
    for(int i=1;i<=200000;i++){
        fac[i] = (fac[i-1] * i) % MOD;
        invFac[i] = invMod(fac[i]);
    }

    //1_ , 001_ , 00001_ always reduce to 0
    //01_ , 0001_ always reduce to 1
    //the position of the first one decides the result

    if(zeroes == 0){
        if(g == 0 || ones == 1) cout<<"1";
        else    cout<<"0";
        return 0;
    }

    if(ones == 0){
        if((zeroes%2 == 1 && g == 0) || (zeroes%2 == 0 && g == 1))  cout<<"1";
        else    cout<<"0";
        return 0;
    }

    int n = zeroes+ones;
    //iterate over all possible positions of the first 1

    ll ans = 0;
    for(int i=1;i<=n;i++){

        //consider this position has first 1, with previous all 0s
        int rem_zeroes = zeroes - (i-1), rem_ones = ones - 1;
        if(rem_ones < 0 || rem_zeroes < 0)  continue;

        int last = (i == n ? 1 : 0);
        int result = ((i-1)%2 == 0 ? last : 1-last);
        if(result == g) ans += C(n-i, rem_zeroes);
    }

    ans %= MOD;
    if(ans < 0) ans += MOD;
    cout<<ans;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;
#define ll long long

const int M = 1000000007;
ll ans = 0;
ll preproc[200000 + 5];
ll preprocDiv[200000 + 5];

ll POW(ll number, ll power){
	//cout << "nb: " << number << "pow: " << power << endl;
	if(power == 0)
		return 1;
	if(power % 2 == 0){
		ll result = POW(number,power / 2) % M;
		return (result * result) % M;
	}
	else{
		return (POW(number,power - 1) * number) % M;
	}
}
int main(){
	int n,m,g;
	scanf("%i %i %i", &n, &m, &g);

	preproc[0] = 1;
	preprocDiv[0] = 1;
	for(int i = 1; i <= n + m; i++){
		preproc[i] = (preproc[i - 1] * i) % M;
		preprocDiv[i] = (ll)(preprocDiv[i - 1] * POW(i,M - 2)) % M;
	//	cout << "i:"<<i<<"prc:"<<preproc[i]<< " div:"<< preprocDiv[i] << endl;
	}

	for(int i = 1; i <= n - 1; i += 2){
		int N = n + m - i - 1;
		int K = n - i;
		//cout << "N : " << N << " K : " << K << endl;
		ans += ((((preproc[N]) * preprocDiv[K]) % M) * preprocDiv[N - K]) % M;
		//cout << "preproc[n: " << preproc[] << endl;
		//cout << "x : " << x << endl;
		//ans += x;
		//cout << "ans :" << ans << endl;
	}
	if(n % 2 == 0 && m == 1)
		ans++;
	if(n % 2 == 0 && m == 0){
		ans = 1;
	}
	ans %= M;
	if(g == 1)
		printf("%llu", ans);
	else{
		//cout << "ans przed :" << ans << endl;
		ans = -ans;
		ans += (((preproc[n + m] * preprocDiv[n]) % M) * preprocDiv[m]) % M;
		ans %= M;
		ans = (ans + M) % M;
		printf("%llu", ans);
	}
	return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define mod 1000000007
using namespace std;

ll pow2(ll a,ll b)
{
    if(a == 1)
    return 1;
    if(b == 0)
    return 1;
    if(b == 1)
    {
        return a%mod;
    }
    if(b%2 == 0)
    {
        ll x = pow2(a,b/2);
        return (x * x)%mod;
    }
    ll x = pow2(a,b-1);
    return (a%mod * x)%mod;
}

ll modi(ll x)
{
    return pow2(x,mod-2);
}
int main()
{
    ll n,m,g,fact[200005],x;
    fact[0] = fact[1] = 1;
    for(int i=2; i<200005; ++i)
    {
        fact[i] = (i * fact[i-1])%mod;
    }
    cin>>n>>m>>g;
    if(n == 0 && m == 0)
    cout<<0;
    else if(n == 0)
    {
        if(g == 1)
        {
            if(m == 1)
            cout<<1;
            else
            cout<<0;
        }
        else{
        if(m != 1)
        cout<<1;
        else{
            cout<<0;
        }
        }
    }
    else if(m == 0)
    {
        if(g == 1)
        {
            if(n%2 == 0)
            {
                cout<<1;
            }
            else
            cout<<0;
        }
        else{
            if(n%2 != 0)
            {
                cout<<1;
            }
            else
            cout<<0;
        }
    }
    else if(n == 1 && m == 1)
    {
        if(g == 1)
        cout<<0;
        else
        cout<<2;
    }
    else{
        ll ans = 0;
        if(g == 0)
        m -= 1;
        else{
            m -= 1;
            n -= 1;
        }
        x = modi(fact[m]);
       // ans += ((fact[n+m] * modi(fact[n]))%mod * x)%mod;
        while(n > 0)
        {
            ans += ((fact[n+m] * modi(fact[n]))%mod * x)%mod;
            //cout<<n<<" "<<m<<" "<<fact[n+m]<<" "<<modi(fact[n])<<"\n";
           // if(n <= 10)
            //cout<<n<< " "<< ans<<"\n";
            n -= 2;
        }
        if(n == 0 && m >= 1)
        ans++;
        ans %= mod;
        cout<<ans;
    }
}

										/* in the name of Allah */
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <list>
#include <map>
#include <set>

using namespace std;

#define uint unsigned int
#define int64 long long
#define P pair<int, int>
#define Pss pair<string, string>
#define PLL pair<int64, int64>
#define Inf 1000000
#define Mod 1000000007LL

int64 fact[200010];

int64 modP(int64 x, int64 y){
	int64 ret = 1;
	while(y){
		if(y & 1)
			ret = (ret * x) % Mod;
		x = (x * x) % Mod;
		y >>= 1;
	}
	return ret;
}

int64 bt(int n, int m, int d){
	if(n + m == 1){
		if((n == 1 && d == 0) || (m == 1 && d == 1))
			return 1;
		return 0;
	}
	if(d == 0){
		int64 res = 0;
		if(m > 0){
			int t1 = modP(fact[n], Mod - 2);
			int t2 = modP(fact[m - 1], Mod - 2);
			int tmp = (t1 * t2) % Mod;
			res = (tmp * fact[n + m - 1]) % Mod;
		}
		if(n > 0)
			res = (res + bt(n - 1, m, 1)) % Mod;
		return res;
	}
	if(n > 0)
		return bt(n - 1, m, 0);
	return 0;
}

int main(){
	fact[0] = 1;
	for(int i = 1; i <= 200000; i++)
		fact[i] = (fact[i - 1] * i) % Mod;
	int n, m, d;
	cin >> n >> m >> d;
	int64 res = bt(n, m, d);
	cout << res << endl;
	return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include<cstdlib>
#include<queue>
#include<map>
#define ll long long
#define pb push_back
#define cs(a) (int)a.size()
#define mp make_pair
#define pii pair<int, int>
#define fi first
#define stol stol_mine
#define se second
#define uch unsigned char
#define MOD 1000000007LL
using namespace std;
ll fact[300000];

ll power(ll x, ll st) {
        if (st == 0) return 1;
        if (st == 1) return x;
        if (st % 2 == 0) {
                ll t = power(x, st / 2);
                return (t * t) % MOD;
        } else
                return (power(x, st - 1) * x) % MOD;
}

ll obr(ll x) {
        return power(x, MOD - 2);
}

ll C(int n, int k) {
        return (fact[n] * obr(fact[n - k])) % MOD * obr(fact[k]) % MOD;
}

ll solve(int n, int ed, int cur) {
    if (n == 1) {
        if (ed == cur)
            return 1;
        else
            return 0;
    }
    if (cur == 0) {
        return (C(n - 1, ed - 1) + solve(n - 1, ed, 1)) % MOD;
    } else {
        return solve(n - 1, ed, 0);
    }
}

int main(void) {
    int n, m, g, asdj;
//34324
    cin >> n >> m >> g;
    fact[0] = 1;
    for (int i = 1; i <= 300000; ++i)
        fact[i] = (fact[i - 1] * i) % MOD;
    cout << solve(n + m, m, g) << endl;
}

#include <iostream>
#include <vector>
#include <string>
#include <fstream>
#include <set>

using namespace std;

int mod = 1e9 + 7;
vector <long long int> fact(1e5 + 7, 1);

long long int f(long long int n, long long int k)
{
    long long answer = fact[n] / fact[k] / fact[n - k];
    return answer;
}

int main()
{
    long long answer = 0;
    int n, m, g;
    cin >> n >> m >> g;
    for (int i = 1; i < 1e5 + 7; ++i)
    {
        fact[i] = (fact[i - 1] * i) % mod;
    }
    if (m == 0)
    {
        if ((n + m) % 2 == 0 && g == 1)
        {
            cout << "1" << endl;
        return 0;
        }
        else if ((n + m) % 2 == 1 && g == 0)
        {
            cout << "1" << endl;
        return 0;
        }
    }
    else if (n == 0 && g == 0)
    {
        cout << "1" << endl;
        return 0;
    }
    for (int i = 0; i < n + m - 1; i++)
    {
        if ((i % 2 == 0 && g == 0))
        {
            cout << "LOL1" << endl;
            answer += f(n + m - i - 1, m - 1);
        }
        else if ((i % 2 == 1 && g == 1))
        {
            cout << "LOL2" << endl;
            answer += f(n + m - i - 1, m - 1);
        }
    }
    if ((m + n - 1) % 2 == 0 && g == 1 && m == 1)
    {
        answer++;
    }
    else if ((m + n - 1) % 2 == 1 && g == 0 && m == 1)
    {
        answer++;
    }
    cout << answer;
    return 0;
}

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <queue>
#include <iomanip>

using namespace std ;

#define FOREACH(it,c) for( __typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define FOR(i,a,b) for( int i=(a),_b=(b);i<=_b;i++)
#define DOW(i,b,a) for( int i=(b),_a=(a);i>=_a;i--)
#define REP(i,n) FOR(i,0,(n)-1)
#define DEP(i,n) DOW(i,(n)-1,0)
#define all(a) (a).begin() , (a).end()
#define mp(a,b) make_pair((a),(b))
#define fi first
#define se second

typedef vector<int> VI ;
typedef vector<string> VS ;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;

template<class T> inline int size(const T&c) { return c.size(); }

using namespace std;
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }
const int maxn=100000+10;
const int cmod=1000000007;
long long GTT[maxn*2];
long long GTM[maxn*2];
long long n,m,g;

long long ModPow(long long a,long long n)
{
    if (n==0) return 1;
    if (n%2==1)
    {
        return ((long long)ModPow(a,n-1)*a)%cmod;
    }
    else
    {
        long long u=ModPow(a,n/2);
        return (u*u)%cmod;
    }
}

long long ModInverse(long long n)
{
    return ModPow(n,cmod-2);
}

long long C(long long n,long long u)
{
    if (u>n) return 0;
    return (((long long)GTT[n]*GTM[u])%cmod*GTM[n-u])%cmod;
}

long long calc(long long n,long long m)
{
    if (n<0||m<0) return 0;
    long long res=0;
    FOR(i,0,m/2)
    {
        long long cnt=i+n;
        long long u=m-i*2;
        //cout<<cnt<<' '<<n<<' '<<u<<endl;
        res=(res+(long long)C(cnt,n)*C(n,u)%cmod)%cmod;
    }
    return res;
}
int main()
{
    //freopen("D336.inp","r",stdin);
    //freopen("D336.out","w",stdout);
    cin>>m>>n>>g;
    GTT[0]=1;
    FOR(i,1,n+m+2) GTT[i]=(GTT[i-1]*i)%cmod;
    FOR(i,0,n+m+2) GTM[i]=ModInverse(GTT[i]);
    m--;
    if (g==1) m--;
    //cout<<n<<' '<<m<<endl;
    //cout<<calc(n,m)<<' '<<calc(n-1,m)<<' '<<calc(n-2,m+1)<<endl;
    cout<<(((long long)calc(n,m)+calc(n-1,m))%cmod+calc(n-2,m+1))%cmod;

    fclose(stdin);
    fclose(stdout);
    return 0;
}

/*
0 -> 10       n-1
     01-> 000 m-2
     11-> 100 n-1 m-1
1 -> 00

    xx01-> xx0
     0011 -> 000*/
//1 -> 00

//1 -> 00 -> 001 -> 0000

#include <stdio.h>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <string.h>
#include <string>
#include <math.h>
#define MOD 1000000007
using namespace std;
//d[minus+j][j]=c[minus+j-1][j]+d[minus+j-2][j-2];
long long fact[200010];
long long fast_pow(long long a,int p)
{
	long long t=a,ret=1;
	while(p)
	{
		if(p&1)
			ret=(ret*t)%MOD;
		t=(t*t)%MOD;
		p>>=1;
	}
	return ret;
}
long long rev(long long a,int b)
{
	return fast_pow(a,b-2);
}
long long C(int a,int b)
{
	return (fact[b]*rev((fact[b-a]*fact[a])%MOD,MOD))%MOD;
}
int solve(int n,int m)
{
	long long f=0;
	if(m==0)
		return n%2;
	if(n==0)
		return (m+1)%2;
	if(n==1&&m==1)
		return 2;
	if(m==1)
	{
		if(n%2)
		{
			return(n+1)/2+1;
		}
		else
		{
			return n/2;
		}
	}
	for(int i=n+m; i>=m; i-=2)
	{
		f=(f+C(m-1,i-1))%MOD;
		//printf("  %I64d %d\n",f,i);
	}
	return (int)f;
}
int main()
{
	fact[0]=1;
	for(long long i=1; i<=200000; i++)
		fact[i]=(fact[i-1]*i)%MOD;
	int n,m,g;
	scanf("%d%d%d",&n,&m,&g);
	if(g==0)
		printf("%d\n",(solve(n,m)%MOD+MOD)%MOD);
	else
	{
		if(n==0)
			printf("0\n");
		else
			printf("%d\n",(solve(n-1,m)%MOD+MOD)%MOD);
	}
	return 0;
}

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <set>
using namespace std;

long long V[32] = {1};
set <long long>ve[32];
//long long ans[maxn];
int main()
{
    set <long long>::iterator it;
    for(int i=1;i<32;i++)
        V[i] = V[i-1]*2;
    int n;
    cin>>n;
    long long temp;
    for(int i=0;i<n;i++)
    {
        scanf(" %lld",&temp);
        for(int j=0;j<32;j++)
        {
            if(temp&V[j])
            {
                 ve[j].insert(temp);
            }
        }

      //  int j = upper_bound(V,V+32,temp) - V-1;

        //cout<<temp<<' '<<j<<' '<<V[j]<<endl;
    }
    int k = 0;
    for(int i=31;i>=0;i--)
    {
        if(ve[i].size()!=0)
        {

            temp = V[i+1]-1;
            for(it = ve[i].begin();it!=ve[i].end();it++)
            {
                temp &= *it;
            }
            if(temp == V[i])
            {
                k=i;
               // cout<<k<<' '<<temp<<' '<<V[i]<<endl;

                break;
            }
        }
    }
    int anp = ve[k].size();
    cout<<anp<<endl;
    int co = 0;
    for(it = ve[k].begin();it!=ve[k].end();it++)
    {
        co++;
        if(co!=n)
        printf("%lld ",*it);
        else
        printf("%lld\n",*it);
    }
}

#include <stdio.h>
const int M = 1000000007;
const int maxn = 200001;
int t[maxn << 2];
int a[maxn];
int p[maxn];
int n, up, down1, down2;
int A, B;
int binpow(int a, int n){
    int r = 1;
    while(n){
        if(n % 2) r = (1ll * r * a) % M;
        n /= 2;
        a = (1ll * a * a) % M;
    }
    return r;
}
void erotosfen(){
    for(int i = 2; i <= n; i ++){
        if(!p[i]){
            p[i] = i;
            if(1ll * i * i <= n){
                for(int j = i * i; j <= n; j += i){
                    if(!p[j]) p[j] = i;
                }
            }
        }
    }
}
void fillones(){
    for(int i = (maxn << 2) - 1; i; i --) t[i] = 1;
}
void update(int v, int l, int r, int id){
    if(l == r){
        t[v] = binpow(l, a[l]);
        return ;
    }
    int m = (l + r) / 2;
    if(id > m) update(v * 2 + 1, m + 1, r, id);
    else update(v * 2, l, m, id);
    t[v] = (1ll * t[v * 2 + 1] * t[v * 2]) % M;
}
void add(int N, int k){
    int P, c;
    while(N > 1){
        P = p[N];
        c = 0;
        while(p[N] == P){
            N /= P;
            c ++;
        }

        a[P] += k * c;
        update(1, 1, n, P);
    }
}
void solve(int N, int k){
    while(up > N){
        add(up, -1);
        add(up - k, 1);
        up --;
    }
}
int main(){
    int g, res = 0;
    scanf("%d %d %d",&A,&B,&g);
    if(B == 0){
        if(g == 0) puts(A % 2 ? "1" : "0");
        else puts(A % 2 ? "0" : "1");
        return 0;
    }
    if(A == 0){
        if(g == 1) puts(B == 1 ? "1" : "0");
        else puts(B == 1 ? "0" : "1");
        return 0;
    }
    up = n = A + B;
    erotosfen();
    fillones();

    for(int i = 2; i <= B - 1; i ++) add(i, -1);
    for(int i = 2; i <= n; i ++) add(i, 1);
    for(int i = 2; i <= n - (B - 1); i ++) add(i, -1);

    while(A){
        if(g == 1 && A == 1){
            res = (res + (B == 1 ? 0 : 1)) % M;
            break;
        }
        A --;
        if(g == 1){
            g = 0;
        }else{
            solve(A + B, B - 1);
            res = (res + t[1]) % M;
            g = 1;
        }

    }
    if(B < 2) res = (res + 1) % M;
    printf("%d",res);
}

#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <map>
#include <cstring>
#include <set>
#include <cassert>
using namespace std;
typedef long long ll;
typedef long double db;
typedef vector <int> vi;
typedef pair <int, int> pii;
#define mp make_pair
#define pb push_back
#define f first
#define s second
const int N = 2e5 + 10;
const int MOD = 1e9 + 7;
int n, m, g, fact[N], invFact[N];
int binPow(int x, int y)
{
  int res = 1;
  while (y)
  {
    if (y&1) res = 1LL * res * x % MOD;
    x = 1LL * x * x % MOD;
    y>>=1;
  }
  return res;
}

int C(int n, int k)
{
  if (k < 0 || k > n) return 0;
  return 1LL * fact[n] * invFact[k] % MOD * invFact[n - k] % MOD;
}

int main()
{
  fact[0] = invFact[0] = 1;
  for (int i = 1; i < N; ++i)
  {
    fact[i] = 1LL * fact[i - 1] * i % MOD;
    invFact[i] = binPow(fact[i], MOD - 2);
  }
  cin >> n >> m >> g;
  if (n == 0)
  {
    if (g == 0) cout << m % 2;
    else cout << (m - 1) % 2;
    return 0;
  }
  int ans = 0;
  for (int i = m; i >= 1; --i, g ^= 1)
    if (g == 0)
    {
      ans += C(n + i - 1, n - 1);
      if (ans >= MOD) ans -= MOD;
    }
  if (g == 0) ans += n > 1;
  else ans += n == 1;
  ans %= MOD;
  cout << ans;
  return 0;
}

#include<bits/stdc++.h>
#define FOR(i,a,b) for(i=a;i<=b;i++)
#define FOR2(i,a,b) for(i=a;i<b;i++)
#define IFOR(i,a,b) for(i=a;i>=b;i--)
#define IFOR2(i,a,b) for(i=a;i>b;i--)
#define IND(a) scanf("%d",&a)
#define IND2(a,b) scanf("%d%d",&a,&b)
#define IND3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IND4(a,b,c,d) scanf("%d%d%d%d",&a,&b,&c,&d)
#define INF(a) scanf("%lf",&a)
#define INL(a) scanf("%I64d",&a)
#define INL2(a,b) scanf("%I64d%I64d",&a,&b)
#define INL3(a,b,c) scanf("%I64d%I64d%I64d",&a,&b,&c)
#define INS(s) scanf("%s",&s)
#define OUTD(a) printf("%d ",a)
#define OUTD2(a,b) printf("%d %d ",a,b)
#define OUTD3(a,b,c) printf("%d %d %d",a,b,c)
#define OUTL(a) printf("%I64d ",a)
#define OUTF(a) printf("%.12lf ",a);
#define pb push_back
#define mp make_pair
#define mid ((l+r)>>1)
#define PI acos(-1)
#define ll long long
using namespace std;
const int MOD=1000000007;
const double eps=1e-8;
const int nm=100005;
int n,k,m,t;
ll res;
ll gt[nm*2];
ll Pow(ll x, int mu){
    if(mu==0) return 1ll;
    ll res=Pow(x,mu>>1);
    res=res*res%MOD;
    if(mu&1) res=res*x%MOD;
    return res;
}
ll C(int x,int y){
    if(x<y) return 0ll;
    return gt[x]*Pow(gt[y],MOD-2)%MOD*Pow(gt[x-y],MOD-2)%MOD;
}
int main(){
    #ifndef ONLINE_JUDGE
    freopen("inp.txt","r",stdin);
    #endif
    int i,j,x,y,z,w;
    gt[0]=1;
    FOR(i,1,200003)
        gt[i]=(gt[i-1]*i)%MOD;
    IND3(n,m,k);
    if(n==0){
        if(k==0) cout<<1;
        else cout<<0;
        return 0;
    }
    if(n==1){
        if(k==1) cout<<0;
        else cout<<m;
        return 0;
    }
    if(m==0){
        if((k==1&&k%2==0) || (k==0 && k%2==1)){
            cout<<1;
        }
        else cout<<0;
        return 0;
    }
    if(m==1&&n==2){
        if(k==1) cout<<2;
        else cout<<1;
        return 0;
    }
    for(i=n-1;i>=0;i--)
        if((n-i)&1){
            res=(res+C(i+m,m))%MOD;
        }
        else{
            res=(res-C(i+m,m)+MOD)%MOD;
        }
    if(k==1) cout<<res;
    else cout<<(C(n+m,m)-res+MOD)%MOD;
    return 0;
}

#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#define ll long long
#define pr(x) cout << #x << " = " << (x) << "  ";
#define prln(x) cout << #x << " = " << (x) << '\n';
using namespace std;

const int INF = 0x7f7f7f7f;
const int MAXN = 1e5 + 11;
const int MOD = 1e9 + 7;

ll fac[MAXN];

ll quick_pow(ll base, ll p) {
    ll ret = 1;
    while (p) {
        if (p & 1) ret = ret * base % MOD;
        base = base * base % MOD;
        p >>= 1LL;
    }
    return ret;
}

ll c(ll n, ll m) {
    if (n < m) return 0;
    ll ret = fac[n] * quick_pow(fac[n - m] * fac[m] % MOD, MOD - 2) % MOD;
    return ret;
}

int main()
{
    #ifdef GooZy
    freopen("C:\\Users\\apple\\Desktop\\in.txt", "r", stdin);
    #endif
    int n, m, g;
    fac[0] = 1;
    for (int i = 1; i < MAXN; ++i) {
        fac[i] = fac[i - 1] * i % MOD;
    }
    while (cin >> n >> m >> g) {
        ll ans = 0;
        for (int i = g; i <= n; i += 2) {
            if (n - i + m - 1 == 0) continue;
            ans += c(n - i + m - 1, m - 1);
        }
        cout << ans << '\n';
    }
    return 0;
}

#include<bits/stdc++.h>
#define ll long long int
#define loop(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,n) for(int i=0;i<n;i++)
#define bp 1000000007
#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define F first
#define S second
#define EPS 1e-9
using namespace std;
const int lim=200005;
ll fact[lim],mmi[lim];
ll expo(ll a,ll b){
    if(b==0)return 1;
    ll c=expo(a,b/2);
    if(b&1){
        return (((c*c)%bp)*a)%bp;
    }
    return (c*c)%bp;
}
void pre(){
    fact[0]=1;
    mmi[0] = 1;
    for(int i=1;i<lim;i++){
        fact[i] = (fact[i-1]*i)%bp;
        mmi[i] = (mmi[i-1]*expo(i,bp-2))%bp;
    }
}
ll f(ll n,ll m){
    cout<<n<<" "<<m<<endl;
    if(n+m==1){
        if(n==1 && m==0)return 1;
        return 0;
    }
    ll ans=0;
    if(m>0){
        ans = (ans + (fact[n+m-1]*mmi[n]%bp)*mmi[m-1]%bp)%bp;
    }
    if(n>0){
        n--;
        if(n+m==1){
            if(n==0 && m==1)ans+=1;
        }
        else{
            if(n>0){
                ans = (ans + f(n-1,m))%bp;
            }
        }
    }
    return ans%bp;
}
void solve(){
    pre();
    ll n,m,g;
    cin>>n>>m>>g;
    if(g==1){
        if(n+m==1){
            if(n==0 && m==1)cout<<1;
            else cout<<0;
            return;
        }
        else{
            n--;
        }
    }
    cout<<f(n,m);
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int kickstart = 0;
	int test=1;
	//cin>>test;
	rep(i,test){
		if(kickstart)
			cout<<"Case #"<<i+1<<": ",solve(),cout<<endl;
		else
			solve();
	}
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define forn(i, x, n) for(int i = int(x); i <= int(n); ++i)
#define for1(i, n, x) for(int i = int(n); i >= int(x); --i)
#define file ""
#define pb push_back
#define F first
#define S second
#define _bits __builtin_popcountll

typedef long long ll;
typedef pair <ll, ll> PII;

const int N = 2e6;
const int INF = 1e9 + 9;
const int B = 1e9 + 7;

#define left(x) (x << 1)
#define right(x) ((x << 1) | 1)
struct SegTree {
	int n, t[N * 4];

	void init(int _n) {
		n = _n;
		forn(i, 1, n + n)
			t[i] = 0;
	}
	void add(int x) {
		t[x += n - 1]++;
		for (x >>= 1; x; x >>= 1)
			t[x] = t[left(x)] + t[right(x)];
	}
	int get(int l, int r) {
		int ans = 0;
		for (l += n - 1, r += n - 1; l <= r; l >>= 1, r >>= 1) {
			if (l & 1) ans += t[l++];
			if (!(r & 1)) ans += t[r--];
		}
		return ans;
	}
} tree;

int in[N];
int n, d, h;
vector <PII> res;

void add_edge(int f, int t) {
	++in[t];
	res.pb(PII(f, t));
}

int main() {
#ifdef machine42
	freopen(file"in", "r", stdin);
	freopen(file"out", "w", stdout);
#endif
	ios_base :: sync_with_stdio (0);
	cin.tie(0);

	cin >> n >> d >> h;
	if (h * 2 < d || (n > 2 && d < 2) /*|| (h == d && h < n - 1)*/) {
		cout <<"-1\n";
		return 0;
	}
	if (h == d) {
		forn(i, 1, h)
			add_edge(i, i + 1);
		if (h == 1 && n > 2) {
			cout << "-1\n";
			return 0;
		}
		forn(i, h + 2, n)
			add_edge(2, i);
		for (auto p : res)
			cout << p.F << " " << p.S << "\n";
		return 0;
	}
	forn(i, 2, 1 + h)
		add_edge(i - 1, i);
	int r = d - h;
	if (r) {
		add_edge(1, 2 + h);
		int ptr = 2 + h;
		forn(i, 1, r - 1) {
			add_edge(ptr, ptr + 1);
			++ptr;
		}
	}
	forn(i, 2, n)
		if (in[i] == 0) add_edge(1, i);
	for (auto p : res)
		cout << p.F << " " << p.S << "\n";

	return 0;
}