output_description: Print the answer modulo 1\,000\,000\,007 (=10^9+7).
  
  * * *
input_description: The input is given from Standard Input in the following format:
  
      
      
      N M K
attempt: #include<iostream>
  #define MOD 1000000007
  #define N 1000
  using namespace std;
  typedef long long LL;
  LL mod_pow(LL base, LL exp)
  {
  	if(exp==0) return 1;
  	if(exp&1) return (mod_pow(base,exp-1)*base)%MOD;
  	else return mod_pow((base*base)%MOD,exp/2);
  }
  LL fac[3*N+1];
  LL fac_inv[3*N+1];
  LL C(LL n, LL k)
  {
  	if(k < 0 || n < k) return 0;
  	LL num = fac[n];
  	LL den = (fac_inv[n-k]*fac_inv[k])%MOD;
  	return (num*den)%MOD;
  }
  int main()
  {
  	fac[0] = 1;
  	for(LL n = 1; n <= 3*N; n++)
  		fac[n] = (fac[n-1]*n)%MOD;
  	fac_inv[3*N] = mod_pow(fac[3*N],MOD-2);
  	for(LL n = 3*N-1; n >= 0; n--)
  		fac_inv[n] = (fac_inv[n+1]*(n+1))%MOD;
  
  	LL a, b, c; cin >> a >> b >> c;
  	a++;
  	//WLOG, b > c
  	if(!(b>c))
  	{
  		b = b^c;
  		c = b^c;
  		b = b^c;
  	}
  
  	LL ans = 0;
  	LL sum = 1;
  	LL pull = 0;
  	for(LL n = a; n <= a+b+c; n++)
  	{
  		LL sub = 0;
  		
  		sub = (sub+sum-pull)%MOD;
  		sub = (sub*C(n-2,a-2))%MOD;
  		sub = (sub*mod_pow(3,a+b+c-n))%MOD;
  		ans = (ans+sub)%MOD;
  
  		sum  = (2*sum-C(n-a,c))%MOD;
  		pull = (2*pull+C(n-a,n-a-b))%MOD;
  	}
  	cout<<(ans+MOD)%MOD<<endl;
  
  	return 0;
  }
problem_description: Statement
  
  Alice, Bob and Charlie are playing _Card Game for Three_ , as below:
  
    * At first, each of the three players has a deck consisting of some number of cards. Alice's deck has N cards, Bob's deck has M cards, and Charlie's deck has K cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged.
    * The players take turns. Alice goes first.
    * If the current player's deck contains at least one card, discard the top card in the deck. Then, the player whose name begins with the letter on the discarded card, takes the next turn. (For example, if the card says `a`, Alice takes the next turn.)
    * If the current player's deck is empty, the game ends and the current player wins the game.
  
  There are 3^{N+M+K} possible patters of the three player's initial decks.
  Among these patterns, how many will lead to Alice's victory?
  
  Since the answer can be large, print the count modulo 1\,000\,000\,007
  (=10^9+7).
samples: [{"input": "1 1 1", "output": "17\n    \n\n  * If Alice's card is `a`, then Alice will win regardless of Bob's and Charlie's card. There are 3\u00d73=9 such patterns.\n  * If Alice's card is `b`, Alice will only win when Bob's card is `a`, or when Bob's card is `c` and Charlie's card is `a`. There are 3+1=4 such patterns.\n  * If Alice's card is `c`, Alice will only win when Charlie's card is `a`, or when Charlie's card is `b` and Bob's card is `a`. There are 3+1=4 such patterns.\n\nThus, there are total of 9+4+4=17 patterns that will lead to Alice's victory.\n\n* * *"}, {"input": "4 2 2", "output": "1227\n    \n\n* * *"}, {"input": "1000 1000 1000", "output": "261790852"}]