#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

static const int MODVAL = 1000000007; // must be prime for op/
struct mint
{
	int val;
	mint():val(0){}
	mint(int x):val(x%MODVAL) {}
	mint(LL  x):val(x%MODVAL) {}
};
mint operator+(mint x, mint y) { return x.val+y.val; }
mint operator*(mint x, mint y) { return LL(x.val)*y.val; }
mint POW(mint x, int e) {
	mint v = 1;
	for(;e;x=x*x,e>>=1)
		if(e&1)
			v=v*x;
	return v;
}
mint operator/(mint x, mint y) { return x * POW(y, MODVAL-2); }
vector<mint> FAC_(1,1);
void FAC_INIT(int n) { while( FAC_.size()<=n ) FAC_.push_back( FAC_.back()*int(FAC_.size()) ); }
mint FAC(int x)      { return FAC_[x]; }

class CubeBuilding { public:
	int getCount(int R, int G, int B, int N) 
	{
		FAC_INIT(25);
		memo2.assign(26*26*26*26, -1);
		memo2all.assign(26*26*26*26, -1);
		memo3.assign(26*26*26*26, -1);
		return (dim3(R,G,B,N,N)+dim3(G,B,R,N,N)+dim3(B,G,R,N,N)).val;
	}

	vector<int> memo3;
	mint dim3(int R, int G, int B, int n, int N)
	{
		if( n == 0 )
			return (R+G+B==0 ? 1 : 0);

		if(G>B) swap(G,B);
		int key = ((R*26+G)*26+B)*26+n;
		if( memo3[key] >= 0 )
			return memo3[key];

		mint total = 0;
		for(int r=0; r<=R; ++r)
			for(int g=0; g<=G; ++g)
				for(int b=0; b<=B; ++b)
					total = total + dim2all(r,g,b,N)*dim3(R-r,G-g,B-b,n-1,N);
		memo3[key] = total.val;
		return total;
	}

	vector<int> memo2;
	mint dim2(int R, int G, int B, int n)
	{
		if( n == 0 ) return (R+G+B==0 ? 1 : 0);
		if( R == 0 ) return (G+B==0 ? 1 : 0);

		if(G>B) swap(G,B);
		int key = ((R*26+G)*26+B)*26+n;
		if( memo2[key] >= 0 )
			return memo2[key];

		mint total = 0;
		for(int r=1; r<=R; ++r)
			for(int g=0; g<=G; ++g) {
				int b = n-r-g;
				if( 0<=b && b<=B )
					total = total + dim2all(R-r,G-g,B-b,n) * (FAC(n-1)/FAC(r-1)/FAC(g)/FAC(b));
			}
		memo2[key] = total.val;
		return total;
	}

	vector<int> memo2all;
	mint dim2all(int R, int G, int B, int n)
	{
		int key = ((R*26+G)*26+B)*26+n;
		if( memo2all[key] >= 0 )
			return memo2all[key];

		mint total = 0;
		for(int m=0; m<=n; ++m)
			total = total + dim2(R,G,B,m)*(FAC(n)/FAC(m)/FAC(n-m));
		memo2all[key] = total.val;
		return total;
	}
};

// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
 { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
 { os << "{ ";
   for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
   os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const int& Expected, const int& Received) {
 bool ok = (Expected == Received);
 if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
 cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END	 verify_case(_, CubeBuilding().getCount(R, G, B, N));}
int main(){

CASE(0)
	int R = 1; 
	int G = 0; 
	int B = 1; 
	int N = 2; 
	int _ = 4; 
END
CASE(1)
	int R = 1; 
	int G = 1; 
	int B = 2; 
	int N = 1; 
	int _ = 0; 
END
CASE(2)
	int R = 2; 
	int G = 2; 
	int B = 1; 
	int N = 3; 
	int _ = 162; 
END
CASE(3)
	int R = 0; 
	int G = 0; 
	int B = 10; 
	int N = 12; 
	int _ = 372185933; 
END
CASE(4)
	int R = 25; 
	int G = 25; 
	int B = 25; 
	int N = 25; 
	int _ = -1; 
END
/*
CASE(5)
	int R = ; 
	int G = ; 
	int B = ; 
	int N = ; 
	int _ = ; 
END
*/
}
// END CUT HERE
