#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 <tuple>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;
static const unsigned MODVAL = 1000000009;
struct mint
{
unsigned val;
mint():val(0){}
mint(int x):val(x%MODVAL) {}
mint(unsigned x):val(x%MODVAL) {}
mint(LL x):val(x%MODVAL) {}
};
mint& operator+=(mint& x, mint y) { return x = x.val+y.val; }
mint& operator-=(mint& x, mint y) { return x = x.val-y.val+MODVAL; }
mint& operator*=(mint& x, mint y) { return x = LL(x.val)*y.val; }
mint operator+(mint x, mint y) { return x+=y; }
mint operator-(mint x, mint y) { return x-=y; }
mint operator*(mint x, mint y) { return x*=y; }
mint POW(mint x, LL e) { mint v=1; for(;e;x*=x,e>>=1) if(e&1) v*=x; return v; }
mint& operator/=(mint& x, mint y) { return x *= POW(y, MODVAL-2); }
mint operator/(mint x, mint y) { return x/=y; }
class ColourHolic { public:
int countSequences(vector <int> n)
{
mint ans = 0;
for(int c=0; c<4; ++c) if(n[c]) {
n[c]--;
ans += calc(c, n);
n[c]++;
}
return ans.val;
}
map<LL, mint> memo;
mint calc(int cp, vector<int>& n)
{
if(n[0]+n[1]+n[2]+n[3]==0)
return 1;
vector<int> nn;
for(int c=0; c<4; ++c) if(c!=cp)
nn.push_back(n[c]);
sort(nn.begin(), nn.end());
LL key = n[cp];
for(int v: nn)
key=key*50001+v;
if(memo.count(key))
return memo[key];
int tot = accumulate(n.begin(), n.end(), 0);
int ma = max(nn.front(), nn.back());
if(ma*2 > tot+1)
return 0;
mint ans = 0;
for(int c=0; c<4; ++c) if(c!=cp && n[c]) {
n[c]--;
ans += calc(c, n);
n[c]++;
}
return memo[key] = ans;
}
};
// 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(_, ColourHolic().countSequences(n));}
int main(){
CASE(0)
int n_[] = {1,0,2,3};
vector <int> n(n_, n_+sizeof(n_)/sizeof(*n_));
int _ = 10;
END
CASE(1)
int n_[] = {1,1,1,1};
vector <int> n(n_, n_+sizeof(n_)/sizeof(*n_));
int _ = 24;
END
CASE(2)
int n_[] = {42,42,42,9001};
vector <int> n(n_, n_+sizeof(n_)/sizeof(*n_));
int _ = 0;
END
CASE(3)
int n_[] = {8,0,0,8};
vector <int> n(n_, n_+sizeof(n_)/sizeof(*n_));
int _ = 2;
END
CASE(4)
int n_[] = {0,5,1,3};
vector <int> n(n_, n_+sizeof(n_)/sizeof(*n_));
int _ = 4;
END
CASE(5)
int n_[] = {4,2,1,3};
vector <int> n(n_, n_+sizeof(n_)/sizeof(*n_));
int _ = 1074;
END
CASE(6)
int n_[] = {15,900,357,22};
vector <int> n(n_, n_+sizeof(n_)/sizeof(*n_));
int _ = 0;
END
CASE(7)
int n_[] = {110,30000,200,29999};
vector <int> n(n_, n_+sizeof(n_)/sizeof(*n_));
int _ = 118115350;
END
/*
CASE(8)
int n_[] = ;
vector <int> n(n_, n_+sizeof(n_)/sizeof(*n_));
int _ = ;
END
CASE(9)
int n_[] = ;
vector <int> n(n_, n_+sizeof(n_)/sizeof(*n_));
int _ = ;
END
*/
}
// END CUT HERE