#include #include using namespace std; int MOD = 11380; int memo[12][12][12][32]; int solve(int c1, int c2, int c3, int d) { if (c1<0 || c2<0 || c3<0 || d<0) return 0; if (c1+c2+c3==0) return 1; int &res = memo[c1][c2][c3][d]; if (res >= 0) return res; res = 0; // parenthesis first for (int c3in=0; c3in> c1 >> c2 >> c3 >> d) cout << (solve(c1,c2,c3,d)-solve(c1,c2,c3,d-1)+MOD)%MOD << endl; }