stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <iostream>

using namespace std;



const int MOD = 1e9 + 7;



int n, m, k;

int pow1[1010101], pow2[1010101];

int fac[1010101], rev[1010101], ifac[1010101];



int c(int a, int b)

{

	long long ret = fac[b];

	ret = ret * ifac[a];

	ret %= MOD;

	ret = ret * ifac[b - a];

	ret %= MOD;

	return (int)ret;

}



int main()

{

	scanf("%d%d%d", &n, &m, &k);

	pow1[0] = fac[0] = ifac[0] = rev[0] = pow2[0] = 1;

	ifac[1] = rev[1] = 1;

	for(int i = 1; i <= n + m + k; ++i)

	{

		pow1[i] = pow1[i - 1] * 3ll % MOD;

		pow2[i] = pow2[i - 1] * 2 % MOD;

		fac[i] = fac[i - 1] * 1ll * i % MOD;

		if(i >= 2)

		{

			rev[i] = MOD - 1ll * (MOD / i) * rev[MOD % i] % MOD;

			ifac[i] = 1ll * ifac[i - 1] * rev[i] % MOD;

		}

	}

	if(m > k)

		swap(m, k);

	int ans = 0;

	for(int i = 0; i <= m; ++i)

	{

		ans += 1ll * pow2[i] * c(i, i + n - 1) % MOD * pow1[m + k - i] % MOD;

		if(ans >= MOD)

			ans -= MOD;

	}

	int lst = pow2[m];

	for(int i = m + 1; i <= m + k; ++i)

	{

		lst = lst<<1;

		lst -= c(m, i - 1);

		if(lst >= MOD)

			lst -= MOD;

		if(i > k)

			lst -= c(i - k - 1, i - 1);

		while(lst < 0)

			lst += MOD;

		while(lst >= MOD)

			lst -= MOD;

		ans += 1ll * lst * c(i, i + n - 1) % MOD * pow1[m + k - i] % MOD;

		if(ans >= MOD)

			ans -= MOD;

	}

	printf("%d\n", ans);

	

	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstdlib>

#include <algorithm>



typedef long long LL;



const int maxn = 1e6 + 20;

const int mod = 1e9 + 7;



int N, M, K, sum;

LL fac[maxn];

LL inv[maxn];

LL pw[maxn];

 

LL powermod(LL x,LL y)

{

	LL z = 1;

	

	while(y)

	{

		if(y & 1) z = z * x % mod;

		x = x * x % mod, y >>= 1;

	}

	

	return z;

}

LL combine(LL x,LL y)

{

	if(y < 0 || y > x) return 0;

	return fac[x] * inv[y] % mod * inv[x - y] % mod;

}

int main()

{

	scanf("%d%d%d", &N, &M, &K);

	sum = N + M + K;

	

	pw[0] = fac[0] = inv[0] = 1;

	for(int i = 1; i <= sum; i++)

	{

		pw[i] = pw[i - 1] * 3 % mod;

		fac[i] = fac[i - 1] * i % mod;

	}

	

	inv[sum] = powermod(fac[sum], mod - 2);

	for(int i = sum - 1; i >= 1; i--)

	{

		inv[i] = inv[i + 1] * (i + 1) % mod;

	}

	

	LL s = 1, ans = 0;

	

	for(int i = 0; i <= M + K; i++)

	{

		ans += s * combine(N - 1 + i, N - 1) % mod * pw[M + K - i] % mod;

		s = s * 2 - combine(i, M) - combine(i, K);

		s = (s % mod + mod) % mod;

	}

	ans %= mod;

	

	printf("%d", (int) ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>



#define mo 1000000007



using namespace std;



int fac[900030],inv[900030],Pow3[900030];



int power(int x,int m)

{

	int nowans=1;

	while(m)

	{

		if(m&1)nowans=1ll*nowans*x%mo;

		x=1ll*x*x%mo;

		m>>=1;

	}

	return nowans;

}



inline int C(int n,int m)

{

	if(n<m)return 0;

	return (int)(1ll*fac[n]*inv[m]%mo*inv[n-m]%mo);

}



int main()

{

	int n,m,k,N;

	scanf("%d%d%d",&n,&m,&k);

	N=n+m+k;

	Pow3[0]=1;

	for(int i=1;i<=N;i++)

		Pow3[i]=3ll*Pow3[i-1]%mo;

	fac[0]=1;

	for(int i=1;i<=N;i++)

		fac[i]=1ll*fac[i-1]*i%mo;

	inv[N]=power(fac[N],mo-2);

	for(int i=N;i;i--)

		inv[i-1]=1ll*inv[i]*i%mo;

	int ans=0,nowans=1;

	for(int l=n+1;l<=N+1;l++)

	{

		ans+=1ll*C(l-2,n-1)*nowans%mo*Pow3[N+1-l]%mo;

		if(ans>=mo)ans-=mo;

		nowans=nowans*2%mo;

		nowans-=(C(l-(n+1),m)+C(l-(n+1),k))%mo;

		if(nowans<0)nowans+=mo;

	}

	printf("%d\n",ans);

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstdlib>

#include <algorithm>



typedef long long LL;



const int maxn = 1e6 + 20;

const int mod = 1e9 + 7;



int N, M, K, sum;

LL fac[maxn];

LL inv[maxn];

LL pw[maxn];

 

LL powermod(LL x,LL y)

{

	LL z = 1;

	

	while(y)

	{

		if(y & 1) z = z * x % mod;

		x = x * x % mod, y >>= 1;

	}

	

	return z;

}

LL combine(LL x,LL y)

{

	if(y < 0 || y > x) return 0;

	return fac[x] * inv[y] % mod * inv[x - y] % mod;

}

int main()

{

	scanf("%d%d%d", &N, &M, &K);

	sum = N + M + K;

	

	pw[0] = fac[0] = inv[0] = 1;

	for(int i = 1; i <= sum; i++)

	{

		pw[i] = pw[i - 1] * 3 % mod;

		fac[i] = fac[i - 1] * i % mod;

	}

	

	inv[sum] = powermod(fac[sum], mod - 2);

	for(int i = sum - 1; i >= 1; i--)

	{

		inv[i] = inv[i + 1] * (i + 1) % mod;

	}

	

	LL s = 1, ans = 0;

	

	for(int i = 0; i <= M + K; i++)

	{

		ans += s * combine(N - 1 + i, N - 1) % mod * pw[M + K - i] % mod;

		s = s * 2 - combine(i, M) - combine(i, K);

		s = (s % mod + mod) % mod;

	}

	ans %= mod;

	

	printf("%d", (int) ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstring>

#include<iostream>

#include<cstdio>

#include<cstdlib>

using namespace std;



typedef long long ll;

const int maxn = 900010,rhl = 1000000007;

int N,M,K; ll jie[maxn],inv[maxn],mi[maxn];



inline ll qsm(ll a,int b)

{

	ll ret = 1;

	for (;b;b >>= 1,(a *= a) %= rhl) if (b&1) (ret *= a) %= rhl;

	return ret;

}



inline int gi()

{

	char ch; int ret = 0,f = 1;

	do ch = getchar(); while (!(ch >= '0'&&ch <= '9')&&ch != '-');

	if (ch == '-') f = -1,ch = getchar();

	do ret = ret*10+ch-'0',ch = getchar(); while (ch >= '0'&&ch <= '9');

	return ret*f;

}



inline ll C(int n,int m) { if (n < m||m < 0) return 0; return jie[n]*inv[m]%rhl*inv[n-m]%rhl; }



int main()

{

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

	//freopen("H.out","w",stdout);

	N = gi(); M = gi(); K = gi();

	jie[0] = mi[0] = 1;

	for (int i = 1;i <= N+M+K;++i)

	{

		mi[i] = mi[i-1]*3LL; while (mi[i] >= rhl) mi[i] -= rhl;

		jie[i] = jie[i-1]*(ll)i; if (jie[i] >= rhl) jie[i] %= rhl;

	}

	inv[N+M+K] = qsm(jie[N+M+K],rhl-2);

	for (int i = N+M+K;i;--i)

	{

		inv[i-1] = inv[i]*(ll)i;

		if (inv[i-1] >= rhl) inv[i-1] %= rhl;

	}

	ll sum = 1,ans = 0;

	for (int i = 0;i <= M+K;++i)

	{

		ll tm = C(N+i-1,i)*mi[M+K-i]%rhl;

		ans += tm*sum%rhl; if (ans >= rhl) ans %= rhl;

		sum <<= 1; if (sum >= rhl) sum -= rhl;

		sum -= C(i,i-K)+C(i,M); while (sum < 0) sum += rhl;

	}

	cout << ans << endl;

	return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstdlib>

#include <algorithm>



typedef long long LL;



const int maxn = 1e6 + 20;

const int mod = 1e9 + 7;



int N, M, K, sum;

LL fac[maxn];

LL inv[maxn];

LL pw[maxn];

 

LL powermod(LL x,LL y)

{

	LL z = 1;

	

	while(y)

	{

		if(y & 1) z = z * x % mod;

		x = x * x % mod, y >>= 1;

	}

	

	return z;

}

LL combine(LL x,LL y)

{

	if(y < 0 || y > x) return 0;

	return fac[x] * inv[y] % mod * inv[x - y] % mod;

}

int main()

{

	scanf("%d%d%d", &N, &M, &K);

	sum = N + M + K;

	

	pw[0] = fac[0] = inv[0] = 1;

	for(int i = 1; i <= sum; i++)

	{

		pw[i] = pw[i - 1] * 3 % mod;

		fac[i] = fac[i - 1] * i % mod;

	}

	

	inv[sum] = powermod(fac[sum], mod - 2);

	for(int i = sum - 1; i >= 1; i--)

	{

		inv[i] = inv[i + 1] * (i + 1) % mod;

	}

	

	LL s = 1, ans = 0;

	

	for(int i = 0; i <= M + K; i++)

	{

		ans += s * combine(N - 1 + i, N - 1) % mod * pw[M + K - i] % mod;

		s = s * 2 - combine(i, M) - combine(i, K);

		s = (s % mod + mod) % mod;

	}

	ans %= mod;

	

	printf("%d", (int) ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



const int Mod = 1e9 + 7;

const int N = 9e5 + 10;



int n, m, k;

long long fac[N], vfac[N];



long long mpow( long long a, int b ) {

	long long rt;

	for( rt = 1; b; b >>= 1, a = (a * a) % Mod )

		if( b & 1 ) rt = (rt * a) % Mod;

	return rt;

}

void init( int n ) {

	fac[0] = 1;

	for( int i = 1; i <= n; i++ )

		fac[i] = (fac[i-1] * i) % Mod;

	vfac[n]  = mpow( fac[n], Mod - 2 );

	for( int i = n - 1; i >= 0; i-- )

		vfac[i] = vfac[i+1] * (i + 1) % Mod;

}

long long comb( int n, int m ) {

	return fac[n] * vfac[n-m] % Mod * vfac[m] % Mod;

}

int main() {

	scanf( "%d%d%d", &n, &m, &k );

	if( m < k )

	   	swap( m, k );

	init( m + k + n );

	long long sum = 0;

	long long ans = 0;

	for( int s = 0; s <= m + k; s++ ) {

		if( s == 0 ) 

			sum = 1;

		else if( s <= k ) 

			sum = (sum<<1) % Mod;

		else if( s <= m ) 

			sum = ((sum<<1) + Mod - comb(s-1,s-k-1)) % Mod;

		else 

			sum = ((sum<<1) + Mod - comb(s-1,s-k-1) + Mod - comb(s-1,m)) % Mod;

		long long sub = sum * comb(n-1+s,n-1) % Mod * mpow(3,m+k-s) % Mod;

		ans = (ans + sub) % Mod;

	}

	cout << ans << endl;

}




// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstdlib>

#include <algorithm>



typedef long long LL;



const int maxn = 1e6 + 20;

const int mod = 1e9 + 7;



int N, M, K, sum;

LL fac[maxn];

LL inv[maxn];

LL pw[maxn];

 

LL powermod(LL x,LL y)

{

	LL z = 1;

	

	while(y)

	{

		if(y & 1) z = z * x % mod;

		x = x * x % mod, y >>= 1;

	}

	

	return z;

}

LL combine(LL x,LL y)

{

	if(y < 0 || y > x) return 0;

	return fac[x] * inv[y] % mod * inv[x - y] % mod;

}

int main()

{

	scanf("%d%d%d", &N, &M, &K);

	sum = N + M + K;

	

	pw[0] = fac[0] = inv[0] = 1;

	for(int i = 1; i <= sum; i++)

	{

		pw[i] = pw[i - 1] * 3 % mod;

		fac[i] = fac[i - 1] * i % mod;

	}

	

	inv[sum] = powermod(fac[sum], mod - 2);

	for(int i = sum - 1; i >= 1; i--)

	{

		inv[i] = inv[i + 1] * (i + 1) % mod;

	}

	

	LL s = 1, ans = 0;

	

	for(int i = 0; i <= M + K; i++)

	{

		ans += s * combine(N - 1 + i, N - 1) % mod * pw[M + K - i] % mod;

		s = s * 2 - combine(i, M) - combine(i, K);

		s = (s % mod + mod) % mod;

	}

	ans %= mod;

	

	printf("%d", (int) ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



const int Mod = 1e9 + 7;

const int N = 9e5 + 10;



int n, m, k;

long long fac[N], vfac[N];



long long mpow( long long a, int b ) {

	long long rt;

	for( rt = 1; b; b >>= 1, a = (a * a) % Mod )

		if( b & 1 ) rt = (rt * a) % Mod;

	return rt;

}

void init( int n ) {

	fac[0] = 1;

	for( int i = 1; i <= n; i++ )

		fac[i] = (fac[i-1] * i) % Mod;

	vfac[n]  = mpow( fac[n], Mod - 2 );

	for( int i = n - 1; i >= 0; i-- )

		vfac[i] = vfac[i+1] * (i + 1) % Mod;

}

long long comb( int n, int m ) {

	return fac[n] * vfac[n-m] % Mod * vfac[m] % Mod;

}

int main() {

	scanf( "%d%d%d", &n, &m, &k );

	if( m < k ) swap( m, k );

	init( m + k + n );

	long long sum = 0, ans = 0;

	for( int s = 0; s <= m + k; s++ ) {

		if( s == 0 ) 

			sum = 1;

		 else if( s <= k ) 

			sum = (sum<<1) % Mod;

	 else if( s <= m ) 

			sum = ((sum<<1) + Mod - comb(s-1,s-k-1)) % Mod;

		 else 

			sum = ((sum<<1) + Mod - comb(s-1,s-k-1) + Mod - comb(s-1,m)) % Mod;

		

		long long sub = sum * comb(n-1+s,n-1) % Mod * mpow(3,m+k-s) % Mod;

		ans = (ans + sub) % Mod;

	}

	printf( "%lld\n", ans );

}




// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstdlib>

#include <algorithm>



typedef long long LL;



const int maxn = 1e6 + 20;

const int mod = 1e9 + 7;



int N, M, K, sum;

LL fac[maxn];

LL inv[maxn];

LL pw[maxn];

 

LL powermod(LL x,LL y)

{

	LL z = 1;

	

	while(y)

	{

		if(y & 1) z = z * x % mod;

		x = x * x % mod, y >>= 1;

	}

	

	return z;

}

LL combine(LL x,LL y)

{

	if(y < 0 || y > x) return 0;

	return fac[x] * inv[y] % mod * inv[x - y] % mod;

}

int main()

{

	scanf("%d%d%d", &N, &M, &K);

	sum = N + M + K;

	

	pw[0] = fac[0] = inv[0] = 1;

	for(int i = 1; i <= sum; i++)

	{

		pw[i] = pw[i - 1] * 3 % mod;

		fac[i] = fac[i - 1] * i % mod;

	}

	

	inv[sum] = powermod(fac[sum], mod - 2);

	for(int i = sum - 1; i >= 1; i--)

	{

		inv[i] = inv[i + 1] * (i + 1) % mod;

	}

	

	LL s = 1, ans = 0;

	

	for(int i = 0; i <= M + K; i++)

	{

		ans += s * combine(N - 1 + i, N - 1) % mod * pw[M + K - i] % mod;

		s = s * 2 - combine(i, M) - combine(i, K);

		s = (s % mod + mod) % mod;

	}

	ans %= mod;

	

	printf("%d", (int) ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

using namespace std;



typedef long long ll;



const int maxn = 9e5 + 5;

const int mod = 1e9 + 7;



int n, m, k, Q;

ll ans;

ll f[maxn], fac[maxn], inv[maxn], bin[maxn];



ll power(ll b, int k)

{

    ll res = 1;

    for(; k; k >>= 1, b = b * b % mod)

        if(k & 1)

            res = res * b % mod;

    return res;

}



ll C(int n, int m)

{

    if(m > n)

        return 0;

    return fac[n] * inv[m] % mod * inv[n - m] % mod;

}



int main()

{

    scanf("%d%d%d", &n, &m, &k);

    Q = m + k;

    f[0] = fac[0] = bin[0] = inv[0] = 1;

    for(int i = 1; i <= n + Q; i++)

    {

        fac[i] = fac[i - 1] * i % mod;

        inv[i] = power(fac[i], mod - 2);

    }

    for(int i = 1; i <= Q; i++)

    {

        f[i] = ((f[i - 1] << 1) - C(i - 1, m) - C(i - 1, k) + (mod << 1)) % mod;

        bin[i] = bin[i - 1] * 3 % mod;

    }

    for(int i = 0; i <= Q; i++)

    {

        ll tmp = C(i + n - 1, n - 1) * f[i] % mod * bin[Q - i] % mod;

        ans += tmp;

        if(ans >= mod)

            ans -= mod;

    }

    printf("%lld\n", ans);

    return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstdlib>

#include <algorithm>



typedef long long LL;



const int maxn = 1e6 + 20;

const int mod = 1e9 + 7;



int N, M, K, sum;

LL fac[maxn];

LL inv[maxn];

LL pw[maxn];

 

LL powermod(LL x,LL y)

{

	LL z = 1;

	

	while(y)

	{

		if(y & 1) z = z * x % mod;

		x = x * x % mod, y >>= 1;

	}

	

	return z;

}

LL combine(LL x,LL y)

{

	if(y < 0 || y > x) return 0;

	return fac[x] * inv[y] % mod * inv[x - y] % mod;

}

int main()

{

	scanf("%d%d%d", &N, &M, &K);

	sum = N + M + K;

	

	pw[0] = fac[0] = inv[0] = 1;

	for(int i = 1; i <= sum; i++)

	{

		pw[i] = pw[i - 1] * 3 % mod;

		fac[i] = fac[i - 1] * i % mod;

	}

	

	inv[sum] = powermod(fac[sum], mod - 2);

	for(int i = sum - 1; i >= 1; i--)

	{

		inv[i] = inv[i + 1] * (i + 1) % mod;

	}

	

	LL s = 1, ans = 0;

	

	for(int i = 0; i <= M + K; i++)

	{

		ans += s * combine(N - 1 + i, N - 1) % mod * pw[M + K - i] % mod;

		s = s * 2 - combine(i, M) - combine(i, K);

		s = (s % mod + mod) % mod;

	}

	ans %= mod;

	

	printf("%d", (int) ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <iostream>

#include <algorithm>

#include <cstring>

#define MOD 1000000007

using namespace std;



int n, m, k;



int quickPow(int n, int m) {

	int res = 1;

	while (m) {

		if (m & 1) res = 1LL * res * n % MOD;

		m >>= 1;

		n = 1LL * n * n % MOD;

	}

	return res;

}



int main() {

	scanf("%d%d%d", &n, &m, &k);

	if (m > k) swap(m, k);

	int ans = quickPow(3, m + k), tmp1 = 1, tmp2 = 1;

	for (int p = n + 1, e, u = 1, v = 1; p <= n + m + k; ++p) {

		e = quickPow(3, n + m + k - p);

		v = 1LL * v * (p - 1) % MOD * quickPow(p - n, MOD - 2) % MOD;

		if (p <= n + m) u = u * 2 % MOD;

		else if (p <= n + k) {

			tmp1 = p - n - 1 == m ? 1 : 1LL * tmp1 * (p - n - 1) % MOD * quickPow(p - n - m - 1, MOD - 2) % MOD;

			u = (2LL * u - tmp1 + MOD) % MOD;

		}

		else {		

			tmp1 = p - n - 1 == m ? 1 : 1LL * tmp1 * (p - n - 1) % MOD * quickPow(p - n - m - 1, MOD - 2) % MOD;

			tmp2 = p == (1 + n + k) ? 1 : 1LL * tmp2 * (p - 1 - n) % MOD * quickPow(p - n - 1 - k, MOD - 2) % MOD;

			u = (2LL * u - tmp1 - tmp2 + MOD + MOD) % MOD;

		}

		ans = (ans + 1LL * e * v % MOD * u % MOD) % MOD;

	}

	printf("%d\n", ans);

	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstdlib>

#include <algorithm>



typedef long long LL;



const int maxn = 1e6 + 20;

const int mod = 1e9 + 7;



int N, M, K, sum;

LL fac[maxn];

LL inv[maxn];

LL pw[maxn];

 

LL powermod(LL x,LL y)

{

	LL z = 1;

	

	while(y)

	{

		if(y & 1) z = z * x % mod;

		x = x * x % mod, y >>= 1;

	}

	

	return z;

}

LL combine(LL x,LL y)

{

	if(y < 0 || y > x) return 0;

	return fac[x] * inv[y] % mod * inv[x - y] % mod;

}

int main()

{

	scanf("%d%d%d", &N, &M, &K);

	sum = N + M + K;

	

	pw[0] = fac[0] = inv[0] = 1;

	for(int i = 1; i <= sum; i++)

	{

		pw[i] = pw[i - 1] * 3 % mod;

		fac[i] = fac[i - 1] * i % mod;

	}

	

	inv[sum] = powermod(fac[sum], mod - 2);

	for(int i = sum - 1; i >= 1; i--)

	{

		inv[i] = inv[i + 1] * (i + 1) % mod;

	}

	

	LL s = 1, ans = 0;

	

	for(int i = 0; i <= M + K; i++)

	{

		ans += s * combine(N - 1 + i, N - 1) % mod * pw[M + K - i] % mod;

		s = s * 2 - combine(i, M) - combine(i, K);

		s = (s % mod + mod) % mod;

	}

	ans %= mod;

	

	printf("%d", (int) ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define rep(i,a,b) for (int i=(a); i<(b); i++)

#define per(i,a,b) for (int i=(b)-1; i>=(a); i--)

#define debug(x) cout << #x << " => " << x << endl

using namespace std;

const int MAX_N = 7 + 300000;

const int MOD = 1e9 + 7;

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

int qpow(int a,int b) {

    int ret=1;

    for (; b; b>>=1) {

        if (b&1) ret=1ll*ret*a%MOD;

        a=1ll*a*a%MOD;

    }

    return ret;

}

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

int jc[MAX_N*3],jcr[MAX_N*3];

int C(int n,int m) {

    return 1ll*jc[n]*jcr[m]%MOD*jcr[n-m]%MOD;

}

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

int fb[MAX_N*3],fc[MAX_N*3];

int main() {



    ///read

    int n1,n2,n3; cin>>n1>>n2>>n3;

    int n=n1+n2+n3;



    ///prework

    jc[0]=1; rep(i,1,n+1) jc[i]=1ll*jc[i-1]*i%MOD;

    rep(i,0,n+1) jcr[i]=qpow(jc[i],MOD-2);

    rep(i,n2+1,n+1) fb[i]=(fb[i-1]+(fb[i-1]+C(i-1,n2))%MOD)%MOD;

    rep(i,n3+1,n+1) fc[i]=(fc[i-1]+(fc[i-1]+C(i-1,n3))%MOD)%MOD;



    ///work

    int ans=0;

    rep(i,n1,n+1) {

        int tmp=((qpow(2,i-n1)+MOD-fb[i-n1])%MOD+MOD-fc[i-n1])%MOD;

        tmp=1ll*tmp*qpow(3,n-i)%MOD;

        ans=(ans+1ll*tmp*C(i-1,n1-1)%MOD)%MOD;

    }

    cout << ans;



}




// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

#define N 1000010

#define ll long long



const ll p = 1e9 + 7;

ll n, m, k, ans;

ll fac[N], inv[N], san[N];



ll fpow(ll a, ll b)

{

    ll ans = 1;

    while(b)

    {

        if(b & 1) ans = ans * a % p;

        a = a * a % p; b >>= 1;

    }

    return ans;

}



ll C(ll n, ll m)

{

    if(n < m || n < 0 || m < 0) return 0;

    return fac[n] * inv[m] % p * inv[n - m] % p;

}



int main()

{

    scanf("%lld%lld%lld", &n, &m, &k);

    ll t = n + m + k;

    fac[0] = inv[0] = san[0] = 1;

    for(int i = 1; i <= t; i ++)

    {

        fac[i] = fac[i - 1] * i % p;

        san[i] = san[i - 1] * 3 % p;

    }

    //for(int i = 1; i <= 5; i ++) printf("%lld %lld %lld", fac[i], inv[i], san[i]), system("pause");

    inv[t] = fpow(fac[t], p - 2);

    for(int i = t - 1; i; i --) inv[i] = inv[i + 1] * (i + 1) % p;

    ll t1 = 0, t2 = 1;

    for(int i = 0; i <= m + k; i ++)

    {

        t = C(n + i - 1, n - 1) * san[m + k - i] % p;

        //printf("%lld", t); system("pause");

        t = t * (t2 - t1 + p) % p;

        t2 = (t2 * 2 % p - C(i, m) + p) % p;

        t1 = ((t1 * 2 % p - C(i, i - k - 1) + p) % p + C(i + 1, i - k)) % p;

        ans = (ans + t) % p; 

        //printf("%lld %lld", ans, t); system("pause");

    }

    printf("%lld", ans);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define FOR(i,a,b) for (int i=(a);i<(b);i++)

#define pb push_back



typedef long long ll;

using namespace std;

int MOD (1e9+7);

int powMod(int a, int n, int m){

  ll pro = 1, tmp = a;

  for(; n > 0; n >>= 1){

    if(n & 1) pro = (pro * tmp) % m;

    tmp = tmp * tmp % m;

  }

  if (pro < 0) cout << "pro < 0" << a << "," << n << endl;

  return pro;

}



vector<int> A, R;

int comb(int n, int c){

  return int(ll(A[n + c]) * R[n] % MOD * R[c] % MOD);

}

main(){

  cin.tie(0);

  ios::sync_with_stdio(false);

  int N, M, K;

  cin >> N >> M >> K;



  ll t = 1;

  A.pb(1);

  R.pb(1);

  FOR(i, 1, N + M + K + 1){

    t = t * i % MOD;

    A.pb(t);

    R.pb(powMod(t, MOD - 2, MOD));

  }

  int sum = M + K, p3 = powMod(3, sum, MOD), ret = p3, r3 = powMod(3, MOD - 2, MOD);

  if(M > K) swap(M, K);

  ll pre = 1;



  FOR(i, 1, sum + 1){

    pre *= 2;

    p3 = ll(p3) * r3 % MOD;

    if(i > M){

      pre = pre + MOD - comb(M, i - M - 1);

      if(i > K) pre = pre + MOD - comb(K, i - K - 1);

    }

    pre %= MOD;

    ret += pre * comb(N - 1, i) % MOD * p3 % MOD;

    ret %= MOD;

  }

  cout << ret << endl;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

#define FOR(i,a,b) for (int i=(a);i<(b);i++)

#define FORR(i,a,b) for (int i=(a);i>(b);i--)

#define pb push_back



typedef long long ll;

using namespace std;

int MOD = (1e9+7);

const int idxMax = (9e5+1);

int powMod(int a, int n, int m){

  ll pro = 1, tmp = a;

  for(; n > 0; n >>= 1){

    if(n & 1) pro = (pro * tmp) % m;

    tmp = tmp * tmp % m;

  }

  if (pro < 0) cout << "pro < 0" << a << "," << n << endl;

  return pro;

}



int A[idxMax], R[idxMax];

int comb(int n, int c){

  return int(ll(A[n + c]) * R[n] % MOD * R[c] % MOD);

}

main(){

  cin.tie(0);

  ios::sync_with_stdio(false);

  int N, M, K;

  cin >> N >> M >> K;



  ll t = 1;

  A[0] = 1;

  FOR(i, 1, N + M + K + 1){

    t = t * i % MOD;

    A[i] = t;

  }

  t = powMod(t, MOD - 2, MOD);

  R[N + M + K] = t;

  FORR(i, N + K + M, -1){

    R[i] = t;

    t = t * i % MOD;

  }

  int sum = M + K;

  ll pre = 1, p3 = powMod(3, sum, MOD), ret = p3, r3 = powMod(3, MOD - 2, MOD);

  if(M > K) swap(M, K);



  FOR(i, 1, sum + 1){

    pre <<= 1;

    p3 = p3 * r3 % MOD;

    if(i > M){

      pre += MOD - comb(M, i - M - 1);

      if(i > K) pre += MOD - comb(K, i - K - 1);

    }

    pre %= MOD;

    ret += pre * comb(N - 1, i) % MOD * p3 % MOD;

    ret %= MOD;

  }

  cout << ret << endl;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

#define rep(i,n) for(int i = 0; i < (n);i++)

#define sz(x) int(x.size());

typedef long long ll;

typedef pair<int,int> P;

const long double EPS = 0.0000000001;

const long double PI = acos(-1);

long double a, b, x;



bool ok(long double theta){

  if (theta > PI / 2.0 - EPS) return true;

  long double ret;

  if (a * tan(theta) <= b) {

    ret = a * a * b - a * a * a * tan(theta) / 2.0;

  } else {

    ret = b * b / tan(theta) * a / 2.0;

  }

  return ret < x;

}





int main(){

  

  cin >> a >> b >> x;

  long double l = 0, r = PI / 2.0;

  rep(i,100000){

    long double mid = (r + l) / 2.0; 

    if (ok(mid)) r = mid;

    else l = mid;

  }

 cout << fixed << setprecision(10) << r / PI * 180 << endl;

  

  return 0;

} 

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

#define rep(i,n) for(int i = 0; i < (n);i++)

#define sz(x) int(x.size())

typedef long long ll;

typedef pair<int,int> P;



double pi = acos(-1);



int main(){

  double a, b, x;

  cin >> a >> b >> x;



  auto ok = [&](double m) {

    if (a * tan(m) < b) {

      double s = a * b - tan(m) * a * a / 2;

      return s * a <=  x;

    } else {

      double s = b / tan(m) * b / 2;

      return s * a <= x;

    }

  };

  double l = 0; double r = pi / 2;



  rep(i,10000) {

    double m = (l + r) / 2;

    if (ok(m)) r = m;

    else l = m;

  }

  printf("%.12f\n",r * 180 / pi); 

  return 0;

} 

// Fastest known solution for this problem: