# 2. 题解

$$G(x)=a_1x+a_2x^2+a_3x^3+…$$

$$G_i(x)=1+x^i+x^{2i}+…+x^{pi}$$

$G_i(x)$中的 $a[i]_px^p$和 $G_j(x)$中的 $a[j]_qx^q$可以合并得到新的母函数的 $(a[i]_pa[j]_q)x^{p+q}$（其中 $a[i]_j$表示 $G_i(x)$的 $j$次项的系数）

$$G(x)=G_i(x)G_j(x)$$

$$G(x)=G_1(x)G_2(x)G_3(x)…G_{26}(x)$$

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

template <typename _Tp> inline void IN(_Tp& dig)
{
char c; bool flag = 0; dig = 0;
while (c = getchar(), !isdigit(c)) if (c == '-') flag = 1;
while (isdigit(c)) dig = dig * 10 + c - '0', c = getchar();
if (flag) dig = -dig;
}

struct poly
{
LL v[55];
LL& operator [] (const int a) {return v[a];}
void operator *= (poly& oth)
{
LL tmp[55]; memset(tmp, 0, sizeof(tmp));
for (int i = 0; i <= 50; i += 1)
for (int j = 0; i + j <= 50; j += 1)
tmp[i + j] += v[i] * oth[j];
memmove(v, tmp, sizeof(v));
}
} sum, cur;

int T, x;

LL ans;

int main(int argc, char const* argv[])
{
IN(T);
while (T--)
{
memset(sum.v, 0, sizeof(sum.v)), sum[0] = 1;
for (int i = 1; i <= 26; i += 1)
{
IN(x), memset(cur.v, 0, sizeof(cur.v));
for (int p = 0, j = 0; p <= x && j <= 50; p += 1, j += i) cur[j] = 1;
sum *= cur;
}
ans = 0; for (int i = 1; i <= 50; i += 1) ans += sum[i];
printf("%lld\n", ans);
}
return 0;
}