######################################################################
##P123: Save this file as  P123                                      #
## To use it, stay in the                                            #
##same directory, get into Maple (by typing: maple <Enter> )         #
##and then type:  read P123<Enter>                                   #
##Then follow the instructions given there                           #
##                                                                   #
##Written by Doron Zeilberger, Rutgers University ,                  #
#zeilberg at math dot rutgers dot edu                                #
######################################################################

print(`First Written: June-Aug., 2012: tested for Maple 15 `):
print(`Version of June-Aug. 2012  `):
print():
print(`This is P123, one of the  Maple packages`):
print(`accompanying Brian Nakamura and Doron Zeilberger's  article: `):
print(`"Using Noonan-Zeilberger Functional Equations `):
print(`to enumerate (in Polynomial Time!) Generalized Wilf classes"`):
print(`available from:`):
print(` http://www.math.rutgers.edu/~zeilberg/mamarim/mamarimhtml/Gwilf.html .`):
print():
print(`The most current version of this program is available on WWW at:`):
print(` http://www.math.rutgers.edu/~zeilberg/tokhniot/P123 .`):
 


print(`-------------------------------------------------------------`):
 print(`For a list of the story procedures type ezraS();, for help with`):
 print(`a specific procedure, type ezraGuess(procedure_name);   .`):
 print(``):
print(`-------------------------------------------------------------`):

print(`-------------------------------------------------------------`):
 print(`For a list of the Guessing procedures type ezraGuess();, for help with`):
 print(`a specific procedure, type ezraGuess(procedure_name);   .`):
 print(``):
print(`-------------------------------------------------------------`):

print(`-------------------------------------------------------------`):
 print(`For a list of the Checking procedures type ezraC();, for help with`):
 print(`a specific procedure, type ezra(procedure_name);   .`):
 print(``):
print(`-------------------------------------------------------------`):

print(`-------------------------------------------------------------`):
 print(`For a list of the supporting procedures type ezra1();, for help with`):
 print(`a specific procedure, type ezra(procedure_name);   .`):
 print(``):
print(`-------------------------------------------------------------`):


print(`-------------------------------------------------------------`):
 print(`For a list of the MAIN procedures type ezra();, for help with`):
 print(`a specific procedure, type ezra(procedure_name);   .`):
 print(``):
print(`-------------------------------------------------------------`):

ezraC:=proc()

if args=NULL then
 print(` The checking procedures are: CheckPn, PnDirect `):

else
ezra(args):
fi:

end:

ezraS:=proc()

if args=NULL then
 print(` The story procedures are: PCfV, Stat6V `):

else
ezra(args):
fi:

end:


ezraGuess:=proc()

if args=NULL then
 print(` The guessing procedures are: GuessPol, GuessRat, GuessRat1,`):
print(` GuessSeq, GuessSeqF,GuessSeqF1 `):
else
ezra(args):
fi:

end:

ezra1:=proc()

if args=NULL then
 print(` The supporting procedures are: AveAndMoms, Children `):
 print(`  LtoS  `):
 print(` PqLy, PqLyT, StoL, TrimPair, TrimPairs, Wt, Yeladim, YeladimT `):

else
ezra(args):
fi:

end:

ezra:=proc()

if args=NULL then
 print(`The main procedures are: ConjSeqs, ConjSeqsPC`):
 print(`ConjSeqsV, fn, L20, L236, PCf,`):
 print(` PqL, Pn, Seqs, SeqsPC, Stat6 `):
 print(` `):


elif nops([args])=1 and op(1,[args])=AveAndMoms then
print(`AveAndMoms(f,x,N): Given a probability generating function`):
print(`f(x) (a polynomial, rational function and possibly beyond)`):
print(`returns a list whose first entry is the average `):
print(`(alias expectation, alias mean)`):
print(`followed by the variance, the third moment (about the mean) and`):
print(`so on, until the N-th moment (about the mean).`):
print(`If f(1) is not 1, than it first normalizes it by dividing`):
print(`by f(1) (if it is not 0) .`):
print(`For example, try:`):
print(`AveAndMoms((1+x)^100,x,4);`):

elif nops([args])=1 and op(1,[args])=CheckPn then
print(`CheckPn(N):Checks Pn(n,q,y) for n from 1 to N `):
print(`Try: `):
print(` CheckPn(8); `):

elif nops([args])=1 and op(1,[args])=Children then
print(`Children(M,r): given a vector in short format, finds`):
print(`the set of its children also in short format`):
print(`try:`):
print(`Children([2,0,1],1);`):

elif nops([args])=1 and op(1,[args])=ConjSeqs then
print(`ConjSeqs(N,R,n): inputs a positive integer R and a symbol n`):
print(`and conjectures expressions for the sequences`):
print(`"number of permutations of length n with exacty r occurrences`):
print(`of the pattern 123" for r=0..,R as many as it can get. Try:`):
print(` ConjSeqs(20,3,n); `):

elif nops([args])=1 and op(1,[args])=ConjSeqsPC then
print(`ConjSeqsPC(N,R,n): Like ConjSeq(N,R,n)`):
print(`but if N<=25 and R<=7 it uses pre-computed values`):
print(`given by Seqs(N,R)`):
print(` Try:`):
print(` ConjSeqsPC(20,3,n); `):

elif nops([args])=1 and op(1,[args])=ConjSeqsV then
print(`ConjSeqsV(N,R,n): Verbose form of ConjSeqsV(N,R,n) `):
print(`Try: `):
print(` ConjSeqsV(20,3,n); `):

elif nops([args])=1 and op(1,[args])=fn then
print(`fn(n,q): the weight-enumerator of S_n according to the weight`):
print(`q^(#123)`):


elif nops([args])=1 and op(1,[args])=GuessPol then
print(`GuessPol(L,n): guesses a polynomial of degree d in n for`):
print(` the list L, such that P(i)=L[i] for i=1..nops(L) for example, try: `):
print(`GuessPol([seq(i,i=1..10)],n);`):

elif nops([args])=1 and op(1,[args])=GuessRat then
print(`GuessRat(L,n) guesses a rational function in n for the`):
print(`sequence L, try:`):
print(`GuessRat([seq((i^2+1)/(i^2+3),i=1..20)],n);`):

elif nops([args])=1 and op(1,[args])=GuessRat1 then
print(`GuessRat1(L,n,d) guesses a rational function in n for the`):
print(`sequence L of degree d. Try:`):
print(`GuessRat1([seq((i^2+1)/(i^2+3),i=1..20)],n,2);`):

elif nops([args])=1 and op(1,[args])=GuessSeq then
print(`GuessSeq(L,n): tries to guess an expression of the form`):
print(`binomial(2*n,n-beta)*RATIONAL(n) for the sequence L, `):
print(`Try:`):
print(`GuessSeq([seq((n1+5)*binomial(2*n1-1,n1-3),n1=1..20)],n);`):


elif nops([args])=1 and op(1,[args])=GuessSeqF then
print(`GuessSeqF(L,n): tries to guess an expression of the form`):
print(`(2*n-a)!/((n-beta)!*(n+c)!)*POL(n) for some positive integers`):
print(`a and c (a<=2*b) and c>=b both as small as possible`):
print(`the sequence L, try:`):
print(`where beta index in L that is not zero`):
print(`GuessSeqF([0$3,seq((n1+5)*(2*n1-3)!/((n1-3)!*(n1+5)!),n1=3..20)],n);`):

elif nops([args])=1 and op(1,[args])=GuessSeqF1 then
print(`GuessSeqF1(L,n,a,c): tries to guess an expression of the form`):
print(`(2*n-a)!/((n-beta)!*(n+c)!)*POL(n) for the sequence L, try:`):
print(`where beta index in L that is not zero`):
print(`GuessSeqF1([0$2,seq((n1+5)*(2*n1-3)!/((n1-3)!*(n1+5)!),n1=3..20)],n,3,5);`):

elif nops([args])=1 and op(1,[args])=L20 then
print(`L20(q): the  precomputed [seq(fn(n1,q),n1=1..20)]. Try: `):
print(`L20(q);`):

elif nops([args])=1 and op(1,[args])=L236 then
print(`L236(q): the pre-computed truncated up to q^6 of the`):
print(`weight-enumerator by q^#123(pi) of S_n, try`):
print(`L236(q) `):

elif nops([args])=1 and op(1,[args])=LtoS then
print(`LtoS(L,q,r): given a vector of increasing powers of q up to the`):
print(`q^(r+1) returns the list of integers of length r+2 whose`):
print(`j-th entry is the number of times q^j shows up`):
print(`Try LtoS([1,1,q,q,q^3,q^3,q^3],q,2);`):


elif nops([args])=1 and op(1,[args])=PCf then
print(`PCf(n):the list`):
print(`whose (r+1)-th entry is the`):
print(`precomputed explicit (conjectured) expressions`):
print(`for the number of 123 n-permutations with exactly r`):
print(`occurrences of 123. Try:`):
print(`PCf(n);`):

elif nops([args])=1 and op(1,[args])=PCfV then
print(`PCfV(n): verbose form of PCf(n) `):
print(`Try:`):
print(`PCfV(n);`):

elif nops([args])=1 and op(1,[args])=Pn then
print(`Pn(n,q,y):The weight-enumerator of perms of {1, ..., n}`):
print(`according to the weight q#123*y[1]#(12,i=1)*y[2]#(12,1=2) ...`):
print(`try: `):
print(`Pn(5,q,y); `):

elif nops([args])=1 and op(1,[args])=PnDirect then
print(`PnDirect(n,q,y):The weight-enumerator of perms of {1, ..., n}`):
print(`according to the weight q#123*y[1]#(12,i=1)*y[2]#(12,1=2) ...`):
print(`computed directly. FOR CHECKING PURPOSES ONLY, VERY SLOW!`):
print(`try: `):
print(`PnDirect(5,q,y); `):

elif nops([args])=1 and op(1,[args])=PqL then
print(`PqL(q,L):The value of P_n(n,q,y) where L=nops(L)`):
print(`and one plugs in for [y[1], ..., y[n]] the`):
print(`values of L, try:`):
print(`PqL(q,[y1,y2,y3]);`):

elif nops([args])=1 and op(1,[args])=PqLy then
print(`Like PqL(q,L), but using Yeladim(L,q)`):
print(`Try:`):
print(`PqLy(q,[y1,y2,y3]);`):

elif nops([args])=1 and op(1,[args])=PqLyT then
print(`PqLyT(q,L,r):Like PqLy but only interested in terms up`):
print(`to the r-th power of q`):
print(`Try:`):
print(`PqLyT(q,[1,1,1,1],1);`):


elif nops([args])=1 and op(1,[args])=Seqs then
print(`Seqs(N,R): The lists whose R+1 lists whose (r+1)-th list`):
print(`is the first N members (starting at n=1)`):
print(`number of permutations with exactly r occurrence of 123,`):
print(`try: Seqs(8,3);`):

elif nops([args])=1 and op(1,[args])=SeqsPC then
print(`SeqsPC(N,R): The pre-computed Seqs(N,R) for N<=25 and R<=7`):
print(`try: SeqsPC(8,3);`):

elif nops([args])=1 and op(1,[args])=Stat6 then
print(`Stat6(n): the expectation, variance, and the 3rd-6th moments`):
print(`about the mean of the random variable #occurrences `):
print(`of the pattern 123 in S_n. `):
print(`Also the alpha coefficients up to the sixth`):
print(`(for the odd ones you get the square)`):
print(`Try:`):
print(`Stat6(n);`):

elif nops([args])=1 and op(1,[args])=Stat6V then
print(`Stat6V(n): Verbose version of Stat6(n) (q.v.) `):
print(`Try:`):
print(`Stat6V(n);`):

elif nops([args])=1 and op(1,[args])=StoL then
print(`StoL(M,q,r): given a vector in short format`):
print(`converts it to long format, try:`):
print(`StoL([2,1,3],q,1);`):

elif nops([args])=1 and op(1,[args])=TrimPair then
print(`TrimPair(P,q,r): Given a Pair P=[coeff,L]`):
print(`where coeff is a power of q, `):
print(` and L is a list of powers of q, returns the `):
print(`empty set if coeff has power larger than r,`):
print(`and otherwise returns the singleton`):
print(`{[coeff,L1]} where L1 is L with`):
print(`any power larger than q^(r+1) is replaced by q^(r+1)`):
print(`For example, try: `):
print(`TrimPair([q,[1,1,q,q,q^3,q^4,q^4]],q,2);`):

elif nops([args])=1 and op(1,[args])=TrimPairs then
print(`TrimPairs(S,q,r): the set of trimmed pairs coming from the`):
print(`set of pairs S with respect to the power r, try:`):
print(`TrimPairs({[q,[1,1,q,q,q^3,q^4,q^4]]},q,1);`):

elif nops([args])=1 and op(1,[args])=Wt then
print(`Wt(pi,q,y): the weight of a permutation pi according to`):
print(`q^(#123)*y[1]#(12,i=1)*y[2]#(12,1=2) ... `):
print(`Try: `):
print(`Wt([1,2,3,4],q,y); `):



elif nops([args])=1 and op(1,[args])=Yeladim then
print(`Yeladim(L,q): the children of the list L`):
print(`Try: Yeladim([1,1,1],q);`):

elif nops([args])=1 and op(1,[args])=YeladimT then
print(`YeladimT(L,q,r): the trimmed children of the list L`):
print(`with respect to the power r.`):
print(`Try: YeladimT([1,q^3,q^5],q,2);`):

else
print(`There is no ezra for`,args):
fi:
 
end:


#L20(q): the  precomputed [seq(fn(n1,q),n1=1..20)]. Try: 
#L20(q);
L20:=proc(q):
[1, 2, 5+q, 3*q^2+q^4+6*q+14, 42+24*q^2+7*q^3+4*q^7+6*q^5+q^10+9*q^4+27*q, 132+
133*q^2+70*q^3+32*q^7+54*q^5+16*q^10+37*q^6+24*q^8+6*q^12+5*q^16+12*q^9+8*q^13+
74*q^4+6*q^11+q^20+110*q, 429+635*q^2+461*q^3+320*q^7+395*q^5+191*q^10+387*q^6+
260*q^8+104*q^12+74*q^16+232*q^9+130*q^13+507*q^4+10*q^25+6*q^30+30*q^21+18*q^
18+10*q^26+162*q^11+10*q^20+62*q^17+13*q^22+100*q^14+32*q^19+24*q^15+8*q^23+q^
35+429*q, 1430+2807*q^2+2528*q^3+2544*q^7+2570*q^5+2077*q^10+2864*q^6+2389*q^8+
1580*q^12+1047*q^16+2182*q^9+1456*q^13+3008*q^4+324*q^25+154*q^30+466*q^21+682*
q^18+252*q^26+1818*q^11+546*q^20+1004*q^17+537*q^22+1494*q^14+656*q^19+886*q^15
+288*q^23+38*q^35+115*q^28+68*q^34+16*q^40+138*q^29+228*q^24+47*q^36+66*q^31+
156*q^27+60*q^33+58*q^32+18*q^38+15*q^44+7*q^50+40*q^39+12*q^45+10*q^41+q^56+
1638*q, 4862+11864*q^2+12525*q^3+17357*q^7+15203*q^5+17505*q^10+18179*q^6+18096
*q^8+15847*q^12+12472*q^16+17333*q^9+15068*q^13+16151*q^4+6072*q^25+3412*q^30+
8225*q^21+10837*q^18+5158*q^26+16605*q^11+8935*q^20+12101*q^17+8089*q^22+15049*
q^14+9588*q^19+12630*q^15+6836*q^23+1995*q^35+3901*q^28+1887*q^34+850*q^40+3462
*q^29+5405*q^24+1583*q^36+2976*q^31+4541*q^27+2151*q^33+2524*q^32+1064*q^38+488
*q^44+166*q^50+1190*q^39+420*q^45+834*q^41+57*q^56+508*q^43+1312*q^37+282*q^48+
458*q^46+234*q^51+427*q^47+19*q^65+110*q^58+148*q^52+823*q^42+50*q^60+248*q^53+
186*q^49+44*q^54+66*q^57+80*q^55+20*q^63+58*q^59+8*q^77+21*q^70+60*q^64+14*q^71
+12*q^66+10*q^62+q^84+6188*q, 16796+48756*q^2+58258*q^3+107194*q^7+83382*q^5+
129449*q^10+105082*q^6+120197*q^8+132579*q^12+127049*q^16+121630*q^9+130310*q^
13+80889*q^4+84020*q^25+61259*q^30+103134*q^21+121330*q^18+82579*q^26+128712*q^
11+109115*q^20+121602*q^17+102875*q^22+133945*q^14+112240*q^19+124572*q^15+
95256*q^23+41368*q^35+69645*q^28+44615*q^34+27361*q^40+64590*q^29+86372*q^24+
39552*q^36+56574*q^31+73540*q^27+47734*q^33+53742*q^32+31990*q^38+18612*q^44+
9812*q^50+29182*q^39+16776*q^45+25088*q^41+5451*q^56+20574*q^43+35538*q^37+
14304*q^48+15679*q^46+9188*q^51+14582*q^47+2434*q^65+5058*q^58+8974*q^52+23871*
q^42+3486*q^60+9012*q^53+11058*q^49+6788*q^54+4708*q^57+5824*q^55+2206*q^63+
4682*q^59+700*q^77+1480*q^70+2678*q^64+1130*q^71+1977*q^66+2795*q^62+326*q^84+
986*q^72+192*q^80+1256*q^67+608*q^75+1192*q^68+3004*q^61+401*q^74+1134*q^69+296
*q^83+603*q^76+264*q^82+172*q^90+22*q^98+59*q^92+60*q^85+312*q^79+378*q^78+64*q
^87+606*q^73+72*q^91+107*q^86+156*q^81+120*q^89+15*q^88+84*q^97+35*q^96+28*q^
104+9*q^112+16*q^105+14*q^99+12*q^94+q^120+23256*q, 58786+196707*q^2+259787*q^3
+616449*q^7+431167*q^5+868607*q^10+568809*q^6+730182*q^8+975820*q^12+1099257*q^
16+778432*q^9+1000220*q^13+385387*q^4+1005574*q^25+867777*q^30+1079286*q^21+
1121794*q^18+1002920*q^26+901457*q^11+1106169*q^20+1092656*q^17+1094214*q^22+
1059437*q^14+1101327*q^19+1051194*q^15+1065888*q^23+694925*q^35+925079*q^28+
735291*q^34+536582*q^40+897540*q^29+1031696*q^24+665451*q^36+833036*q^31+963317
*q^27+761461*q^33+807892*q^32+601738*q^38+428537*q^44+288746*q^50+567469*q^39+
402525*q^45+514598*q^41+191347*q^56+457925*q^43+644967*q^37+343753*q^48+377705*
q^46+273107*q^51+354636*q^47+98752*q^65+167509*q^58+250591*q^52+487819*q^42+
140646*q^60+248644*q^53+315180*q^49+223830*q^54+177756*q^57+206056*q^55+111283*
q^63+159312*q^59+35811*q^77+65623*q^70+105226*q^64+60868*q^71+89678*q^66+124559
*q^62+19063*q^84+54635*q^72+27264*q^80+84846*q^67+42730*q^75+74486*q^68+133790*
q^61+43978*q^74+68371*q^69+20715*q^83+39349*q^76+21425*q^82+11210*q^90+4878*q^
98+8278*q^92+16286*q^85+28528*q^79+32045*q^78+15964*q^87+50256*q^73+8690*q^91+
14829*q^86+25732*q^81+11168*q^89+11766*q^88+4362*q^97+5607*q^96+1787*q^104+398*
q^112+1862*q^105+3660*q^99+7356*q^94+150*q^120+6657*q^95+4146*q^101+8326*q^93+
3456*q^102+1310*q^110+166*q^119+746*q^113+3955*q^100+1806*q^108+1688*q^106+2283
*q^107+1089*q^115+850*q^116+533*q^122+867*q^114+392*q^123+224*q^131+25*q^140+
534*q^117+2574*q^103+1756*q^109+462*q^124+68*q^133+508*q^118+64*q^125+874*q^111
+66*q^127+166*q^121+148*q^126+35*q^129+98*q^132+56*q^138+222*q^130+112*q^139+36
*q^147+10*q^156+18*q^148+16*q^141+14*q^135+q^165+87210*q, 208012+783750*q^2+
1124704*q^3+3357324*q^7+2129734*q^5+5409361*q^10+2930602*q^6+4158993*q^8+
6582534*q^12+8554680*q^16+4649860*q^9+7005086*q^13+1769705*q^4+10363514*q^25+
10298618*q^30+9887754*q^21+9302926*q^18+10534421*q^26+5850192*q^11+9848663*q^20
+8800138*q^17+10252212*q^22+7664290*q^14+9455254*q^19+7955082*q^15+10289744*q^
23+9411088*q^35+10439795*q^28+9696595*q^34+8326384*q^40+10286752*q^29+10412901*
q^24+9248159*q^36+10083848*q^31+10461734*q^27+9782454*q^33+10060255*q^32+
8858488*q^38+7351731*q^44+5840485*q^50+8529828*q^39+7038964*q^45+8050836*q^41+
4459522*q^56+7566114*q^43+9051636*q^37+6353104*q^48+6825097*q^46+5557854*q^51+
6520322*q^47+2809980*q^65+4065748*q^58+5315981*q^52+7878546*q^42+3655541*q^60+
5124276*q^53+6064454*q^49+4931245*q^54+4237332*q^57+4648480*q^55+3128488*q^63+
3856570*q^59+1410444*q^77+2143602*q^70+2987967*q^64+2019970*q^71+2673316*q^66+
3339915*q^62+905971*q^84+1907813*q^72+1170509*q^80+2536156*q^67+1591784*q^75+
2404584*q^68+3476616*q^61+1686055*q^74+2249478*q^69+964510*q^83+1520651*q^76+
1036376*q^82+616455*q^90+343986*q^98+514716*q^92+831612*q^85+1226822*q^79+
1317057*q^78+747260*q^87+1781342*q^73+557190*q^91+789574*q^86+1106488*q^81+
651210*q^89+692353*q^88+360726*q^97+411831*q^96+220097*q^104+113464*q^112+
195598*q^105+307942*q^99+459377*q^94+58398*q^120+434182*q^95+280706*q^101+
488784*q^93+264987*q^102+147435*q^110+64736*q^119+102292*q^113+294353*q^100+
162255*q^108+183818*q^106+176288*q^107+96054*q^115+89357*q^116+54015*q^122+
97316*q^114+49646*q^123+26652*q^131+12682*q^140+83976*q^117+246044*q^103+154968
*q^109+49758*q^124+22070*q^133+79584*q^118+43118*q^125+132786*q^111+33592*q^127
+49392*q^121+37987*q^126+25650*q^129+25240*q^132+13460*q^138+27024*q^130+13684*
q^139+6556*q^147+3049*q^156+7027*q^148+11348*q^141+15894*q^135+1270*q^165+17858
*q^134+26591*q^128+201*q^168+5028*q^149+1878*q^158+740*q^161+7991*q^142+2350*q^
151+6379*q^144+12254*q^137+2217*q^152+6052*q^143+11956*q^136+6532*q^146+4750*q^
145+3326*q^155+3851*q^150+1597*q^164+2108*q^153+928*q^162+2819*q^154+1452*q^163
+798*q^172+28*q^192+574*q^173+296*q^182+426*q^160+612*q^167+86*q^175+822*q^166+
2658*q^157+77*q^184+630*q^174+76*q^177+1122*q^159+370*q^171+128*q^183+173*q^176
+81*q^170+84*q^180+336*q^181+84*q^190+11*q^210+144*q^191+45*q^200+160*q^169+20*
q^201+18*q^193+16*q^186+q^220+326876*q, 742900+3095708*q^2+4765761*q^3+17513013
*q^7+10148146*q^5+31788007*q^10+14527238*q^6+22555348*q^8+41578030*q^12+
61392446*q^16+26334141*q^9+45793201*q^13+7902982*q^4+95364767*q^25+106264648*q^
30+82132111*q^21+70714898*q^18+98743416*q^26+35742354*q^11+79256093*q^20+
65216222*q^17+86841291*q^22+51617654*q^14+74159849*q^19+55613837*q^15+89589031*
q^23+109242054*q^35+103107053*q^28+109597236*q^34+107398163*q^40+104141846*q^29
+93272321*q^24+109535912*q^36+106913170*q^31+100593111*q^27+108598104*q^33+
108510167*q^32+109263115*q^38+102909182*q^44+92509865*q^50+108100043*q^39+
101108234*q^45+106309300*q^41+79766705*q^56+104077754*q^43+109131105*q^37+18*q^
248+96245699*q^48+99769221*q^46+90273768*q^51+97692295*q^47+60404644*q^65+
75466422*q^58+88198934*q^52+105573955*q^42+71014543*q^60+86158442*q^53+94243658
*q^49+84167053*q^54+77576749*q^57+81944477*q^55+64662455*q^63+73256353*q^59+
38315583*q^77+50444780*q^70+62522023*q^64+48725715*q^71+58265028*q^66+66804419*
q^62+28212990*q^84+46722639*q^72+33611422*q^80+56315728*q^67+41530642*q^75+
54362925*q^68+68786250*q^61+43172948*q^74+52371569*q^69+29544910*q^83+39904659*
q^76+30870791*q^82+21386087*q^90+14319433*q^98+19277029*q^92+26989614*q^85+
35096445*q^79+36614447*q^78+24622447*q^87+44846694*q^73+20360834*q^91+25627820*
q^86+32248565*q^81+22419747*q^89+23422034*q^88+15061766*q^97+15965250*q^96+
10485164*q^104+6707782*q^112+16*q^241+9912529*q^105+13614580*q^99+17538377*q^94
+4220645*q^120+16753863*q^95+12315934*q^101+18402179*q^93+11660950*q^102+
7604672*q^110+4494381*q^119+6324883*q^113+12872502*q^100+8390912*q^108+9323095*
q^106+8923702*q^107+5702978*q^115+5395444*q^116+3737985*q^122+5970480*q^114+
3590054*q^123+2207530*q^131+1233362*q^140+5096902*q^117+11113788*q^103+8012960*
q^109+3367522*q^124+1931435*q^133+4805334*q^118+3163314*q^125+7177647*q^111+
2780294*q^127+3960000*q^121+2968116*q^126+2427157*q^129+2066968*q^132+1399816*q
^138+2300956*q^130+1322758*q^139+778204*q^147+404781*q^156+724300*q^148+1150102
*q^141+1673666*q^135+205227*q^165+1770885*q^134+2572104*q^128+167317*q^168+
663725*q^149+347818*q^158+288166*q^161+1041404*q^142+561700*q^151+924047*q^144+
1456616*q^137+530599*q^152+983450*q^143+1549696*q^136+820946*q^146+857456*q^145
+446604*q^155+612468*q^150+231408*q^164+497128*q^153+267478*q^162+480458*q^154+
256465*q^163+132498*q^172+17546*q^192+110594*q^173+52194*q^182+294974*q^160+
183088*q^167+92676*q^175+183338*q^166+384302*q^157+41978*q^184+94681*q^174+
87566*q^177+316283*q^159+142488*q^171+43758*q^183+90642*q^176+147960*q^170+
74759*q^180+60826*q^181+28545*q^190+3052*q^210+23908*q^191+8642*q^200+155114*q^
169+9048*q^201+17599*q^193+47380*q^186+973*q^220+21049*q^196+43358*q^185+33464*
q^189+83078*q^178+72838*q^179+38435*q^188+20688*q^197+42206*q^187+23647*q^195+
7216*q^207+14972*q^198+10345*q^206+220*q^228+2366*q^217+12371*q^199+3416*q^209+
21504*q^194+4382*q^213+5656*q^202+8763*q^203+2119*q^211+12034*q^204+2290*q^223+
3177*q^212+10574*q^205+4192*q^215+2644*q^224+6244*q^214+1576*q^222+816*q^234+
1760*q^225+1260*q^233+31*q^255+378*q^244+584*q^219+810*q^227+84*q^236+1028*q^
226+5080*q^208+4008*q^216+86*q^246+838*q^235+1410*q^218+86*q^238+148*q^231+485*
q^221+96*q^230+212*q^237+504*q^243+560*q^232+126*q^242+180*q^254+162*q^245+120*
q^253+12*q^275+55*q^264+182*q^229+q^286+22*q^265+20*q^256+1225785*q, 2674440+
12152855*q^2+19873150*q^3+88211386*q^7+46993138*q^5+178382297*q^10+69819523*q^6
+117666162*q^8+249285628*q^12+413564544*q^16+142944704*q^9+283480618*q^13+
34539352*q^4+801876964*q^25+992127792*q^30+630225808*q^21+502136436*q^18+
847368055*q^26+207976352*q^11+591941715*q^20+452230562*q^17+680508932*q^22+
328398190*q^14+541319436*q^19+365385054*q^15+718681320*q^23+1126561842*q^35+
923549688*q^28+1108270477*q^34+1217965433*q^40+953750766*q^29+766082686*q^24+
1152641927*q^36+1019051018*q^31+881412134*q^27+1077043714*q^33+1054432886*q^32+
1190961158*q^38+1252820286*q^44+1249751790*q^50+1202278740*q^39+1251910696*q^45
+1225565538*q^41+1193806606*q^56+1243534974*q^43+1167816922*q^37+90926*q^248+
1256363590*q^48+1258721599*q^46+1239939988*q^51+1254168288*q^47+1045225822*q^65
+1166842266*q^58+1235306909*q^52+1239693506*q^42+1135687370*q^60+1224099972*q^
53+1250336342*q^49+1216875225*q^54+1178109916*q^57+1202916542*q^55+1082432148*q
^63+1148873864*q^59+801460744*q^77+947629494*q^70+1066020670*q^64+926165358*q^
71+1027825140*q^66+1101868406*q^62+661099430*q^84+906790427*q^72+740767367*q^80
+1005868854*q^67+842261682*q^75+988451917*q^68+1116426592*q^61+864432746*q^74+
966079052*q^69+679685462*q^83+823651044*q^76+700835140*q^82+550100091*q^90+
419423188*q^98+514925638*q^92+641134824*q^85+759837602*q^79+781568763*q^78+
603182858*q^87+883542130*q^73+531317432*q^91+622702965*q^86+719221464*q^81+
566543946*q^89+585578463*q^88+433791940*q^97+450611567*q^96+337311894*q^104+
247115098*q^112+141364*q^241+324038960*q^105+404193616*q^99+481497307*q^94+
177196657*q^120+465225136*q^95+376171822*q^101+497389018*q^93+363667693*q^102+
268066400*q^110+185018096*q^119+236684548*q^113+390276081*q^100+289311408*q^108
+312168793*q^106+300345618*q^107+218299672*q^115+210193238*q^116+162517691*q^
122+227372930*q^114+155872504*q^123+109103900*q^131+71961893*q^140+201394078*q^
117+349816628*q^103+278039772*q^109+149736322*q^124+99806466*q^133+193506820*q^
118+142911036*q^125+257087394*q^111+130550128*q^127+169413084*q^121+137080273*q
^126+119190492*q^129+104722332*q^132+78846753*q^138+114111998*q^130+75152240*q^
139+50968074*q^147+32333312*q^156+48742493*q^148+68642314*q^141+90690372*q^135+
20133138*q^165+95250078*q^134+124795720*q^128+16910382*q^168+46195528*q^149+
29236157*q^158+24717392*q^161+65046336*q^142+41495874*q^151+58919216*q^144+
82208178*q^137+39541819*q^152+61802898*q^143+86380402*q^136+53469962*q^146+
55920894*q^145+33968022*q^155+43885998*q^150+21264493*q^164+37442180*q^153+
23470085*q^162+35767326*q^154+22366502*q^163+13806991*q^172+4326175*q^192+
13001090*q^173+7823982*q^182+26032705*q^160+17958364*q^167+11474112*q^175+
19044070*q^166+30765374*q^157+6855958*q^184+12292412*q^174+10255494*q^177+
27445388*q^159+14420510*q^171+7343536*q^183+10870644*q^176+15230978*q^170+
8785450*q^180+8289524*q^181+4897270*q^190+1400516*q^210+4624928*q^191+2677459*q
^200+200*q^319+220*q^329+255*q^310+165*q^328+66*q^340+126*q^304+112*q^302+210*q
^316+1008*q^305+720*q^317+760*q^293+73780*q^249+157648*q^239+60875*q^250+30400*
q^266+15315*q^276+23422*q^267+10164*q^277+3124*q^288+247*q^300+16040250*q^169+
2464320*q^201+3954124*q^193+6115915*q^186+684227*q^220+124228*q^247+42188*q^258
+104*q^303+344*q^292+22*q^331+13*q^352+18*q^314+3332818*q^196+6390424*q^185+
5243358*q^189+9738776*q^178+9144522*q^179+5452172*q^188+3207390*q^197+5751974*q
^187+3566508*q^195+1745710*q^207+3062054*q^198+1866209*q^206+430382*q^228+
939032*q^217+2865250*q^199+1522752*q^209+3709046*q^194+1092806*q^213+2278321*q^
202+2094650*q^203+1256432*q^211+2024379*q^204+574814*q^223+1181298*q^212+
1885852*q^205+1038476*q^215+557065*q^224+1060474*q^214+576218*q^222+284822*q^
234+550430*q^225+297158*q^233+72662*q^255+158096*q^244+68547*q^252+152939*q^240
+776684*q^219+478566*q^227+275202*q^236+534261*q^226+1652863*q^208+993774*q^216
+129925*q^246+286922*q^235+859792*q^218+213707*q^238+5384*q^283+61264*q^251+
20863*q^260+5674*q^271+32175*q^262+10709*q^272+297058*q^231+644672*q^221+330638
*q^230+237142*q^237+145698*q^243+299344*q^232+145745*q^242+75794*q^254+139964*q
^245+78044*q^253+16308*q^275+39457*q^264+1362*q^298+1036*q^299+94*q^309+801*q^
290+20*q^322+218*q^301+5468*q^287+1044*q^308+95*q^320+7356*q^278+96*q^311+2088*
q^281+1886*q^289+372228*q^229+q^364+6062*q^286+35036*q^265+8452*q^284+2744*q^
294+3780*q^295+2410*q^282+4033*q^296+1872*q^306+1132*q^307+470*q^318+34*q^330+
36218*q^263+20067*q^274+9574*q^285+2176*q^297+16788*q^273+61943*q^256+24*q^341+
4601610*q+17836*q^268+4710*q^279+54346*q^257+1112*q^291+3878*q^280+33272*q^259+
10820*q^270+23018*q^261+12384*q^269, 9694845+47500635*q^2+81864705*q^3+
431654797*q^7+212661944*q^5+964183420*q^10+327200581*q^6+594734142*q^8+
1432446556*q^12+2646358088*q^16+749477928*q^9+1678431450*q^13+148409950*q^4+
6283329787*q^25+8547965436*q^30+4542678081*q^21+3373481548*q^18+5090*q^353+4030
*q^366+6764480189*q^26+1162625794*q^11+4164153753*q^20+2971772275*q^17+
5002317693*q^22+1994478901*q^14+3729224092*q^19+2283787345*q^15+5401834780*q^23
+10619464884*q^35+7660989907*q^28+11655*q^354+39888*q^343+10252969400*q^34+
12474796143*q^40+8074279364*q^29+5873698929*q^24+11042729655*q^36+8949796715*q^
31+7179844190*q^27+9804087636*q^33+9416451295*q^32+11788982533*q^38+13665654169
*q^44+14936776639*q^50+12114719510*q^39+13889258573*q^45+12763192793*q^41+
15580431102*q^56+13365407839*q^43+11388176882*q^37+22263678*q^248+14578498164*q
^48+14158686057*q^46+15061685652*q^51+14351366628*q^47+15495510604*q^65+
15669863296*q^58+15216547661*q^52+13101427948*q^42+15690185704*q^60+15313105239
*q^53+14738952116*q^49+15433181972*q^54+15614697439*q^57+15492934599*q^55+
15606391786*q^63+15668877745*q^59+13963988852*q^77+15024049988*q^70+15570901381
*q^64+14891131042*q^71+15434978796*q^66+15656953617*q^62+12617117502*q^84+
14766053985*q^72+13416553906*q^80+15333883553*q^67+14296895872*q^75+15249745859
*q^68+15663909010*q^61+14465294780*q^74+15130764914*q^69+12819121639*q^83+
14142672786*q^76+13026190755*q^82+11340238360*q^90+9594049344*q^98+10901711150*
q^92+12405717663*q^85+13598861936*q^79+13789832912*q^78+11985167272*q^87+
14609774772*q^73+11118119749*q^91+12199803220*q^86+13217307561*q^81+11554154701
*q^89+11772184414*q^88+9809342881*q^97+10030824602*q^96+8327641610*q^104+
6760074683*q^112+32036127*q^241+8121229004*q^105+9377229559*q^99+10463024369*q^
94+5379003028*q^120+10244993624*q^95+8949833366*q^101+10681822739*q^93+
8742741400*q^102+7136582934*q^110+5544603200*q^119+6576510643*q^113+30618*q^357
+13350*q^368+29448*q^356+20676*q^355+11002*q^367+57112*q^344+14380*q^369+
9161482787*q^100+7521005454*q^108+7915765711*q^106+7717291510*q^107+6217638994*
q^115+6044198879*q^116+5064027935*q^122+6392693878*q^114+4914611419*q^123+
3818396235*q^131+2820472059*q^140+5875727823*q^117+8535827447*q^103+7327808864*
q^109+4767440609*q^124+3578517093*q^133+5707438175*q^118+4624342501*q^125+
6948670234*q^111+4342815034*q^127+229254*q^321+5220785903*q^121+4482198004*q^
126+4072461748*q^129+3696396901*q^132+3020471206*q^138+3942709050*q^130+
2919941482*q^139+2200747927*q^147+1574381484*q^156+2122896737*q^148+2727888000*
q^141+3347775857*q^135+1290*q^384+890*q^374+104*q^395+1110189875*q^165+6512*q^
362+1557*q^365+101332*q^332+4998*q^379+572*q^405+3459501836*q^134+2754*q^382+
4203615653*q^128+981915926*q^168+2048012517*q^149+1459357361*q^158+1298039774*q
^161+2630731422*q^142+1900231778*q^151+2449488306*q^144+3125895693*q^137+
1829567639*q^152+2539801002*q^143+2673*q^392+3232271839*q^136+2279601185*q^146+
2363282519*q^145+1636137278*q^155+1972441547*q^150+226*q^386+1154044940*q^164+
1762788908*q^153+1246842390*q^162+1697958501*q^154+1200658816*q^163+835812586*q
^172+355264210*q^192+802640764*q^173+549178487*q^182+1348476542*q^160+
1024680317*q^167+738143410*q^175+1066543238*q^166+1517639027*q^157+503482084*q^
184+770496145*q^174+677878223*q^177+1404306725*q^159+869885588*q^171+527067750*
q^183+706588928*q^176+904918827*q^170+597569089*q^180+573490646*q^181+387472278
*q^190+154734504*q^210+371630149*q^191+247515773*q^200+1774*q^383+7640*q^371+
232990*q^319+106535*q^329+496397*q^310+132023*q^328+42593*q^340+904016*q^304+
1005785*q^302+380730*q^316+779734*q^305+315550*q^317+1752992*q^293+21028636*q^
249+35922747*q^239+19656866*q^250+8312282*q^266+4617662*q^276+7653612*q^267+
4226527*q^277+2078016*q^288+991031*q^300+943232389*q^169+235847727*q^201+443608
*q^315+338396721*q^193+330*q^403+78*q^429+220*q^416+4702*q^363+31083*q^342+
460095113*q^186+94748967*q^220+264*q^417+1260*q^378+1680*q^391+990*q^404+
23827304*q^247+12791299*q^258+37*q^418+953191*q^303+1829372*q^292+58517*q^345+
510276*q^312+259745*q^324+517493*q^313+106*q^397+89152*q^331+2402*q^373+14*q^
442+13592*q^352+242*q^406+494372*q^314+294666612*q^196+481309887*q^185+
405193418*q^189+649104111*q^178+623071752*q^179+421947273*q^188+282493297*q^197
+441069615*q^187+308654194*q^195+178383754*q^207+270802191*q^198+186351681*q^
206+64262246*q^228+111076068*q^217+258922666*q^199+162863697*q^209+25324*q^358+
322597494*q^194+132887613*q^213+224404780*q^202+213719666*q^203+146950508*q^211
+203689739*q^204+81400811*q^223+139315918*q^212+194727326*q^205+121376547*q^215
+77689260*q^224+126549517*q^214+85208437*q^222+47095203*q^234+74307780*q^225+
49128614*q^233+15653373*q^255+28016389*q^244+22*q^409+17870569*q^252+33718415*q
^240+100265259*q^219+67633337*q^227+42689931*q^236+71262050*q^226+170479585*q^
208+115733002*q^216+25261169*q^246+44930030*q^235+105754450*q^218+38333318*q^
238+3127652*q^283+18721792*q^251+11379626*q^260+6113787*q^271+10350702*q^262+
5881750*q^272+53944701*q^231+89865125*q^221+290*q^385+57068056*q^230+40550841*q
^237+29372995*q^243+51498055*q^232+30513264*q^242+16380156*q^254+26620012*q^245
+17181899*q^253+4988760*q^275+9475599*q^264+9354*q^361+26*q^430+22444*q^359+
4072*q^372+128092*q^334+130428*q^335+207070*q^326+97390*q^337+53946*q^347+
245009*q^325+120238*q^333+188188*q^327+262978*q^323+118238*q^336+1100421*q^298+
986733*q^299+480542*q^309+1914633*q^290+242585*q^322+997208*q^301+2291782*q^287
+548958*q^308+215694*q^320+3892651*q^278+489551*q^311+3477694*q^281+1966128*q^
289+60531601*q^229+2410*q^364+66760*q^346+62784*q^339+47380*q^348+14666*q^360+
32142*q^349+2476879*q^286+5762*q^380+1480*q^393+5635*q^381+8300*q^370+8855012*q
^265+104*q^407+1290*q^394+2941702*q^284+1595834*q^294+1478836*q^295+3263936*q^
282+1345758*q^296+713482*q^306+613167*q^307+263810*q^318+88460*q^330+9872966*q^
263+5313786*q^274+2763880*q^285+1185457*q^297+5583603*q^273+14555353*q^256+q^
455+26946*q^341+1388*q^375+78782*q^338+26090*q^350+24*q^419+116*q^388+302*q^396
+343*q^376+20*q^400+17298645*q+7160420*q^268+3696750*q^279+13613232*q^257+
1900645*q^291+3576495*q^280+12031079*q^259+6460330*q^270+10708569*q^261+6738882
*q^269+16038*q^351+252*q^390+308*q^377+144*q^387, 35357670+185082495*q^2+
334052160*q^3+2061823804*q^7+944504744*q^5+5051976767*q^10+1501719377*q^6+
2928042741*q^8+7945420728*q^12+16228519006*q^16+3817664316*q^9+9574902962*q^13+
629096364*q^4+46471901818*q^25+69013091395*q^30+31103440634*q^21+21648501508*q^
18+15919778*q^353+7177883*q^366+50914748109*q^26+6285453474*q^11+27888225274*q^
20+18676969562*q^17+34893750517*q^22+11652938573*q^14+24490312790*q^19+
13698806566*q^15+38463003358*q^23+93042886656*q^35+59749794821*q^28+14517891*q^
354+26938112*q^343+88368527609*q^34+117883359854*q^40+64117370172*q^29+
42596217453*q^24+98231340490*q^36+73523672220*q^31+55058203008*q^27+83212070136
*q^33+78580981851*q^32+108100973125*q^38+136766455510*q^44+162305774347*q^50+
112780574146*q^39+141026114674*q^45+122428186672*q^41+183122661482*q^56+684*q^
506+131903595076*q^43+102914615238*q^37+2321030803*q^248+154243958711*q^48+
145712100872*q^46+165886290928*q^51+149782424350*q^47+203602248138*q^65+
188885381751*q^58+169818602699*q^52+127439651947*q^42+193951190523*q^60+
173139126452*q^53+158064127536*q^49+176785048023*q^54+185847071426*q^57+
179788174912*q^55+200138309838*q^63+191265588312*q^59+211233975204*q^77+
209616425619*q^70+202167953946*q^64+3630*q^492+8986*q^464+40*q^520+210122497690
*q^71+205299417153*q^66+198390119277*q^62+3400*q^481+206728056580*q^84+113*q^
508+1562*q^494+210876288487*q^72+210115096037*q^80+206412854074*q^67+
211413253224*q^75+207773079421*q^68+196021416602*q^61+211502574389*q^74+
208567660028*q^69+207592748764*q^83+211567882921*q^76+208658452325*q^82+
198587498794*q^90+183363608815*q^98+195173879773*q^92+205447024300*q^85+
210498009934*q^79+211110270202*q^78+202929785818*q^87+211065596820*q^73+
196778129764*q^91+204386691253*q^86+209276026558*q^81+200031250458*q^89+
201662691738*q^88+185360226476*q^97+187546153279*q^96+169773975916*q^104+
150114064315*q^112+8176*q^478+3072458062*q^241+167277698716*q^105+181081102324*
q^99+191481533006*q^94+130042943386*q^120+26*q^521+189414828498*q^95+
176606452710*q^101+193231320932*q^93+174440103448*q^102+155116055041*q^110+
132474275562*q^119+35939*q^452+49144*q^453+17712*q^465+20556*q^467+20496*q^451+
147523048774*q^113+12777342*q^357+6792711*q^368+13166989*q^356+13661922*q^355+
6789238*q^367+25445813*q^344+6757420*q^369+178974066459*q^100+160064817703*q^
108+164950630885*q^106+162417250392*q^107+142476966086*q^115+140049575164*q^116
+125079268336*q^122+145080473106*q^114+122556619478*q^123+103592577238*q^131+
84176102462*q^140+137467724960*q^117+172024352194*q^103+157505589778*q^109+
120185408884*q^124+99090669548*q^133+135038667359*q^118+117714269330*q^125+
152546401048*q^111+112929458084*q^127+85134880*q^321+127483525682*q^121+
115376062984*q^126+108195574898*q^129+101376820202*q^132+88301435588*q^138+
105939047384*q^130+86179542830*q^139+70673023708*q^147+55680486921*q^156+21252*
q^447+68914519171*q^148+82135302102*q^141+226*q^476+94679604982*q^135+3040543*q
^384+5150834*q^374+1656666*q^395+378124*q^415+43164513174*q^165+1850*q^463+
46006*q^438+113896*q^425+36861*q^436+6238*q^449+9982*q^450+2660*q^491+2664*q^
477+128*q^487+288*q^507+495*q^504+10432588*q^362+114*q^495+7726452*q^365+
48631091*q^332+3377924*q^379+952666*q^405+96911078076*q^134+3457770*q^382+
110602515298*q^128+39546944121*q^168+67130574520*q^149+52699641001*q^158+
48406756952*q^161+80187371709*q^142+63683296002*q^151+76292372570*q^144+
90357239048*q^137+62036742212*q^152+78188748158*q^143+1792299*q^392+92546409181
*q^136+72525600606*q^146+74353564338*q^145+57193629494*q^155+65427673914*q^150+
2472421*q^386+44444921561*q^164+60367180482*q^153+47065874025*q^162+58791706135
*q^154+45716609654*q^163+35081972426*q^172+18571696814*q^192+34022798218*q^173+
25715429617*q^182+1714798*q^389+49821730755*q^160+40724913500*q^167+32012774262
*q^175+41950018337*q^166+54152215844*q^157+24133375544*q^184+33024358460*q^174+
97884*q^440+30082309676*q^177+51226953926*q^159+36129463490*q^171+758997*q^402+
2790*q^471+24905588202*q^183+31046327720*q^176+37245752895*q^170+27395239969*q^
180+26531029878*q^181+19831869819*q^190+9958163903*q^210+19185000768*q^191+
14152790834*q^200+3350266*q^383+6303306*q^371+95004380*q^319+57918120*q^329+
146677515*q^310+61676292*q^328+33384065*q^340+195882026*q^304+214993489*q^302+
110534298*q^316+187285186*q^305+105411144*q^317+327638728*q^293+1105*q^472+
2227805708*q^249+3330411914*q^239+2137959910*q^250+1094419716*q^266+708242353*q
^276+1047370242*q^267+677636956*q^277+413846522*q^288+237029918*q^300+67342*q^
439+38365964630*q^169+11886*q^458+10442*q^469+1590*q^483+730604*q^408+
13666895380*q^201+115603596*q^315+2950*q^461+17949786948*q^193+793586*q^403+
228798*q^429+442262*q^416+9547112*q^363+28605811*q^342+22610163912*q^186+
6908599263*q^220+468786*q^417+3413788*q^378+1671442*q^391+904156*q^404+47209*q^
454+100450*q^441+2417325734*q^247+1536331638*q^258+460733*q^418+205316096*q^303
+344046879*q^292+24262928*q^345+248*q^475+132872065*q^312+73435615*q^324+
126381890*q^313+1286210*q^397+51219692*q^331+5645430*q^373+107499*q^442+24*q^
510+q^560+17351175*q^352+909896*q^406+120469668*q^314+116*q^497+16212744804*q^
196+23349286280*q^185+20483665632*q^189+29167394265*q^178+28254839956*q^179+
21174696427*q^188+15666650010*q^197+21872052552*q^187+16770779086*q^195+
11065873648*q^207+15152675650*q^198+11469313821*q^206+5112763938*q^228+
7712446498*q^217+14639212354*q^199+10313085468*q^209+12524163*q^358+17357793829
*q^194+8924123394*q^213+13204436835*q^202+12744581034*q^203+9600190192*q^211+
12309177635*q^204+6168363960*q^223+9260610422*q^212+11874009738*q^205+
8294612406*q^215+5941758753*q^224+8607685837*q^214+6406753895*q^222+4051171078*
q^234+5719473762*q^225+4207609156*q^233+1739298788*q^255+2727035877*q^244+
573756*q^409+1968365013*q^252+3200941510*q^240+7171353818*q^219+5305062510*q^
227+3746475660*q^236+5512941978*q^226+10688670709*q^208+8001509926*q^216+
2517564429*q^246+3894523626*q^235+496387*q^410+7441929208*q^218+3467593901*q^
238+517721802*q^283+2051615810*q^251+1412614759*q^260+880757642*q^271+
1296436225*q^262+843697184*q^272+4549904354*q^231+6650409844*q^221+2784218*q^
385+4731752435*q^230+3603655726*q^237+2835947680*q^243+4378015204*q^232+
2953782876*q^242+1812707835*q^254+2617544420*q^245+1887861790*q^253+739555864*q
^275+1190504273*q^264+129410*q^426+10887806*q^361+219000*q^430+12009744*q^359+
6115936*q^372+43720075*q^334+41757986*q^335+67108552*q^326+38339008*q^337+
22630616*q^347+69529836*q^325+45702338*q^333+64224608*q^327+76714814*q^323+
39838779*q^336+261182187*q^298+247955098*q^299+154578574*q^309+377090371*q^290+
80948899*q^322+248*q^485+225632838*q^301+432458292*q^287+162448678*q^308+
89952467*q^320+648154811*q^278+139708142*q^311+566863462*q^281+394787562*q^289+
4916628310*q^229+8769945*q^364+23321804*q^346+35229188*q^339+21508667*q^348+
11666929*q^360+20820172*q^349+453318396*q^286+3488673*q^380+1861118*q^393+
3578402*q^381+6676015*q^370+1140465938*q^265+815484*q^407+1801037*q^394+
495086309*q^284+313955643*q^294+299308372*q^295+541716154*q^282+286490683*q^296
+179000968*q^306+170747224*q^307+100289744*q^318+54673716*q^330+298672*q^413+
713648*q^401+333807*q^412+1241598596*q^263+772196300*q^274+473450384*q^285+
273296624*q^297+188168*q^422+806479556*q^273+1669798891*q^256+152024*q^423+
1138903*q^398+950718*q^399+57706*q^435+38556*q^455+333716*q^414+19390*q^457+
44106*q^445+32496*q^456+85396*q^443+140053*q^432+315888*q^420+67576*q^444+86474
*q^434+190030*q^431+28*q^533+30964394*q^341+4711538*q^375+36771044*q^338+
19793354*q^350+389854*q^419+1914*q^493+11377*q^468+21447*q^466+8220*q^479+7801*
q^480+179582*q^427+5897*q^460+1849544*q^388+17151*q^448+36416*q^437+1527697*q^
396+284714*q^421+286*q^518+462*q^490+15*q^546+4151454*q^376+91*q^532+35020*q^
446+114634*q^433+8348*q^459+825731*q^400+1696*q^473+380*q^474+353*q^496+125280*
q^424+390272*q^411+203036*q^428+301*q^484+312*q^519+1320*q^505+180*q^486+5112*q
^470+22*q^500+65132550*q+1004267227*q^268+619479404*q^279+1600205450*q^257+
359795882*q^291+592943326*q^280+1471303790*q^259+920058130*q^270+1351697050*q^
261+960985602*q^269+18799178*q^351+1571062*q^390+3673616*q^377+2202996*q^387+
1470*q^462+2260*q^482, 129644790+719559600*q^2+1353003990*q^3+9649284793*q^7+
4130591771*q^5+25784832765*q^10+6773007550*q^6+14099059425*q^8+42774882587*q^12
+96012642017*q^16+18976160113*q^9+52925705561*q^13+2637532977*q^4+327601435478*
q^25+527822429881*q^30+203992436206*q^21+133651691479*q^18+3420208643*q^353+
1982877042*q^366+364828726531*q^26+33031449157*q^11+179208080131*q^20+
113051321620*q^17+232924296736*q^22+65883511528*q^14+154480195064*q^19+
79366505036*q^15+261719557013*q^23+767734069388*q^35+442596584400*q^28+
3276537497*q^354+5113878189*q^343+718139589414*q^34+1042611545654*q^40+
482961222153*q^29+294835860186*q^24+821839890709*q^36+571532995230*q^31+
401472955981*q^27+666709668432*q^33+619828189967*q^32+930233276703*q^38+
1275313588427*q^44+1631620009813*q^50+984368550947*q^39+1332767132797*q^45+
1098154711118*q^41+1976808315734*q^56+1438134*q^506+1214631205674*q^43+
873819928989*q^37+149600634333*q^248+1513060783417*q^48+1393969819829*q^46+
1688741084157*q^51+1451701767305*q^47+2431642193130*q^65+2086143549227*q^58+
1748965087444*q^52+1157788064820*q^42+2191229409527*q^60+1805170995200*q^53+
1570573338506*q^49+1864325766530*q^54+2030140175513*q^57+1919191263572*q^55+
2338669455104*q^63+2137519759606*q^59+2861482968907*q^77+2640144915280*q^70+
2387459684759*q^64+4074506*q^492+21127900*q^464+464191*q^520+2675391690302*q^71
+2477644081922*q^66+2291900213740*q^62+6580837*q^481+3003144222482*q^84+732352*
q^524+1002250*q^508+2869628*q^494+1514155*q^511+2712099996498*q^72+
2933070539584*q^80+2519004725900*q^67+2806144587107*q^75+2561981584298*q^68+
2240425704106*q^61+2777396738113*q^74+2600292858592*q^69+2986973491517*q^83+
2835999302326*q^76+2971476111260*q^82+3059025893001*q^90+3048824788064*q^98+
3065098850290*q^92+3015311270871*q^85+2910060136392*q^79+2887984486838*q^78+
3037166334772*q^87+2744124236653*q^73+3061846324553*q^91+3028136664279*q^86+
2951857591946*q^81+3052664328780*q^89+3046754762505*q^88+3054117934695*q^97+
3059765446722*q^96+2985827801275*q^104+2842201925567*q^112+9919031*q^478+
185482854566*q^241+2970666001497*q^105+3040582843290*q^99+3065242285525*q^94+
2647539675146*q^120+393750*q^521+3062337139457*q^95+3021825461214*q^101+
3064947342438*q^93+3011475622712*q^102+2883572881330*q^110+2673721610610*q^119+
38556646*q^452+36915889*q^453+19976105*q^465+16570808*q^467+40497696*q^451+
2819809881533*q^113+2882630200*q^357+1817957511*q^368+3004666438*q^356+
3136478719*q^355+1898120545*q^367+4904701062*q^344+1748591354*q^369+
3032555318050*q^100+2921517725845*q^108+2955645977128*q^106+2938442123434*q^107
+2773724035690*q^115+2750072165447*q^116+2592953735203*q^122+2797595047932*q^
114+2564658421213*q^123+2328344420554*q^131+2048095914717*q^140+2724953419593*q
^117+2998539938350*q^103+2902437119222*q^109+2536560111822*q^124+2266836095616*
q^133+2699989062757*q^118+2507571021056*q^125+2862865228591*q^111+2449056881711
*q^127+12038457177*q^321+2620160504019*q^121+2478757051883*q^126+2389065311966*
q^129+2297842299779*q^132+2110885605441*q^138+2359003933026*q^130+2079390719521
*q^139+1829808274881*q^147+1559484436593*q^156+45050208*q^447+1799092579952*q^
148+2016752069181*q^141+11495252*q^476+2204729491649*q^135+928991538*q^384+
1426205369*q^374+570312828*q^395+226386163*q^415+1308760899066*q^165+1860*q^609
+22013420*q^463+75078011*q^438+137998429*q^425+80490267*q^436+42610697*q^449+
41327175*q^450+122*q^624+4673859*q^491+10727466*q^477+6284526*q^487+26*q^626+
1208786*q^507+2039368*q^504+2365519283*q^362+2601088*q^495+1380*q^585+
2075440880*q^365+1882*q^597+124*q^610+7891399837*q^332+1133727428*q^379+
362482292*q^405+2235977680942*q^134+1007070873*q^382+2419451493208*q^128+
1230596263200*q^168+1768510180520*q^149+1501898562753*q^158+1417399452762*q^161
+1985506294740*q^142+1707825416024*q^151+1922990605133*q^144+2142083867887*q^
137+1677713395377*q^152+1954141367101*q^143+645859488*q^392+2173566979678*q^136
+1860701144652*q^146+1891721449022*q^145+1588663239441*q^155+1738153284472*q^
150+846486395*q^386+1335397720695*q^164+1647788375940*q^153+1389697121476*q^162
+1618102967251*q^154+1362425960977*q^163+1130744281976*q^172+713940820267*q^192
+1106729582275*q^173+905176233750*q^182+730257511*q^389+122328*q^554+274814*q^
541+598998*q^528+25140*q^569+93466*q^555+203919*q^542+421428*q^530+1637982*q^
513+817331*q^526+348192*q^540+1445305858996*q^160+1256431017768*q^167+
1059644829157*q^175+1282384271305*q^166+1530571896207*q^157+864307972427*q^184+
1082968745133*q^174+70073148*q^440+1013808350876*q^177+1473495584908*q^159+
1155220841400*q^171+407009718*q^402+147534*q^535+12087035*q^471+884656802788*q^
183+1036502081596*q^176+1179962592128*q^170+947563009054*q^180+926233285359*q^
181+749398281955*q^190+449934298098*q^210+731556546280*q^191+584494932377*q^200
+966612187*q^383+1615024746*q^371+12983220730*q^319+8870135085*q^329+
18165240501*q^310+9208919905*q^328+5775126694*q^340+22589253786*q^304+
24309125305*q^302+14506974242*q^316+21784423912*q^305+13984963918*q^317+
33535148135*q^293+12072970*q^472+145067258078*q^249+197012481979*q^239+
140596897707*q^250+84188266634*q^266+60338427506*q^276+81480858911*q^267+
58352638920*q^277+39989488005*q^288+26149251133*q^300+72699536*q^439+
1205174960688*q^169+24542636*q^458+13133388*q^469+5671797*q^483+314130295*q^408
+569790076182*q^201+15052457148*q^315+23127201*q^461+328*q^598+696717707903*q^
193+391637403*q^403+117926557*q^429+218014725*q^416+2271828432*q^363+5326975633
*q^342+824656668831*q^186+122919*q^544+58426*q^556+270*q^599+342105261664*q^220
+208515033*q^417+1184835244*q^378+669047254*q^391+377001092*q^404+34046688*q^
454+66244321*q^441+154320925549*q^247+109144556899*q^258+198834128*q^418+
23441561783*q^303+34755123342*q^292+4702324922*q^345+11807494*q^475+6034*q^583+
170650*q^553+16859190981*q^312+10714552241*q^324+16231546437*q^313+4770*q^591+
4280*q^576+518467362*q^397+8209156101*q^331+1491034613*q^373+62136307*q^442+
1294644*q^510+7083*q^560+3571421141*q^352+346575610*q^406+15628172496*q^314+
2828986*q^497+646639263285*q^196+844376647906*q^185+767778905736*q^189+
991336591451*q^178+969309613234*q^179+786326786446*q^188+630667682834*q^197+
805392257165*q^187+663081360976*q^195+487311294690*q^207+614913082468*q^198+
500293023723*q^206+272471812132*q^228+371877377225*q^217+599608828406*q^199+
462145471624*q^209+2769419285*q^358+679650446227*q^194+414999114128*q^213+
555286906604*q^202+541180929406*q^203+43499*q^568+379046*q^538+438086462814*q^
211+527252737743*q^204+314444689801*q^223+426365525682*q^212+513673777258*q^205
+392943653448*q^215+305578930995*q^224+403795574838*q^214+323417788586*q^222+
228645044506*q^234+297011693661*q^225+235522409442*q^233+120090264158*q^255+
169226945464*q^244+298003028*q^409+132062840802*q^252+191149090951*q^240+1643*q
^574+351852626418*q^219+280443099651*q^227+215435891049*q^236+288588108345*q^
226+474524064034*q^208+382218626257*q^216+159117997338*q^246+221981221835*q^235
+141476*q^534+43520*q^548+281560221*q^410+10321*q^561+361679471527*q^218+
202968628695*q^238+q^680+47545628099*q^283+136304013384*q^251+102384563084*q^
260+71425028585*q^271+95961422507*q^262+69055652119*q^272+249790434374*q^231+
332701755702*q^221+885626499*q^385+558404*q^523+257128568740*q^230+209160531314
*q^237+174528031560*q^243+242544694952*q^232+179897589332*q^242+123949132739*q^
254+164122712729*q^245+127966976183*q^253+62418210359*q^275+89883383577*q^264+
133544358*q^426+2463502652*q^361+112382708*q^430+1040*q^575+2662686809*q^359+
1553176730*q^372+7279120666*q^334+6997434650*q^335+9920827093*q^326+6473238520*
q^337+4338928665*q^347+10308681943*q^325+7580607265*q^333+9558862170*q^327+
11143972789*q^323+6722836756*q^336+220*q^600+28076288457*q^298+27098697963*q^
299+18844488397*q^309+37290587105*q^290+11583270694*q^322+6098437*q^485+
25224574347*q^301+3354*q^584+126*q^612+41392373182*q^287+19537052497*q^308+
12507217638*q^320+56409964441*q^278+17503437945*q^311+50951321844*q^281+
38629227336*q^289+174529*q^551+264735956471*q^229+3652*q^573+2172695072*q^364+
28660*q^580+12540*q^592+4517209695*q^346+5998448125*q^339+4174832246*q^348+
2563072548*q^360+4017048721*q^349+15256*q^577+61360*q^564+29212*q^578+70532*q^
566+73520*q^549+13836*q^562+42841302320*q^286+1088005613*q^380+619656247*q^393+
1047628673*q^381+1678491278*q^370+87001024046*q^265+331722715*q^407+595725858*q
^394+314248*q^537+45910893279*q^284+32357171981*q^294+31229733316*q^295+
49219827772*q^282+30133851145*q^296+21006266041*q^306+20262118085*q^307+
13474660145*q^318+8531518510*q^330+30*q^651+244491597*q^413+425261242*q^401+
254597693*q^412+92892416739*q^263+64543820429*q^274+44356023746*q^285+16*q^665+
1716*q^621+338*q^623+364*q^636+105*q^650+364*q^635+29098380181*q^297+1485012*q^
514+3280502*q^499+3070543*q^501+6151578*q^488+43*q^637+477994*q^529+386052*q^
539+1331674*q^515+158528275*q^422+66776365845*q^273+116322371241*q^256+1124117*
q^509+150101871*q^423+493141877*q^398+467774780*q^399+82739029*q^435+801986*q^
525+30945905*q^455+5762367*q^489+2767708*q^502+234152851*q^414+26285957*q^457+
50156996*q^445+28063328*q^456+57402520*q^443+98725037*q^432+177829184*q^420+
53227694*q^444+87599653*q^434+104858771*q^431+2846*q^596+14696*q^570+13742*q^
582+10462*q^594+32580*q^579+11550*q^593+15370*q^581+4114*q^595+2424*q^608+57546
*q^567+166108*q^552+36476*q^563+806*q^622+4818*q^607+166160*q^533+5550605438*q^
341+1364757975*q^375+6228366817*q^338+3866577513*q^350+188507171*q^419+76573*q^
545+22130*q^559+45012*q^547+3425456*q^493+14805562*q^468+18605918*q^466+8764515
*q^479+7916528*q^480+129477347*q^427+7230*q^572+23200991*q^460+264254*q^531+
767253870*q^388+1119511*q^516+2531760*q^503+900810*q^517+722376*q^527+444670*q^
522+231266*q^536+43750731*q^448+76926576*q^437+2036*q^586+140*q^601+417*q^587+
11056*q^571+159984*q^543+545359354*q^396+47905*q^557+168034205*q^421+742362*q^
518+5217753*q^490+48542*q^546+1300059241*q^376+220674*q^532+47099810*q^446+
92646687*q^433+23975742*q^459+28*q^638+290*q^588+444997676*q^400+12135452*q^473
+12208089*q^474+2489476*q^496+24*q^615+144249162*q^424+267935418*q^411+
124290168*q^428+5895139*q^484+567328*q^519+1793030*q^505+6389631*q^486+81310*q^
565+12384645*q^470+3248955*q^500+27788*q^558+245642760*q+118723*q^550+
78846423174*q^268+54546254728*q^279+112694180236*q^257+36014112835*q^291+
52721648812*q^280+105730980512*q^259+73808546288*q^270+99146029879*q^261+
76310359427*q^269+3716167311*q^351+698521036*q^390+1240265516*q^377+805434058*q
^387+408*q^611+22647667*q^462+715*q^620+814*q^605+3960*q^606+642*q^590+3100316*
q^498+5958753*q^482+1676252*q^512, 2793121080*q^2+5447702664*q^3+44378608890*q^
7+17833668406*q^5+128679760637*q^10+30100185693*q^6+66613246311*q^8+
224465761502*q^12+550841394662*q^16+92364799262*q^9+284726867670*q^13+
10958971820*q^4+2217021465032*q^25+3856754090426*q^30+1289676645654*q^21+
798241064635*q^18+377922799178*q^353+248837805693*q^366+2507428395790*q^26+
169419345444*q^11+1111601299759*q^20+662639323280*q^17+1497565173200*q^22+
362124980215*q^14+941417224954*q^19+446350062000*q^15+1713222969466*q^23+
6022310193102*q^35+3138464354090*q^28+366130594342*q^354+516888794284*q^343+
5554520770443*q^34+8726894679560*q^40+3478583547846*q^29+1961426272993*q^24+
6531460473831*q^36+4239627634748*q^31+2804724902876*q^27+5088018305800*q^33+
4662113884840*q^32+7589981591191*q^38+11213048678797*q^44+15381140393523*q^50+
8137872814194*q^39+11862072914668*q^45+9310864890540*q^41+19899182444429*q^56+
1313688002*q^506+10554211410328*q^43+7039806857628*q^37+6970323263126*q^248+
13942872493189*q^48+12550932409827*q^46+16101553659266*q^51+13227080009002*q^47
+26848253594548*q^65+21446366269069*q^58+16858929326907*q^52+9936096797949*q^42
+23000254407065*q^60+17595419623774*q^53+14642728327576*q^49+18367761639264*q^
54+20656165819386*q^57+19116398952510*q^55+25311363957130*q^63+22207976880386*q
^59+35430550366034*q^77+30606276612777*q^70+26097450824836*q^64+2360460179*q^
492+7320484839*q^464+714278218*q^520+31314707025172*q^71+27625909650524*q^66+
24553172765724*q^62+3706859650*q^481+39618281734843*q^84+573427885*q^524+
1196800530*q^508+2173922502*q^494+1029269934*q^511+32045411465393*q^72+
37326920287604*q^80+28366203897828*q^67+34107203086262*q^75+29131182225196*q^68
+23761445353318*q^61+33442493305033*q^74+29857071524782*q^69+39054345564126*q^
83+34791337704686*q^76+38505033924175*q^82+42540709697197*q^90+45398105362395*q
^98+467*q^742+17*q^800+1001*q^752+1287*q^736+455*q^768+120*q^784+43368806148001
*q^92+40134020672546*q^85+36698979864556*q^79+36087954324660*q^78+
41144309899192*q^87+32733667495294*q^73+42949223267498*q^91+40663314270269*q^86
+37908273229586*q^81+42083592690688*q^89+41638169778426*q^88+45093043439416*q^
97+44797994040020*q^96+46740005276894*q^104+47493500178186*q^112+4176520875*q^
478+8192190984838*q^241+46884456431188*q^105+45655433280430*q^99+44121133575921
*q^94+47160967053726*q^120+678181692*q^521+44454652088420*q^95+46140039015988*q
^101+43739736347816*q^93+46368023806673*q^102+47411820028731*q^110+
47245863717646*q^119+11705050341*q^452+11251429348*q^453+7034876318*q^465+
6501062638*q^467+12158949152*q^451+47496418621566*q^113+332620530940*q^357+
233098259422*q^368+343445896439*q^356+354546170474*q^355+240792078776*q^367+
501101544728*q^344+225595412746*q^369+45921161591860*q^100+47260147401440*q^108
+47036637087343*q^106+47144172813010*q^107+47476854863502*q^115+47454347292904*
q^116+46924560269363*q^122+47506847229320*q^114+46774570734284*q^123+
45198624491532*q^131+42613829710837*q^140+47392546921132*q^117+46549873874214*q
^103+47332107533848*q^109+46632096447868*q^124+44689432499342*q^133+
47338226209688*q^118+46455647523040*q^125+47449104158936*q^111+46085386902656*q
^127+1004288085258*q^321+47038851311426*q^121+46287238845207*q^126+
45665002460114*q^129+44958752283744*q^132+43252989789710*q^138+45446936155192*q
^130+42929071219414*q^139+40146543643640*q^147+36621715309341*q^156+14156791594
*q^447+39778597892525*q^148+42274827045044*q^141+4524721342*q^476+
44139929977224*q^135+137003881750*q^384+191437941084*q^374+94058984468*q^395+
46466886872*q^415+32866092707618*q^165+11434196*q^609+7609927830*q^463+
19950025774*q^438+32297061798*q^425+21484809475*q^436+13122279980*q^449+
12644939847*q^450+220*q^719+5305507*q^624+2451583108*q^491+4348434504*q^477+
2870138704*q^487+4037074*q^626+1255133748*q^507+1425594801*q^504+283480623275*q
^362+2076954410*q^495+34764478*q^585+257075452770*q^365+20619134*q^597+10903949
*q^610+723730993339*q^332+161936106248*q^379+66339551666*q^405+44428677081332*q
^134+146563039929*q^382+45891315836546*q^128+31605450634444*q^168+
39391384346480*q^149+35800553630165*q^158+34547668752260*q^161+41944751320798*q
^142+38617610417460*q^151+41247244433212*q^144+43551614823910*q^137+
38230900810683*q^152+41591352923888*q^143+104282283806*q^392+43859063772337*q^
136+40523790521984*q^146+40880934525386*q^145+37022081802236*q^155+
39013895967787*q^150+127991892817*q^386+33292929186862*q^164+37826954854572*q^
153+34134008056865*q^162+37432696251777*q^154+33708279001066*q^163+
29919238659414*q^172+21901323859762*q^192+29495130464594*q^173+25792131288661*q
^182+115472893614*q^389+151780541*q^554+276590846*q^541+497500066*q^528+
79534702*q^569+150079346*q^555+271046368*q^542+466575142*q^530+944407222*q^513+
528200447*q^526+284633637*q^540+34970972002595*q^160+32022604537444*q^167+
28660198463418*q^175+32449586232367*q^166+36206025757074*q^157+24991989430538*q
^184+29081568268115*q^174+18506880899*q^440+27830676870632*q^177+35380839193242
*q^159+18268*q^698+30335039689540*q^171+73674677863*q^402+352534656*q^535+
5540645616*q^471+25387154031358*q^183+28249040952461*q^176+30761147277660*q^170
+26603102311615*q^180+26192558940256*q^181+22655075816918*q^190+15768186450672*
q^210+22273209480062*q^191+19023514973350*q^200+141686417980*q^383+211312959342
*q^371+1064929160202*q^319+792000547790*q^329+1381688419276*q^310+816153902923*
q^328+567216108425*q^340+1637783841052*q^304+1732410520435*q^302+1162230329461*
q^316+1592093543098*q^305+1128840668360*q^317+2221219349556*q^293+5313286636*q^
472+6807946320658*q^249+8571424611636*q^239+6650311011767*q^250+4505009642639*q
^266+3491607672002*q^276+4392733137252*q^267+3401759086436*q^277+2543627865776*
q^288+1831918316186*q^300+42386*q^674+19221198672*q^439+31178334413414*q^169+
9262622702*q^458+6005352198*q^469+3410072326*q^483+59630393936*q^408+
18677897112056*q^201+1333476*q^649+1196221010544*q^315+8230056698*q^461+
18719666*q^598+21526453465828*q^193+71149046670*q^403+27896460756*q^429+
44836764522*q^416+274435366792*q^363+533253245263*q^342+24201835992637*q^186+
250930064*q^544+144571856*q^556+2220*q^727+17462*q^711+1709*q^714+16540790*q^
599+543659*q^646+134*q^741+12913801270848*q^220+43238227586*q^417+167472665249*
q^378+2184*q^740+131*q^756+107861769530*q^391+68719105582*q^404+10827444569*q^
454+585196*q^663+17811707928*q^441+3478*q^726+7134302857266*q^247+5489231739935
*q^258+41709055009*q^418+1684289580502*q^303+2282935823526*q^292+292*q^729+
485654290672*q^345+4707658150*q^475+40872192*q^583+154226208*q^553+
1304660093492*q^312+919152975975*q^324+1267439031040*q^313+20367242*q^591+
44545586*q^576+87712590218*q^397+291408*q^657+745831762546*q^331+197865212782*q
^373+3970*q^713+4388*q^701+136*q^743+366868*q^656+226224*q^669+36940*q^685+
96094*q^671+17144477583*q^442+1080586383*q^510+8845*q^700+56198*q^673+14340*q^
699+63940*q^684+2408*q^715+110094281*q^560+262586*q^679+390198301748*q^352+
64062401098*q^406+1231516566485*q^314+392*q^755+1892764896*q^497+26302*q^686+
257330*q^661+20433976109414*q^196+24592001377076*q^185+23033965319222*q^189+
27422378605750*q^178+27007642348318*q^179+23422355684169*q^188+20072945542312*q
^197+23807181520514*q^187+20792830039566*q^195+16701093671948*q^207+
19721204572464*q^198+17023218186256*q^206+10918169737013*q^228+13725913166868*q
^217+19367812670988*q^199+16073564652538*q^209+9584*q^689+168940*q^659+
322238154901*q^358+21160732639878*q^194+14867859554542*q^213+18341295303179*q^
202+18003641545802*q^203+474*q^716+81227237*q^568+300489821*q^538+
15462730383506*q^211+17674727697844*q^204+12134751941360*q^223+15165298009468*q
^212+17344739949812*q^205+14289031567860*q^215+11884876067730*q^224+
14578354157735*q^214+12391460762318*q^222+9583984436925*q^234+11635892691772*q^
225+9795676823426*q^233+5902240849754*q^255+7649514274188*q^244+152*q^731+
57521093616*q^409+644973*q^664+61966*q^672+8294*q^687+1158*q^703+6342633285536*
q^252+8381128074735*q^240+12285*q^688+52389363*q^574+13179374600932*q^219+
11152453271382*q^227+9168339563134*q^236+11393663846364*q^226+16387521550775*q^
208+14007231061095*q^216+7303344339125*q^246+9373194310078*q^235+57644*q^696+
172168*q^681+1763146*q^640+4624294*q^625+77958*q^683+1050482*q^642+1331828*q^
641+170516*q^670+608424*q^655+31904*q^697+780678*q^647+2118132*q^639+7216*q^712
+222278*q^658+378261860*q^534+191513897*q^548+55507539120*q^410+1086993*q^648+
1595267*q^632+101336498*q^561+13452262727749*q^218+8767483807480*q^238+251535*q
^680+2906441707798*q^283+6494188740436*q^251+5227671429174*q^260+3970083378604*
q^271+4976762728314*q^262+3870483716734*q^272+10232848679480*q^231+
12648994025994*q^221+517952*q^666+125927*q^682+1100912*q^652+398554*q^667+
287767*q^668+720788*q^654+132399707962*q^385+605453522*q^523+10458192965126*q^
230+8965070283928*q^237+7826488915290*q^243+10013774802706*q^232+8008655284145*
q^242+6046621837453*q^254+7473878346204*q^245+6192459737686*q^253+3582682016828
*q^275+4735877747092*q^264+31159080663*q^426+3147746*q^627+791532*q^643+
292706641388*q^361+26878185298*q^430+47684260*q^575+296*q^717+312036456162*q^
359+204542811228*q^372+681074471126*q^334+660576345786*q^335+866156283838*q^326
+621568330424*q^337+456257804102*q^347+892150658194*q^325+702009900886*q^333+
840652575640*q^327+355*q^728+946699039780*q^323+3839136*q^617+640849045565*q^
336+14140531*q^600+294763*q^678+65128*q^691+60696*q^675+101956*q^694+
1936350275725*q^298+1917330*q^633+48066*q^708+15752*q^723+3016*q^739+13669*q^
724+128728*q^693+45540*q^707+38834*q^709+80176*q^695+1883201098998*q^299+
1421484534166*q^309+2410167150286*q^290+975254187817*q^322+20070*q^710+
3126458676*q^485+1781338319316*q^301+38607006*q^584+8696935*q^612+2612405837332
*q^287+1462678051915*q^308+1034397103729*q^320+3314719043530*q^278+
1342526678342*q^311+3064040332968*q^281+2475776419416*q^289+160296698*q^551+
10684847067470*q^229+58795850*q^573+265660397761*q^364+42907656*q^580+21046236*
q^592+470809935285*q^346+584749724648*q^339+442339283291*q^348+302291981491*q^
360+428678782640*q^349+42397616*q^577+83536260*q^564+42110051*q^578+81324641*q^
566+178626784*q^549+93494957*q^562+26*q^746+2683686297944*q^286+156659831057*q^
380+100755434150*q^393+151512968294*q^381+218373727944*q^370+4618644464040*q^
265+61799605518*q^407+97377260229*q^394+313402050*q^537+2830614642630*q^284+
2161627350709*q^294+2102868785748*q^295+2984707172534*q^282+2046137316729*q^296
+1547982773887*q^306+1504602314920*q^307+1096594240024*q^318+768701115791*q^330
+4918*q^725+1327112*q^651+49875867400*q^413+76275935314*q^401+51692438293*q^412
+4854405835440*q^263+3676809555256*q^274+2755962196522*q^285+618658*q^665+
5722402*q^621+5536656*q^623+2940976*q^636+1391057*q^650+2786552*q^635+
1990323620860*q^297+910267293*q^514+1729393332*q^499+1594942900*q^501+
2763540260*q^488+2692572*q^637+482483770*q^529+288935884*q^539+880868044*q^515+
36009616177*q^422+3772110030780*q^273+5762214484334*q^256+1139084580*q^509+
34716861490*q^423+84701225864*q^398+81759729068*q^399+22289444672*q^435+
547956266*q^525+10405644488*q^455+2651492648*q^489+1538950188*q^502+48160453426
*q^414+9627241470*q^457+15278726346*q^445+10012817285*q^456+16493143982*q^443+
24933102798*q^432+38755228868*q^420+15885881105*q^444+23129107329*q^434+
25885043866*q^431+21960955*q^596+4218833*q^616+75761597*q^570+43088741*q^582+
22185895*q^594+41672160*q^579+21598840*q^593+43058350*q^581+22516340*q^595+
11336915*q^608+82180540*q^567+156145322*q^552+88434588*q^563+5797925*q^622+
11188686*q^607+399965852*q^533+549933516660*q^341+185134195224*q^375+
602966191317*q^338+415522117283*q^350+40196188632*q^419+235465174*q^545+
120660338*q^559+205846344*q^547+2263862254*q^493+6246703679*q^468+6760428761*q^
466+4016860112*q^479+3859344431*q^480+30044069442*q^427+65500665*q^572+
8560392817*q^460+445118212*q^531+119503946572*q^388+849377035*q^516+1481046988*
q^503+820407860*q^517+511712692*q^527+640259224*q^522+332804623*q^536+
13637308270*q^448+20698930884*q^437+31493884*q^586+12395458*q^601+27273612*q^
587+71000534*q^571+261073728*q^543+90845446452*q^396+139000376*q^557+
37350239572*q^421+784974807*q^518+2554400286*q^490+220998578*q^546+179065919887
*q^376+424056641*q^532+14711344083*q^446+24008119966*q^433+8900230618*q^459+
2410781*q^638+24059447*q^588+32*q^785+78984612829*q^400+5104764520*q^473+46*q^
770+4897001845*q^474+22599*q^690+18700*q^722+27380*q^706+6240*q^738+938*q^754+
1990737510*q^496+5140866*q^615+33496643921*q^424+53543231806*q^411+28952258676*
q^428+3268095307*q^484+912768*q^653+752091950*q^519+1369474426*q^505+2994726762
*q^486+81920962*q^565+2460*q^704+1088*q^720+5924*q^705+30*q^771+5769740947*q^
470+1659439214*q^500+28*q^758+154979*q^660+491132*q^645+130141429*q^558+264*q^
730+2656152*q^628+3760755*q^618+6233214*q^614+10208149*q^602+7522158*q^613+
628584*q^644+1376364*q^631+2076562*q^629+9219484*q^603+1668547*q^630+1620*q^702
+104535*q^692+224092*q^677+431318*q^662+7920*q^721+24*q^735+2483458*q^634+
9041597*q^604+4514408*q^619+129692*q^676+420*q^769+2184*q^753+5720*q^737+
21105884*q^589+477638700+q^816+927983760*q+167977161*q^550+4284050299993*q^268+
3228981659848*q^279+5623612361896*q^257+2345541837032*q^291+3145967109000*q^280
+5356395607618*q^259+4072733549209*q^270+5100242499576*q^261+4176713882354*q^
269+402632010932*q^351+111621297950*q^390+173152111724*q^377+123648798968*q^387
+10021348*q^611+7918634261*q^462+5181441*q^620+9722620*q^605+10543751*q^606+
20654605*q^590+1809850531*q^498+3558667776*q^482+980393439*q^512, 10830450780*q
^2+21830542860*q^3+201071580333*q^7+76170163860*q^5+629806082633*q^10+
132099138291*q^6+309610759498*q^8+1152068550759*q^12+3077040776432*q^16+
441481440394*q^9+1496113597418*q^13+45197027220*q^4+14484490609205*q^25+
27096891205241*q^30+7898881386137*q^21+4632518025368*q^18+27512037082256*q^353+
19838347715863*q^366+16624862705042*q^26+850832648835*q^11+6687162302590*q^20+
3777170917641*q^17+9320914634829*q^22+1942156798859*q^14+5568276511091*q^19+
2446259350372*q^15+10845643927166*q^23+45241557562121*q^35+21433459607116*q^28+
26836577012060*q^354+35135139121318*q^343+41179220999339*q^34+69692433628713*q^
40+24108849533821*q^29+12609460904586*q^24+49675457792688*q^36+30212743106164*q
^31+18884738995663*q^27+37244569548917*q^33+33663600320442*q^32+59174027716094*
q^38+93780365544133*q^44+137308781553084*q^50+64235850928316*q^39+
100349186193007*q^45+75258247361008*q^41+188848244825575*q^56+326051333772*q^
506+87299765385073*q^43+54231580076598*q^37+255571203191543*q^248+
121851648646110*q^48+107330742730710*q^46+145280467081173*q^51+114382576282273*
q^47+277657781280582*q^65+207562354839905*q^58+153662794160886*q^52+
81229839723240*q^42+226938464976310*q^60+162060113168031*q^53+129372686204327*q
^49+170862052228069*q^54+198012301859608*q^57+179657596654821*q^55+
256961800618552*q^63+217064336989299*q^59+407277175529396*q^77+331070638190877*
q^70+267370798116809*q^64+515284931128*q^492+1248675248441*q^464+204241013087*q
^520+341793254669161*q^71+288276708710008*q^66+246896718538411*q^62+
733183730531*q^481+482617233370254*q^84+178105334181*q^524+305365801482*q^508+
483121862812*q^494+276204687787*q^511+352793284281898*q^72+439963497887339*q^80
+298751778683678*q^67+385435770029325*q^75+309538094637455*q^68+236735447725670
*q^61+374627322092001*q^74+320157346076637*q^69+471942090440080*q^83+
396484476767828*q^76+461431928004652*q^82+543797132274929*q^90+617559961140014*
q^98+14003501*q^742+294450*q^800+11511564*q^752+30702703*q^736+3885876*q^768+
1107677*q^784+563186415802968*q^92+492961017429544*q^85+429026532273416*q^79+
418291088022614*q^78+513593582998995*q^87+363580563326478*q^73+553445031509858*
q^91+503450301488868*q^86+450607030258304*q^81+533775285967077*q^89+
523863942004990*q^88+608813326277541*q^97+600116805156347*q^96+665291766891098*
q^104+717041852901212*q^112+806355190995*q^478+287457078284954*q^241+
672425102536080*q^105+4910534*q^777+625895245765328*q^99+581975507504416*q^94+
754101983608720*q^120+197479658498*q^521+591014852757004*q^95+642210956726647*q
^101+572543105708837*q^93+650181711974556*q^102+705448809740871*q^110+
750201855945706*q^119+1801162421176*q^452+1747467719073*q^453+1210612320962*q^
465+1137706117355*q^467+1856306346771*q^451+722395022575542*q^113+
24902970591269*q^357+18848109480148*q^368+25531965812484*q^356+26177826432084*q
^355+19337951532790*q^367+34293089000857*q^344+18371458620149*q^369+
634261672122418*q^100+692947076911211*q^108+679554959711823*q^106+
686256413224939*q^107+732600935414482*q^115+737446084153962*q^116+
761016804985662*q^122+727709281232647*q^114+764041001709615*q^123+
780611140710931*q^131+782544503428986*q^140+741871972239983*q^117+
657732063337658*q^103+699209178230065*q^109+766995718786371*q^124+
782510087291091*q^133+746244366824834*q^118+769556833353556*q^125+
711262283850071*q^111+774152723139454*q^127+58881824362861*q^321+
757590585873910*q^121+772049770599137*q^126+777832703976046*q^129+
781741373865830*q^132+783581903860270*q^138+779406753547875*q^130+
783101337192279*q^139+772848764533975*q^147+748257797765906*q^156+1379830*q^795
+558490*q^810+235938*q^825+2092473506655*q^447+770803139721062*q^148+144*q^889+
2586*q^874+22012*q^857+781671191538520*q^141+859042462047*q^476+783547287901477
*q^135+12417102570937*q^384+16146436821473*q^374+9242115010470*q^395+
5310408601838*q^415+712341314817050*q^165+2098*q^860+8021253889*q^609+
1287827881237*q^463+2734508906642*q^438+3992461100317*q^425+2899611354498*q^436
+1971087155074*q^449+1912878976030*q^450+78010807*q^719+4425931360*q^624+361760
*q^824+532215106468*q^491+832335266278*q^477+605690353546*q^487+4005944136*q^
626+315543446827*q^507+348146538144*q^504+21962998957111*q^362+467826815644*q^
495+2272677*q^792+40166*q^842+1865580*q^782+20072617100*q^585+934496*q^808+
3344514*q^780+410816*q^811+167324*q^826+1045894*q^796+764422*q^809+
20352324632088*q^365+12748166921*q^597+2077374*q^793+2547528*q^781+836850*q^797
+7240952*q^765+4920316*q^776+3839914*q^779+7725032031*q^610+2342025*q^791+
45657197892625*q^332+14167408125802*q^379+7024867887245*q^405+783203552005071*q
^134+13091891199472*q^382+776182845876734*q^128+698400691487506*q^168+
768488598181052*q^149+741156527730938*q^158+20827914*q^747+10083453*q^762+
729498038321948*q^161+780724429782702*q^142+763469645342632*q^151+
778141766892689*q^144+783735804361707*q^137+760764610453702*q^152+
779469970841243*q^143+10022078737444*q^392+783811040734273*q^136+
774823737386913*q^146+776519699657463*q^145+751559611423527*q^155+
766108625372539*q^150+11773099549999*q^386+716827580246349*q^164+
757816683401685*q^153+725413267018863*q^162+754805037227612*q^154+
721141807977188*q^163+678479663270912*q^172+564423620024275*q^192+
673270402343733*q^173+623690070533443*q^182+10864277977233*q^389+62290311786*q^
554+98751709378*q^541+155084329961*q^528+36312179527*q^569+60175558809*q^555+
95461512377*q^542+144963084429*q^530+258091333790*q^513+166081284652*q^526+
102213644729*q^540+2534*q^888+140*q^905+733533016251285*q^160+703127056664989*q
^167+662684420888969*q^175+707814227103942*q^166+744734047038588*q^157+
612097051418650*q^184+668036313368691*q^174+2578244598560*q^440+102962*q^827+
923666*q^788+1055920*q^807+221784*q^813+8504*q^858+382*q^875+74394*q^841+
651827816000013*q^177+737371353280502*q^159+151481630*q^698+683560562435028*q^
171+7629909892164*q^402+122167170502*q^535+1004570487353*q^471+617896549726457*
q^183+657310383325655*q^176+688611953588779*q^170+635111033967470*q^180+
629406415217625*q^181+576489386759845*q^190+455318681974563*q^210+
570452591642130*q^191+515744120673036*q^200+12750947436869*q^383+17450702315570
*q^371+61616632465665*q^319+48976492616357*q^329+75331170039402*q^310+
50125834355934*q^328+37765276590880*q^340+85866873412607*q^304+89648624370099*q
^302+65922035219787*q^316+84030612579151*q^305+64460315722391*q^317+
108450792584638*q^293+973760657453*q^472+251223925108720*q^249+297017425822894*
q^239+246920895104759*q^250+185066006086981*q^266+152849874889691*q^276+
181630284164941*q^267+149891587167649*q^277+120240176247699*q^288+
93570596345065*q^300+539323548*q^674+2655459734960*q^439+693524451586464*q^169+
1500438899461*q^458+1069074621443*q^469+688215862759*q^483+6462838581410*q^408+
509645139729821*q^201+1601403810*q^649+67416826284437*q^315+1369186910866*q^461
+12245404440*q^598+558357402816997*q^193+7423234479883*q^403+3558091056108*q^
429+5162635182037*q^416+21414873400080*q^363+35992560397908*q^342+
600351365313895*q^186+89177575509*q^544+58185373821*q^556+32960285*q^727+
79630304*q^711+4222*q^873+72268451*q^714+11723887125*q^599+1764898538*q^646+
14077744*q^741+397096833401641*q^220+5018923398019*q^417+14543798273842*q^378+
15505247*q^740+5438337*q^756+10295840061978*q^391+7221265828234*q^404+
1695173401637*q^454+9581*q^833+894097170*q^663+2503101295894*q^441+34326801*q^
726+259977983569824*q^247+214368200994840*q^258+4878354478658*q^418+
87743136040854*q^303+110726579283714*q^292+35070062*q^729+32*q^921+
33472049334871*q^345+886610145227*q^475+21672397154*q^583+64468266975*q^553+
72072911847451*q^312+54974414621908*q^324+70492292419841*q^313+15771771014*q^
591+27826185520*q^576+8752169839458*q^397+1046995268*q^657+46742709215248*q^331
+16571795952014*q^373+70616661*q^713+150251365*q^701+15358349*q^743+1091183411*
q^656+611150858*q^669+291517537*q^685+558374235*q^671+2429745894811*q^442+
285721902291*q^510+146739709*q^700+546538690*q^673+q^969+145917378*q^699+
299138380*q^684+73999430*q^715+50420204690*q^560+438297709*q^679+28200255906719
*q^352+6832820007550*q^406+68937319882603*q^314+6196683*q^755+438425344789*q^
497+288085720*q^686+958169952*q^661+540131319972391*q^196+606226085282889*q^185
+582481446030259*q^189+646326383909199*q^178+640726038421821*q^179+
588473868357107*q^188+534028351524774*q^197+594413701022286*q^187+
546209858998753*q^195+473288308295151*q^207+527939734011172*q^198+
479320924455559*q^206+353033486076039*q^228+414242898563431*q^217+
521833595611720*q^199+461285548310082*q^209+290286147*q^689+1001548680*q^659+
24286820238232*q^358+552297989457755*q^194+437548984254656*q^213+
503565158669807*q^202+497481509132715*q^203+78340067*q^716+37588941292*q^568+
109675215944*q^538+449368257984442*q^211+491420527708726*q^204+380278357957224*
q^223+443448320106468*q^212+485358912899992*q^205+425837998678402*q^215+
374747823220007*q^224+431681075811275*q^214+385845699894552*q^222+
321778299471515*q^234+369258279356043*q^225+326873359931350*q^233+
226196438617374*q^255+273489357862150*q^244+40346980*q^731+393116*q^823+140044*
q^839+40360*q^835+41990*q^818+6284786946343*q^409+854036634*q^664+550797122*q^
672+291566429*q^687+154360028*q^703+5746*q^872+46055*q^852+1080*q^903+49*q^920+
7917*q^886+238476357805334*q^252+292209514466187*q^240+25558*q^856+17497*q^871+
68676*q^854+194826*q^838+396516*q^821+291165317*q^688+170362*q^837+3696*q^887+
68640*q^853+30132035734*q^574+402776982978220*q^219+358399773607981*q^227+
311728873089946*q^236+363807741238611*q^226+467282043351897*q^208+
420026931741485*q^216+264429070534565*q^246+316732586262111*q^235+26884*q^869+
110332*q^840+50924*q^855+20956*q^870+176485959*q^696+375453131*q^681+2233914901
*q^640+4225046753*q^625+471120*q^822+318030080*q^683+2003958490*q^642+
2109206129*q^641+578438765*q^670+1144505692*q^655+161496448*q^697+1712031650*q^
647+2366196923*q^639+74125598*q^712+1023510500*q^658+126493956311*q^534+
77413330962*q^548+6110816308721*q^410+1665340097*q^648+3126321990*q^632+
48541017844*q^561+408493742237476*q^218+301871375447710*q^238+404497234*q^680+
133065823459343*q^283+242676127839034*q^251+206739515284312*q^260+
168363197005807*q^271+199315535835967*q^262+165163294123882*q^272+
337201032364179*q^231+391452475539668*q^221+757286197*q^666+342410672*q^682+
1390448097*q^652+705068265*q^667+652871003*q^668+1221783499*q^654+
12091835722253*q^385+184422655954*q^523+342432130367380*q^230+306778639062362*q
^237+278097448750314*q^243+332013153787539*q^232+282749341692199*q^242+
230236066469629*q^254+268937084506915*q^245+234334297027940*q^253+
155861559323465*q^275+192091831642826*q^264+3879405089014*q^426+3805069417*q^
627+1926084143*q^643+22525268611491*q^361+3456075912773*q^430+28959164794*q^575
+41711838*q^733+18732637*q^749+81041021*q^717+23686579931208*q^359+
17005681332041*q^372+43555991047925*q^334+42539340870208*q^335+52499673599641*q
^326+40568598664588*q^337+31881195595430*q^347+53726226918825*q^325+
44597342973930*q^333+51302126005900*q^327+33255770*q^728+56252226501749*q^323+
5687419919*q^617+41541605307437*q^336+11237709000*q^600+466165728*q^678+
268798815*q^691+531838618*q^675+214147901*q^694+97635199568915*q^298+3029974788
*q^633+113087491*q^708+51845860*q^723+19354422*q^739+44292763*q^724+234031021*q
^693+124054800*q^707+99427491*q^709+194694726*q^695+95587614310588*q^299+
77009204826395*q^309+115401927581028*q^290+57552169329678*q^322+89005801*q^710+
645730747586*q^485+91594917533545*q^301+20860657724*q^584+7067662075*q^612+
122723574744148*q^287+78713414686859*q^308+60233936073396*q^320+146971273105507
*q^278+73688818861965*q^311+138495993478469*q^281+117803695251927*q^289+
69262217978*q^551+347711821481333*q^229+31354446325*q^573+20876831698715*q^364+
24034625110*q^580+15213304448*q^592+32666717377663*q^346+38680956240149*q^339+
31111217090008*q^348+23098374533846*q^360+30360482682206*q^349+26793170447*q^
577+43310107469*q^564+25790954343*q^578+40268468135*q^566+74589208661*q^549+
46733745340*q^562+20271858*q^746+125242647541842*q^286+13799440995112*q^380+
9755950324636*q^393+13441758418397*q^381+17904877883798*q^370+188557996757098*q
^265+6645682709445*q^407+9495537368609*q^394+113718121275*q^537+130412599842278
*q^284+106208725261636*q^294+104011234580374*q^295+135755491904755*q^282+
101846275814983*q^296+82223297846794*q^306+80454791926199*q^307+63022638521686*
q^318+47846536581300*q^330+38412581*q^725+1467351665*q^651+5617324396896*q^413+
7842672400655*q^401+5777208111989*q^412+195682024892582*q^263+158912967096017*q
^274+127809627303131*q^285+19273474*q^745+8184758*q^759+807502079*q^665+
4973902560*q^621+4631982987*q^623+2738784935*q^636+1543015448*q^650+2845335155*
q^635+99725183273385*q^297+3693506*q^774+249541290692*q^514+410582749406*q^499+
384326077712*q^501+586457206442*q^488+2629492157*q^637+149952378530*q^529+
105870670590*q^539+241277061158*q^515+4351261096112*q^422+1992470*q^790+
162018298495508*q^273+222200600881336*q^256+4561040*q^775+295406140949*q^509+
20351207*q^748+4228278716444*q^423+2698214*q^773+10193223*q^761+8515439569578*q
^398+8285414564210*q^399+2985850334325*q^435+997338*q^806+2077093*q^772+1525668
*q^789+171975223382*q^525+1644327524832*q^455+567846518856*q^489+371884724822*q
^502+5461610551407*q^414+1546981268469*q^457+2221526216569*q^445+1594876286761*
q^456+2358446862893*q^443+3260071287153*q^432+4607902715437*q^420+2288926154429
*q^444+3074566705580*q^434+3356952630344*q^431+80998854*q^718+13260996768*q^596
+5913630386*q^616+35061528434*q^570+22449620063*q^582+14223897416*q^594+
24897549078*q^579+14695969946*q^593+23238063790*q^581+13732794040*q^595+
8321819675*q^608+38896860135*q^567+66813004948*q^552+44962101902*q^563+
4805616532*q^622+8592964633*q^607+130988893946*q^533+36871023998432*q^341+
15731906212428*q^375+39613215381589*q^338+29623905776782*q^350+4741513045102*q^
419+86143955090*q^545+52311691527*q^559+80250347699*q^547+498953840269*q^493+
1102834655577*q^468+1173673944062*q^466+781137807487*q^479+756774085183*q^480+
3769683939921*q^427+32565048631*q^572+1411577631761*q^460+140159004819*q^531+
11159398835810*q^388+233331889718*q^516+359772697015*q^503+225654202798*q^517+
160480381980*q^527+190873182903*q^522+117879929677*q^536+2030883639022*q^448+
2816058250334*q^437+19273196267*q^586+10752079098*q^601+18507632225*q^587+
33813690168*q^571+92248772673*q^543+8993897558528*q^396+56175018441*q^557+
4477992636834*q^421+218307636551*q^518+549719430020*q^490+83187010260*q^546+
15325908601976*q^376+135492253527*q^532+2156003306035*q^446+3166085777725*q^433
+1455329795055*q^459+2501466023*q^638+17756504760*q^588+839460*q^785+
8060806962828*q^400+943856652878*q^473+2362303*q^770+914830040550*q^474+
281677871*q^690+58671370*q^722+136531469*q^706+22218338*q^738+7637272*q^754+
452948849788*q^496+6161470260*q^615+4108569444652*q^424+5941874841795*q^411+
3662433400819*q^428+666643666075*q^484+1301415932*q^653+211151956635*q^519+
336871404506*q^505+625401219084*q^486+41728568724*q^565+34*q^936+152976915*q^
704+72680188*q^720+145046168*q^705+1833358*q^771+314*q^876+1036307731909*q^470+
397262499487*q^500+26*q^882+41290779*q^732+9547916*q^763+4411653*q^778+6830160*
q^758+985149544*q^660+1810488536*q^645+54245011318*q^558+394298*q^799+470963*q^
798+309485*q^812+116488*q^814+629536*q^787+38013353*q^730+3624410047*q^628+
5486119024*q^618+6434620114*q^614+10321239453*q^602+6737315750*q^613+1865679983
*q^644+3234512215*q^631+3477111770*q^629+9900025343*q^603+3336540660*q^630+
154666589*q^702+1464*q^848+9706*q^831+475434*q^804+253411650*q^692+493721059*q^
677+45154*q^829+930537134*q^662+13821592*q^751+66072443*q^721+5470659*q^757+
17178872*q^744+1666606*q^794+38468672*q^734+35143887*q^735+151084*q^802+
2936886212*q^634+16235612*q^750+9534790046*q^604+5305874250*q^619+12870*q^868+
11436*q^851+4642348*q^767+2730*q^902+8008*q^885+514144320*q^676+10114*q^834+491
*q^862+164*q^878+103323*q^819+2920205*q^769+1206*q^850+264*q^865+9436750*q^753+
26724772*q^737+530*q^890+178*q^866+2536*q^849+450*q^904+8904067*q^764+
17042112330*q^589+480*q^919+1466286*q^783+6100878*q^766+30*q^907+1755*q^847+
18458*q^844+2834*q^861+320*q^863+312*q^877+1716*q^867+2002*q^884+136*q^935+18*q
^952+560*q^918+22422*q^843+30932*q^830+253830*q^803+214494*q^801+15745*q^832+
79432*q^815+4908*q^846+146*q^891+4638*q^859+28*q^894+47960*q^817+1767263190+
73026*q^816+3511574910*q+71894228982*q^550+178236360001040*q^268+
144103777622315*q^279+218262582066036*q^257+113047363928543*q^291+
141274313156127*q^280+210531585979205*q^259+171602755383672*q^270+
203005421865171*q^261+174898536786350*q^269+28905476732018*q^351+10575865048470
*q^390+14930677989499*q^377+9540174*q^760+11462968144105*q^387+7397032625*q^611
+619622*q^786+1327964446450*q^462+5133839390*q^620+9185085964*q^605+8889434818*
q^606+16379199152*q^590+424328465423*q^498+710296587170*q^482+267012011949*q^
512+831048*q^805+249516*q^820+116638*q^836+1365*q^901+10504*q^845+84964*q^828,
41965864794*q^2+87145866752*q^3+899293238364*q^7+322377660872*q^5+3030512833653
*q^10+573518305776*q^6+1418664576445*q^8+5799229984135*q^12+16790638293831*q^16
+2076947838796*q^9+7700735802340*q^13+185248724362*q^4+91765946074914*q^25+
183988005147897*q^30+47053095314376*q^21+26215583305710*q^18+1483637086978870*q
^353+1150690594228731*q^366+106822591162682*q^26+4194804120112*q^11+
39163256483018*q^20+21010446726764*q^17+56388622090704*q^22+10194305372022*q^14
+32084472398690*q^19+13106739869838*q^15+66677720390660*q^23+327355015719850*q^
35+141654673728330*q^28+1455436436540745*q^354+1792582074627864*q^343+
294263992450825*q^34+534416135428889*q^40+161578376722416*q^29+78673043607361*q
^24+363692618656028*q^36+207919906335578*q^31+123129280065710*q^27+
262934266365840*q^33+234599945983888*q^32+443536939850316*q^38+751267078100040*
q^44+1169809239001934*q^50+487137381584982*q^39+812565947655316*q^45+
583686058072684*q^41+1704266490745437*q^56+44638346091493*q^506+692028535275496
*q^43+401876307215110*q^37+7791643181532095*q^248+1017524898877707*q^48+
878074252535740*q^46+1250148413987796*q^51+945620630176756*q^47+
2715804515830692*q^65+1908007872765979*q^58+1335040802583916*q^52+
636845234702153*q^42+2124214154387667*q^60+1421820305315486*q^53+
1091432560597544*q^49+1513225222920113*q^54+1803797654983634*q^57+
1606413811563040*q^55+2470188710463954*q^63+2013769265051722*q^59+
4396540142075402*q^77+3377370338125630*q^70+2592491404268830*q^64+
64209766814543*q^492+129643754485532*q^464+30784547287701*q^520+
3515852190922444*q^71+2843672847875197*q^66+2352492647285207*q^62+
84950568207606*q^481+5498640322326623*q^84+27643057531431*q^524+42355793770619*
q^508+60991981818771*q^494+39130633137856*q^511+3658573275392382*q^72+
4861713712672988*q^80+2972362205370032*q^67+4095269029812066*q^75+
3105510833322797*q^68+2236022698937084*q^61+3948412996170842*q^74+
3239263892887634*q^69+5336656983862150*q^83+4246086926825353*q^76+
5177963715864771*q^82+6478229026880840*q^90+7791359501363919*q^98+27252986987*q
^742+2948271686*q^800+18889746187*q^752+33808734660*q^736+10441446143*q^768+
5629259605*q^784+6807567631914120*q^92+5659197578186596*q^85+4704440454469224*q
^79+4550812043076666*q^78+5984817763068460*q^87+3801433417787774*q^73+
6641642100811650*q^91+5822849769102152*q^86+5018105518217750*q^81+
6312597317545918*q^89+6149684561601734*q^88+7627222971056678*q^97+
7465015986871774*q^96+8750644684897633*q^104+9954410087425108*q^112+
91618136920890*q^478+8438093766650554*q^241+8905307997657328*q^105+6870177948*q
^777+7952304823745586*q^99+7136793471889312*q^94+11032272413230842*q^120+
29969096190292*q^521+7299845695860678*q^95+8274208634754782*q^101+
6971029142581264*q^93+8434989045267521*q^102+9663704064744725*q^110+
10904408558115544*q^119+173405601127492*q^452+169286831734504*q^453+
126497242682134*q^465+120423154781136*q^467+177602310528986*q^451+
10095537687636912*q^113+1373355804012286*q^357+1105668469852580*q^368+
1400296145171200*q^356+1427592387912434*q^355+1127946342111156*q^367+
1759494598212112*q^344+1083703424994494*q^369+8114967591713791*q^100+
9365725426247233*q^108+9061139599098209*q^106+9212932463060372*q^107+
10374127116259730*q^115+10511439329306137*q^116+11277841529352562*q^122+
10237179328733888*q^114+11395465733630340*q^123+12246926325454776*q^131+
12979445691559713*q^140+10643935640370128*q^117+8592138911149402*q^103+
9514298021515604*q^109+11512937579115644*q^124+12430765522593412*q^133+
10776646775509897*q^118+11625179477469260*q^125+9808729383196142*q^111+
11843886032953510*q^127+2662480108862810*q^321+11155070225770790*q^121+
11737188562719480*q^126+12051228932250762*q^129+12341570989939859*q^132+
12838454424365854*q^138+12151783904006550*q^130+12909318690721532*q^139+
13373702396149454*q^147+13661122625639615*q^156+3543247200*q^795+1946760421*q^
810+1050462666*q^825+195365586967682*q^447+13418866738536165*q^148+72870866*q^
889+137428191*q^874+289649822*q^857+13044112047799846*q^141+96329614118524*q^
476+12602556548439994*q^135+797524914216387*q^384+979702735579512*q^374+
632314029422094*q^395+408463977711244*q^415+13708207716642262*q^165+238383164*q
^860+2396844265266*q^609+132851149999124*q^463+241532330385740*q^438+
325995213282144*q^425+253056599426084*q^436+186288046116170*q^449+
181904557993292*q^450+62254793400*q^719+1508232076057*q^624+1056831100*q^824+
65877913781406*q^491+93942851688462*q^477+72976513457438*q^487+1415664344285*q^
626+43480503134154*q^507+47039501447984*q^504+1245508433934286*q^362+
59439517236140*q^495+3737780077*q^792+543345320*q^842+6066657221*q^782+
4929702442932*q^585+1980672532*q^808+6376716990*q^780+1904370106*q^811+
1039153289*q^826+3464384262*q^796+1965548100*q^809+1173754415881540*q^365+
3448252608002*q^597+3671660424*q^793+6231275520*q^781+3384184972*q^797+
11344278288*q^765+7097773289*q^776+6516271080*q^779+2325161565460*q^610+
3842119236*q^791+2192682493067178*q^332+884448717919180*q^379+509419692626584*q
^405+12519392600666656*q^134+831354114348976*q^382+11950238611981077*q^128+
13675745893517356*q^168+13458700763524180*q^149+13691764862182626*q^158+
22061193068*q^747+12415608948*q^762+13715057413672258*q^161+13108007818856133*q
^142+13531404217671684*q^151+13224090774958987*q^144+12762113805657124*q^137+
13564246365300546*q^152+13166455264662206*q^143+674040425775332*q^392+
12685072540900861*q^136+13327688208940472*q^146+13276305243455198*q^145+
13640319275250946*q^155+13497693433842144*q^150+764909705846917*q^386+
13715015896632494*q^164+13591897226289346*q^153+13718501859185869*q^162+
13618682914122603*q^154+13717141919471114*q^163+13595229046185782*q^172+
12665813545269037*q^192+13568038018689402*q^173+13230241431668994*q^182+
718167276012796*q^389+12064465079086*q^554+17356172035750*q^541+24797347576412*
q^528+7863450586114*q^569+11728990939348*q^555+16883036567176*q^542+
23484908993237*q^530+37106205509860*q^513+26183095522032*q^526+17844173961629*q
^540+76036075*q^888+34564406*q^905+13710825451464947*q^160+13688559418736362*q^
167+13508389789333346*q^175+13700672584332614*q^166+13676856895299952*q^157+
13131891131380011*q^184+13540277207348888*q^174+230492456671659*q^440+
1012059018*q^827+4433839321*q^788+1992916830*q^807+1790560974*q^813+277788490*q
^858+123659668*q^875+559206896*q^841+13439549389402984*q^177+13701704935431364*
q^159+131890623788*q^698+13618173537426756*q^171+543820481649427*q^402+
20488689510512*q^535+109088965483116*q^471+13181224941081712*q^183+
13475977234660447*q^176+13640501403238361*q^170+13320620903932588*q^180+
13275618884493378*q^181+12792526947194787*q^190+11289572724211377*q^210+
12729214077609640*q^191+12100740542750425*q^200+814256742649646*q^383+
1040988317382686*q^371+2755921035156518*q^319+2313530279913130*q^329+
3208646161577858*q^310+2355095630314684*q^328+1895206118659814*q^340+
3540438840012854*q^304+3656534994752801*q^302+2900984370892289*q^316+
3483298761931060*q^305+2851913550254860*q^317+4213142279815730*q^293+
106421917251672*q^472+7700096346439744*q^249+8624963878140752*q^239+
7609563574823685*q^250+6216667953284380*q^266+5418428979227732*q^276+
6133841110385518*q^267+5341906871679182*q^277+4547081378580957*q^288+
3775392860511317*q^300+298611476918*q^674+235945558546880*q^439+
13658455367289000*q^169+150040783105413*q^458+114623011929228*q^469+
80768903664922*q^483+477014733367174*q^408+12023620850515818*q^201+681010554524
*q^649+2950501636446740*q^315+139492221843278*q^461+3345981492546*q^598+
12599397856558628*q^193+532115679635652*q^403+297511295628162*q^429+
399456929345087*q^416+1221157597564010*q^363+1826307840738241*q^342+
13025926965354799*q^186+15973772751018*q^544+11404034241391*q^556+47284096980*q
^727+83764012418*q^711+146020642*q^873+75084416470*q^714+3245838878204*q^599+
749792729718*q^646+28448188760*q^741+10400552462296213*q^220+390602400672192*q^
417+902844586602727*q^378+29585918788*q^740+16245957961*q^756+688455527267158*q
^391+520674682871297*q^404+165269302111503*q^454+644261626*q^833+430768485654*q
^663+225136321732834*q^441+49124009201*q^726+7882861477494616*q^247+
6897431562131416*q^258+381951795171430*q^418+3598011412031586*q^303+
4278662930441412*q^292+43631684840*q^729+15805930*q^921+1726801201661224*q^345+
98763817005184*q^475+5229182713070*q^583+12408757259200*q^553+3103436614328519*
q^312+2527103244755751*q^324+3051723145027852*q^313+4121563027358*q^591+
6416076011809*q^576+605799194443658*q^397+524070270986*q^657+2232335982035320*q
^331+999750944981016*q^373+77902784762*q^713+118450369858*q^701+26085058196*q^
743+541545597578*q^656+352845486940*q^669+205913505636*q^685+329944754956*q^671
+219909822850721*q^442+51527468*q^881+8797760*q^912+2364152*q^929+
40181364464459*q^510+122794318310*q^700+22816130*q^896+29334448*q^895+42006200*
q^893+11235364*q^911+308698471964*q^673+1391080*q^969+127250553852*q^699+
213082849351*q^684+72237809682*q^715+10181643691230*q^560+252363790274*q^679+
51759984*q^883+27108219*q^900+1512401298657038*q^352+21028049*q^908+791804*q^
945+3265724*q^928+5545648*q^926+17472316*q^909+166534*q^962+1147716*q^944+
7304769*q^914+4200320*q^927+498418283235677*q^406+3000890086418681*q^314+
16965462874*q^755+56449783163330*q^497+198910734132*q^686+460036426996*q^661+
12394232109825880*q^196+13079038910143734*q^185+12852689663586954*q^189+
13402645191137841*q^178+13361845200358660*q^179+12912682922393991*q^188+
12322111400014584*q^197+12969414511988332*q^187+12463581977234244*q^195+
11542317950090830*q^207+12250052673770817*q^198+11625635570546555*q^206+
9658392565101248*q^228+10672612574644038*q^217+51550*q^980+12175340780597828*q^
199+11374259817808274*q^209+179369803288*q^689+491076187724*q^659+
1346954977677302*q^358+12532927068077511*q^194+11028694049064156*q^213+
11946671230889329*q^202+11867318124539014*q^203+69581714699*q^716+8092512477637
*q^568+18860916650948*q^538+11202943005845760*q^211+11788195741029635*q^204+
10123863936424052*q^223+11116735567798803*q^212+11706779296796782*q^205+
10851825791899754*q^215+10031638956786257*q^224+10941121707489948*q^214+
10216759923030860*q^222+9094717850646204*q^234+9938181730571044*q^225+
9188326652841474*q^233+7160873959659102*q^255+8159681162319909*q^244+
40258708478*q^731+1042174300*q^823+552248546*q^839+540058958*q^835+1248080974*q
^818+466607568395692*q^409+416910741922*q^664+319224179959*q^672+192207729880*q
^687+110172212796*q^703+152304380*q^872+249219868*q^852+37604712*q^903+17376746
*q^920+72374389*q^886+7428971339420523*q^252+8531820482141092*q^240+294508970*q
^856+149979276*q^871+276855360*q^854+532715212*q^838+1043628998*q^821+
185608890555*q^688+522471766*q^837+75999280*q^887+261626340*q^853+6803582006316
*q^574+10491351436431032*q^219+9751538747131818*q^227+8906727835521091*q^236+
9845435654081083*q^226+11459322005984669*q^208+10763034102547455*q^216+
7975072071896207*q^246+9000291115081384*q^235+130213834*q^869+558341558*q^840+
289197392*q^855+142980006*q^870+141335096463*q^696+236000145766*q^681+
908884570137*q^640+1461304748062*q^625+1039462865*q^822+220533110262*q^683+
851824874232*q^642+879813725990*q^641+341257814693*q^670+559560893062*q^655+
136556790300*q^697+726154322108*q^647+938851828014*q^639+80882499377*q^712+
507368984190*q^658+21059082543722*q^534+14288685541684*q^548+456435828783523*q^
410+703347844027*q^648+1171601050070*q^632+9893990753776*q^561+
10582745437310961*q^218+8719034282518716*q^238+244041603441*q^680+
4898019329128902*q^283+7518750997832388*q^251+6724030446010101*q^260+
5809525073295036*q^271+6552708359069632*q^262+5730212858134449*q^272+
9376368492159622*q^231+10308335504546104*q^221+390175074713*q^666+228115161302*
q^682+617852800552*q^652+377233444872*q^667+364950216936*q^668+578501723542*q^
654+781041462135066*q^385+28399032537972*q^523+9470757740575911*q^230+
8812435680460528*q^237+8252017774537814*q^243+9282793216627711*q^232+
8345312670262797*q^242+7250005771655793*q^254+8066883935405662*q^245+
7338970280739514*q^253+5495188090042996*q^275+6383563672650922*q^264+
318660759475295*q^426+1371166986256*q^627+824906657536*q^643+1270188529999072*q
^361+290761398867918*q^430+6606812373170*q^575+37330807628*q^733+20604493382*q^
749+66939092158*q^717+1320902215395978*q^359+1020223235802746*q^372+
2114941700428823*q^334+2076849938223906*q^335+2439875125801092*q^326+
2002505737340612*q^337+1663058756552104*q^347+2483095506718066*q^325+
2153452382307738*q^333+2397097243989126*q^327+45425217480*q^728+
2571550087325542*q^323+1871470767458*q^617+2039467079231622*q^336+3148662769889
*q^600+260980220288*q^678+167382795872*q^691+288730000412*q^675+151221953644*q^
694+3897015453643434*q^298+1135534356508*q^633+92822128754*q^708+54524285890*q^
723+30723673954*q^739+52780213747*q^724+156412689700*q^693+95916192572*q^707+
89740306974*q^709+146260825664*q^695+3835715642525958*q^299+3262129597956846*q^
309+4411475198907642*q^290+2616796397606806*q^322+86814437025*q^710+
76781405390380*q^485+3715485368280802*q^301+5077914020500*q^584+2185917010629*q
^612+4615745857576050*q^287+3316520001977532*q^308+2708980314213131*q^320+
5266456949791139*q^278+3155595213096204*q^311+5043283981456054*q^281+
4478762296877514*q^289+13129425709096*q^551+9564185874161974*q^229+
7004843334908*q^573+1197296434056539*q^364+58879*q^978+5707702379453*q^580+
4001085757730*q^592+1694737747373466*q^346+1930385797049206*q^339+
1631996528443483*q^348+1295374411373385*q^360+1601316811451856*q^349+
6230202974374*q^577+9076992369725*q^564+6050687442612*q^578+8569618193662*q^566
+13891890782412*q^549+9614713959944*q^562+22927848624*q^746+4685454729013314*q^
286+866444686742845*q^380+659852531126910*q^393+848708658949184*q^381+
1062193887799920*q^370+6299573671135766*q^265+487593447133640*q^407+
645974509499412*q^394+19389547438524*q^537+4826594819912402*q^284+
4148640464147006*q^294+4084530288956240*q^295+4970500129226954*q^282+
4021422115232287*q^296+3427102101015370*q^306+3371349157960580*q^307+
2803694306372317*q^318+2272719628241875*q^330+50967233754*q^725+638349594236*q^
651+427062571417162*q^413+555720228625308*q^401+436666422693049*q^412+
6467594371336596*q^263+5573031466670974*q^274+4755498763934648*q^285+
23923959998*q^745+14011511992*q^759+403177845976*q^665+1655071904894*q^621+
1555944893684*q^623+1033427531211*q^636+659391831303*q^650+1066556878036*q^635+
3958722906804018*q^297+7741106332*q^774+36132940464290*q^514+53597837522798*q^
499+50877317192756*q^501+71141432729709*q^488+1001216501676*q^637+
24131452808644*q^529+18344571740426*q^539+35180543369406*q^515+348994422057316*
q^422+3972067518*q^790+5651081864399908*q^273+7072792159762117*q^256+7375560096
*q^775+41253948383806*q^509+21293710969*q^748+341158603661300*q^423+8157434274*
q^773+12855467832*q^761+592933542929813*q^398+580274044162810*q^399+
258998870535174*q^435+2033046212*q^806+8644566770*q^772+4193955674*q^789+
26902367885086*q^525+161326852047900*q^455+69343514412428*q^489+49567957583404*
q^502+417682871194796*q^414+153713926891152*q^457+204857365614648*q^445+
157482838183336*q^456+214778337988104*q^443+277654122818417*q^432+
365136468754551*q^420+209771361118912*q^444+265090731202877*q^434+
284129628559612*q^431+64577704127*q^718+3553544799375*q^596+1930453613352*q^616
+7641283436308*q^570+5384483314284*q^582+3770875922917*q^594+5876283387760*q^
579+3884072442722*q^593+5543644025680*q^581+3660545777930*q^595+2470906589905*q
^608+8327022368340*q^567+12764779121473*q^552+9341363878672*q^563+1605126261580
*q^622+2546254088810*q^607+21642028959538*q^533+1860427835337382*q^341+
959936756031784*q^375+1966236989198056*q^338+1571233352701123*q^350+
373445870081338*q^419+15535628135436*q^545+10475400092318*q^559+14693731902528*
q^547+62578437669586*q^493+117493751239348*q^468+123430868148715*q^466+
89339250368368*q^479+87122397799428*q^480+1516814*q^943+2032048*q^942+1090934*q
^970+1465792*q^956+4928742*q^939+3910938*q^951+1642177*q^968+6988600*q^937+
6732964*q^925+311457881602018*q^427+3528013*q^950+218166*q^988+962840*q^947+
7212015177722*q^572+283506*q^974+3562644*q^940+388954*q^960+13966006*q^922+
8138358*q^934+142932310588199*q^460+5933170*q^938+22853993889882*q^531+94590*q^
1004+9898*q^1022+776544*q^971+49732*q^1005+1984276*q^955+563883*q^972+135182*q^
989+2469106*q^954+505958*q^986+317348*q^987+1099318*q^957+733475497367114*q^388
+34255676786977*q^516+48285891369928*q^503+33351554674228*q^517+25479814497628*
q^527+29175862260641*q^522+19933058080886*q^536+190784453903652*q^448+
247223658550182*q^437+4785549266760*q^586+19934*q^994+3053817219808*q^601+
279386*q^961+4644895094242*q^587+7423484689874*q^571+16421415092206*q^543+
618952086788440*q^396+11086031922542*q^557+103039*q^976+356969885974958*q^421+
32474667211556*q^518+67592495328660*q^490+15110414191952*q^546+940585658278288*
q^376+22241075351690*q^532+200066016173562*q^446+271295881302460*q^433+
146440424533466*q^459+969593731897*q^638+4508135943369*q^588+5363637630*q^785+
567896449010514*q^400+103807196205586*q^473+409*q^1040+9609205829*q^770+
101260995044180*q^474+173217316356*q^690+56353749924*q^722+99246827358*q^706+
31726404879*q^738+17670280337*q^754+57929230847478*q^496+1990885700466*q^615+
333509488302367*q^424+446435261188378*q^411+304423675507692*q^428+
78754784592168*q^484+597803151710*q^653+31616856846746*q^519+45821487474168*q^
505+74859547416864*q^486+8818935654754*q^565+8113148*q^936+106387256212*q^704+
1830*q^1011+11794*q^993+60186730365*q^720+102661521394*q^705+9122389538*q^771+
110572361*q^876+111827809268225*q^470+52223919844138*q^500+50177912*q^882+
38693632953*q^732+11980547246*q^763+6675222917*q^778+14731730162*q^758+
475510816305*q^660+773975639400*q^645+10777647621686*q^558+3118773738*q^799+
3266455865*q^798+1862595267*q^812+1706524224*q^814+4742463408*q^787+41898023866
*q^730+1328475328240*q^628+1814951111896*q^618+2054000616804*q^614+
2962424671218*q^602+2118815325564*q^613+799035920070*q^644+1208875670340*q^631+
1287103211930*q^629+2873355529514*q^603+1247223297625*q^630+114243131838*q^702+
325627248*q^848+784277536*q^831+2215916803*q^804+161755263569*q^692+
269892857812*q^677+917455444*q^829+445291027514*q^662+19444976710*q^751+
58196043798*q^721+15464729736*q^757+24946552617*q^744+3599350343*q^794+
36011090293*q^734+34874693724*q^735+344*q^1027+2556745107*q^802+1100597561875*q
^634+19994776653*q^750+2787699641218*q^604+1759919377550*q^619+121266438*q^868+
2978*q^1012+251077598*q^851+10757682376*q^767+35770325*q^902+65436806*q^885+
279120953728*q^676+581538952*q^834+189985096*q^862+83729394*q^878+28*q^1047+
1142533454*q^819+10037397594*q^769+263678622*q^850+125819852*q^865+18295616112*
q^753+32791903162*q^737+64717133*q^890+116870356*q^866+291143546*q^849+7032*q^
996+36913330*q^904+11662804113*q^764+69515604*q^879+20327026*q^897+154*q^1055+
2577*q^1024+4375064254790*q^589+12850*q^997+17961004*q^919+5882138140*q^783+
11076470363*q^766+25471420*q^907+2980*q^1039+27290*q^1021+369042696*q^847+
488613093*q^844+213195752*q^861+163945534*q^863+96672072*q^877+142600614*q^864+
59626737*q^880+336*q^1041+114189860*q^867+57783637*q^884+8437790*q^935+3612067*
q^952+17523194*q^918+3003*q^1032+521925610*q^843+20592*q^1015+364*q^1042+512*q^
1071+1820*q^1068+3360*q^1069+312*q^1029+680*q^1086+153*q^1104+20020*q^1033+3003
*q^1050+10920*q^1051+19*q^1122+544*q^1087+857766779*q^830+2370182746*q^803+
27438*q^1006+2758749278*q^801+710234531*q^832+1595899628*q^815+409591948*q^846+
57393170*q^891+597*q^1056+258440344*q^859+5176152*q^932+34652320*q^894+
1355922952*q^817+6564120420+1484458926*q^816+13309856820*q+13506370615338*q^550
+6052095967958236*q^268+5191264030517068*q^279+6984584988186402*q^257+
4344556745881086*q^291+5117138293199249*q^280+6810195745198348*q^259+
5889916919109426*q^270+6637827840821142*q^261+5970463718808186*q^269+
1541527075588818*q^351+703193226441187*q^390+921514225956592*q^377+13421959771*
q^760+749021359629814*q^387+2254516582032*q^611+5053314446*q^786+
136139810895688*q^462+1706931564450*q^620+2704440936046*q^605+2624207612604*q^
606+4246591200449*q^590+55009430937093*q^498+82837582452869*q^482+
38108113653571*q^512+q^1140+2097525124*q^805+1081748872*q^820+519929509*q^836+
32254168*q^901+2114*q^1014+1890*q^1010+3190934*q^953+15165642*q^917+454999534*q
^845+971270924*q^828+37480*q^979+937108*q^965+280566*q^1001+663476*q^983+266365
*q^1000+1639054*q^967+714807*q^984+8938451*q^924+2579700*q^941+30393106*q^906+
10913878*q^923+52*q^1088+4470*q^1053+148040*q^1003+32315*q^1020+6664*q^1037+
189436*q^1002+37492*q^1034+27326*q^1035+574658*q^985+21925*q^1036+11064*q^995+
454519*q^982+9870*q^1052+1232*q^1070+65104*q^1019+94961*q^1018+198562*q^999+
74360*q^1016+100078*q^1017+3348318*q^931+2488629*q^930+7376640*q^913+20095172*q
^898+34*q^1089+14103689*q^910+49261058*q^892+5064*q^1038+6857990*q^933+12388443
*q^916+23044706*q^899+2862672*q^949+206540*q^981+448310*q^964+3248*q^1025+
106630*q^990+405076*q^973+23088*q^1007+523564*q^959+12057*q^1008+673956*q^946+
141014*q^975+197634*q^963+617554*q^958+35998*q^992+93134*q^977+30*q^1060+
9517294*q^915+1471728*q^966+1790594*q^948+55480*q^991+528*q^1026+176*q^1043+
77557*q^998+36*q^1105+149*q^1072+2910*q^1054+192*q^1030+448*q^1013+5676*q^1009+
156*q^1057+5358*q^1023+32*q^1074]:
end:



#L236(q): the pre-computed truncated up to q^6 of the
#weight-enumerator by q^#123(pi) of S_n, tryL
#L236(q)
L236:=proc(q):
[1, 2, 5+q, 3*q^2+q^4+6*q+14, 42+27*q+24*q^2+7*q^3+9*q^4+6*q^5, 132+110*q+133*q
^2+70*q^3+74*q^4+54*q^5+37*q^6, 429+429*q+635*q^2+461*q^3+507*q^4+395*q^5+387*q
^6, 1430+1638*q+2807*q^2+2528*q^3+3008*q^4+2570*q^5+2864*q^6, 4862+6188*q+11864
*q^2+12525*q^3+16151*q^4+15203*q^5+18179*q^6, 16796+23256*q+48756*q^2+58258*q^3
+80889*q^4+83382*q^5+105082*q^6, 58786+87210*q+196707*q^2+259787*q^3+385387*q^4
+431167*q^5+568809*q^6, 208012+326876*q+783750*q^2+1124704*q^3+1769705*q^4+
2129734*q^5+2930602*q^6, 742900+1225785*q+3095708*q^2+4765761*q^3+7902982*q^4+
10148146*q^5+14527238*q^6, 2674440+4601610*q+12152855*q^2+19873150*q^3+34539352
*q^4+46993138*q^5+69819523*q^6, 9694845+17298645*q+47500635*q^2+81864705*q^3+
148409950*q^4+212661944*q^5+327200581*q^6, 35357670+65132550*q+185082495*q^2+
334052160*q^3+629096364*q^4+944504744*q^5+1501719377*q^6, 129644790+245642760*q
+719559600*q^2+1353003990*q^3+2637532977*q^4+4130591771*q^5+6773007550*q^6, 
477638700+927983760*q+2793121080*q^2+5447702664*q^3+10958971820*q^4+17833668406
*q^5+30100185693*q^6, 1767263190+3511574910*q+10830450780*q^2+21830542860*q^3+
45197027220*q^4+76170163860*q^5+132099138291*q^6, 6564120420+13309856820*q+
41965864794*q^2+87145866752*q^3+185248724362*q^4+322377660872*q^5+573518305776*
q^6, 24466267020+50528160150*q+162539516448*q^2+346793185822*q^3+755330691518*q
^4+1353835501123*q^5+2466880451752*q^6, 91482563640+192113383644*q+629399492330
*q^2+1376521109436*q^3+3066235194908*q^4+5647648935466*q^5+10525239411665*q^6,
343059613650+731508653106*q+2437072038302*q^2+5452332482690*q^3+12400715391073*
q^4+23424344330803*q^5+44590535671158*q^6]:
end:


#PCf(n):the list
#whose (r+1)-th entry is the
#precomputed explicit (conjectured) expressions
#for the number of 123 n-permutations with exactly r
#occurrences of 123. Try:
#PCf(n);
PCf:=proc(n):

[2*(2*n-1)!/(n-1)!/(n+1)!, 6*(2*n-1)!/(n-3)!/(n+3)!, (100+117*n+59*n^2)*(2*n-2)!/(n-4)!/(n+5)!, 4*n*(1804+937*n+506*n^2+113*n^3)*(2*n-3)!/(n-5)!/(n+7)!, (-\
39191040-46806*n^6+26283456*n+3126*n^7-659091*n^4+5520576*n^2+3561*n^8+2630634*n^3+12384*n^5)*(2*n-4)!/(n-4)!/(n+9)!, (-32891443200-9648450*n^6+3611692800*n+
22524*n^7+381205612*n^4+2800103664*n^2-115872*n^8+1607633896*n^3+71304534*n^5+136646*n^9+26246*n^10)*(2*n-5)!/(n-5)!/(n+11)!, (-28177269120000+14335663329*n^6-\
6909513045120*n+2889552582*n^7+193311*n^12+313010684796*n^4+1283595375168*n^2+406430793*n^8+1025692693464*n^3+60005854890*n^5+2349954*n^11+95151030*n^9+13035003*
n^10)*(2*n-6)!/(n-6)!/(n+13)!, (-763734137886720000-86395090065440*n^6-157858417817856000*n+355187760*n^13-26631101348520*n^7+22526480*n^14-1654450096*n^12+
3647384624274048*n^4+103032675524966400*n^2+13111080*n^15+3750695521216*n^8+11386434230674560*n^3-636425872408320*n^5+10534951680*n^11-305671694640*n^9+
15797223760*n^10+1386032*n^16)*(2*n-7)!/(n-5)!/(n+15)!]:

end:


#Pn(n,q,y):The weight-enumerator of perms of {1, ..., n}
#according to the weight q#123*y[1]#(12,i=1)*y[2]#(12,1=2) ...
Pn:=proc(n,q,y) local i,j,gu:
option remember:
if n=1 then
 RETURN(1):
else
 gu:=Pn(n-1,q,y):
 expand(add(y[i]^(n-i)*subs({seq(y[j]=q*y[j+1],j=i..n-2)},gu),i=1..n)):
fi:
end:


#PnListOld(n,q,y):The weight-enumerator of perms of {1, ..., n}
#according to the weight q#123*y[1]#(12,i=1)*y[2]#(12,1=2) ...
PnList:=proc(n,q,y) local i,j,gu:
option remember:
if n=1 then
 RETURN([1]):
else
 gu:=Pn(n-1,q,y):
RETURN(
[seq(
expand(y[i]^(n-i)*subs({seq(y[j]=q*y[j+1],j=i..n-1)},gu)),
i=1..n)]):
fi:
gu:
end:


#fn(n,q): the weight-enumerator of S_n according to the weight
#q^(#123)
fn:=proc(n,q) local gu,i,y:
gu:=Pn(n,q,y):
sort(subs({seq(y[i]=1,i=1..n)},gu)):
end:


#SeqsOld(N,R): The lists whose R+1 lists whose (r+1)-th list
#is the first N members (starting at n=1)
#number of permutations with exactly r occurrence of 123,
#try: Seqs(8,7);
SeqsOld:=proc(N,R) local gu,n1,q,r:
gu:=[seq(fn(n1,q),n1=1..N)]:
[seq([seq(coeff(gu[n1],q,r),n1=1..N)],r=0..R)]:
end:



#PnT(n,q,y,R):The weight-enumerator of perms of {1, ..., n}
#according to the weight q#123*y[1]#(12,i=1)*y[2]#(12,1=2) ...
#truncated to the first R powers of q, Try:
PnT(3,q,y,2);
PnT:=proc(n,q,y,R) local i,j,gu,mu:
option remember:
if n=1 then
 RETURN(1):
else
 gu:=PnT(n-1,q,y,R):
mu:= expand(add(y[i]^(n-i)*subs({seq(y[j]=q*y[j+1],j=i..n-2)},gu),i=1..n)):
mu:=add(coeff(mu,q,i)*q^i,i=0..R):
fi:
end:


#fnT(n,q,R): the weight-enumerator of S_n according to the weight
#q^(#123) truncated to q^R
fnT:=proc(n,q,R) local gu,i,y:
gu:=PnT(n,q,y,R):
sort(subs({seq(y[i]=1,i=1..n)},gu)):
end:



#SeqsSlow(N,R): The lists whose R+1 lists whose (r+1)-th list
#is the first N members (starting at n=1)
#number of permutations with exactly r occurrence of 123,
#try: SeqsSlow(8,7);
SeqsSlow:=proc(N,R) local gu,n1,q,r:
gu:=[seq(fnT(n1,q,R),n1=1..N)]:
[seq([seq(coeff(gu[n1],q,r),n1=1..N)],r=0..R)]:
end:



#PqL(q,L):The value of P_n(n,q,y) where L=nops(L)
#and one plugs in for [y[1], ..., y[n]] the
#values of L, try:
#PqL(q,[y1,y2,y3]);
PqL:=proc(q,L) local n,i,j:
option remember:
n:=nops(L):
if n=1 then
 RETURN(1):
else
expand(
add(L[i]^(n-i)*PqL(q,[op(1..i-1,L),seq(q*L[j],j=i+1..n)]),
i=1..n)):
fi:
end:



#PqLt(q,L,r):The value of P_n(n,q,y) where L=nops(L)
#and one plugs in for [y[1], ..., y[n]] the
#values of L, try: truncated up to the r-th power of q
#PqL(q,[y1,y2,y3]);
PqLt:=proc(q,L,r) local n,i,j,lu:
option remember:
n:=nops(L):
if n=1 then
 RETURN(1):
else
lu:=expand(
add(L[i]^(n-i)*PqLt(q,[op(1..i-1,L),seq(q*L[j],j=i+1..n)],r),
i=1..n)):
lu:=add(coeff(lu,q,i)*q^i,i=0..r):
RETURN(lu):
fi:

end:

#Yeladim(L,q): the children of the list L
#Try: Yeladim([1,1,1],q);
Yeladim:=proc(L,q) local n,i,j:
n:=nops(L):
[seq([L[i]^(n-i),[op(1..i-1,L),seq(q*L[j],j=i+1..n)]],i=1..n)];
end:


#PqLy(q,L):Like PqL but using Yeladim
#Try:
#PqLy(q,[y1,y2,y3]);
PqLy:=proc(q,L) local n,i,gu:
option remember:
n:=nops(L):
if n=1 then
 RETURN(1):
else
gu:=Yeladim(L,q):
RETURN(expand(add(gu[i][1]*PqLy(q,gu[i][2]),i=1..nops(gu)))):
fi:
end:

#TrimPair(P,q,r): Given a Pair P=[coeff,L]
#where coeff is a power of q, 
#and L is a list of powers of q, returns the
#empty set if coeff has power larger than r,
#and otherwise returns the singleton
#{[coeff,L1]} where L1 is L with
#any power larger than q^(r+1) is replaced by q^(r+1)
#For example, try: 
#TrimPair([q,[1,1,q,q,q^3,q^4,q^4]],q,2);
TrimPair:=proc(P,q,r) local c,L,L1,i:
c:=P[1]:
L:=P[2]:
if degree(c,q)>r then
 RETURN({}):
fi:

L1:=[]:

for i from 1 to nops(L) do
 if degree(L[i],q)>r+1 then
  L1:=[op(L1),q^(r+1)]:
 else
  L1:=[op(L1),L[i]]:
 fi:
od:
{[c,L1]}:
end:



#TrimPairs(S,q,r): the set of trimmed pairs coming from the
#set of pairs S with respect to the power r, try:
#TrimPairs({[q,[1,1,q,q,q^3,q^4,q^4]]},q,1);
TrimPairs:=proc(S,q,r) local P:
{seq(op(TrimPair(P,q,r)), P in S)}:
end:



#YeladimT(L,q,r): the trimmed children of the list L
#with respect to the power r.
#Try: YeladimT([1,q^3,q^5],q,2);
YeladimT:=proc(L,q,r):
TrimPairs(Yeladim(L,q),q,r):
end:


#PqLyT(q,L,r):Like PqLy but only interested in terms up
#to the r-th power of q
#Try:
#PqLyT(q,[1,1,1,1],1);
PqLyT:=proc(q,L,r) local n,i,gu,mu:
option remember:
n:=nops(L):
if n=1 then
 RETURN(1):
else
gu:=YeladimT(L,q,r):
mu:=expand(add(gu[i][1]*PqLyT(q,gu[i][2],r),i=1..nops(gu))):
mu:=add(coeff(mu,q,i)*q^i,i=0..r):
RETURN(mu):
fi:
end:

#Seqs(N,R): The lists whose R+1 lists whose (r+1)-th list
#is the first N members (starting at n=1)
#number of permutations with exactly r occurrence of 123,
#try: Seqs(8,3);
Seqs:=proc(N,R) local gu,n1,q,r:
option remember:
gu:=[seq(PqLyT(q,[1$n1],R),n1=1..N)]:
[seq([seq(coeff(gu[n1],q,r),n1=1..N)],r=0..R)]:
end:

#GuessRat1(L,n,d) guesses a rational function in n for the
#sequence L, try:
#GuessRat1([seq((i^2+1)/(i^2+3)),i=1..20)],n,2);
GuessRat1:=proc(L,n,d) local eq,var,a,b,R,Top,Bot,var1,i:
if nops(L)<2*d+6 then
 print(`list too small`):
 RETURN(FAIL):
fi:

var:={seq(a[i],i=0..d),seq(b[i],i=0..d)}:
Top:=add(a[i]*n^i,i=0..d):
Bot:=add(b[i]*n^i,i=0..d):
R:=Top/Bot:
eq:={seq(numer(L[i]-subs(n=i,R)),i=1..nops(L))}:

var1:=solve(eq,var):

Top:=subs(var1,Top):

if Top=0 then
 RETURN(FAIL):
fi:

Bot:=subs(var1,Bot):

normal(Top/Bot):

end:





#GuessRat(L,n) guesses a rational function in n for the
#sequence L, try:
#GuessRat([seq((i^2+1)/(i^2+3)),i=1..20)],n);
GuessRat:=proc(L,n) local d,gu:

for d from 0 to trunc(nops(L)/2)-3 do
 gu:=GuessRat1(L,n,d):
 if gu<>FAIL then
   RETURN(gu):
 fi:
od:
FAIL:
end:


#ConjSeqs(N,R,n): inputs a positive integer R and a symbol n
#and conjectures expressions for the sequences
#"number of permutations of length n with exacty r occurrences
#of the pattern r" for r=0..,R as many as it can get. Try:
#ConjSeqs(20,3,n);
ConjSeqs:=proc(N,R,n) local lu,gu,i,lu1,gu1:
lu:=Seqs(N,R):
gu:=[]:

for i from 0 to R do
lu1:=lu[i+1]:
gu1:=GuessSeq(lu1,n):
 if gu1=FAIL then
   RETURN(gu):
 else
  gu:=[op(gu),gu1]:
 fi:
od:

gu:

end:



#ConjSeqsPC(N,R,n): Like 
#ConjSeqs(N,R,n): but using SeqsPC(N,R):
#Try:
#ConjSeqsPC(20,3,n);
ConjSeqsPC:=proc(N,R,n) local lu,gu,i,lu1,gu1:
lu:=SeqsPC(N,R):
if lu=FAIL then
 RETURN(FAIL):
fi:

gu:=[]:

for i from 0 to R do
lu1:=lu[i+1]:
gu1:=GuessSeq(lu1,n):
 if gu1=FAIL then
   RETURN(gu):
 else
  gu:=[op(gu),gu1]:
 fi:
od:

gu:

end:





#ConjSeqsV(N,R,n): Verbose form of
#ConjSeqsV(N,R,n): 
#Try:
#ConjSeqsV(20,3,n);
ConjSeqsV:=proc(N,R,n) local gu,i,t0:
t0:=time():
gu:=ConjSeqs(N,R,n):


if gu=[] then
 RETURN(FAIL):
fi:

print(`Conjectures for the Number of Permutations of Length n`):
print(`With exactly r occurrences of the pattern 123`):
print(`for r between 0 and `, nops(gu)-1 ):
print(``):
print(`By Shalosh B. Ekhad `):
print(``):
for i from 1 to nops(gu) do
print(`The Number of permutations of length n with exactly`, i-1):
print(` occurrences  of the pattern 123 is`):
print(gu[i]):
print(``):
print(`and in Maple input form it is:`):
lprint(gu[i]):
od:

print(`This took`, time()-t0, `seconds. `):

end:




#LtoS(L,q,r): given a vector of increasing powers of q up to the
#q^(r+1) returns the list of integers of length r+2 whose
#j-th entry is the number of times q^j shows up
#Try LtoS([1,1,q,q,q^3,q^3,q^3],q,2);
LtoS:=proc(L,q,r) local L1,i,x,gu:

L1:=[seq(degree(L[i],q),i=1..nops(L))]:
if max(op(L1))>r+1 then
 RETURN(FAIL):
fi:

if sort(L1)<>L1 then
 RETURN(FAIL):
fi:

gu:=add(x[L1[i]],i=1..nops(L1)):
[seq(coeff(gu,x[i],1),i=0..r+1)]:
end:


#StoL(M,q): given a vector in short format
#converts it to long format, try:
#StoL([2,1,3],q,1);
StoL:=proc(M,q,r) local i:
if nops(M)<>r+2 then
RETURN(FAIL):
fi:
[seq((q^(i-1))$M[i],i=1..nops(M))]:
end:


#Children(M,r): given a vector in short format, finds
#the set of its children also in short format
#try:
#Children([2,0,1],1);
Children:=proc(M,r) local q,L,gu,i:
L:=StoL(M,q,r):

gu:=YeladimT(L,q,r):

[seq([degree(gu[i][1],q),LtoS(gu[i][2],q,r)],i=1..nops(gu))]:

end:






##begin guessing polynomials
#GuessPol1(L,d,n): guesses a polynomial of degree d in n for
# the list L, such that P(i)=L[i+1] for i=1..nops(L)
#For example, try: 
#GuessPol1([seq(i,i=1..10)],1,n);
GuessPol1:=proc(L,d,n) local P,i,a,eq,var:
if d>nops(L)-2 then
 ERROR(`the list is too small`):
fi:

P:=add(a[i]*n^i,i=0..d):
var:={seq(a[i],i=0..d)}:
eq:={seq(subs(n=i,P)-L[i],i=1..nops(L))}:

var:=solve(eq,var):

if var=NULL then
 RETURN(FAIL):
fi:

subs(var,P):

end:

#GuessPol(L,n): guesses a polynomial of degree d in n for
# the list L, such that P(i)=L[i] for i=1..nops(L) for example, try: 
#GuessPol([seq(i,i=1..10)],n);
GuessPol:=proc(L,n) local d,gu:

for d from 0 to nops(L)-2 do
 gu:=GuessPol1(L,d,n):
 if gu<>FAIL then
    RETURN(gu):
 fi:
od:

FAIL:

end:
##end guessing polynomials








#GuessSeqF1(L,n,a,c): tries to guess an expression of the form
#(2*n-a)!/((n-beta)!*(n+c)!)*POL(n) for the sequence L, try:
#where beta index in L that is not zero
#GuessSeqF1([0$3,seq((n1+5)*(2*n1-3)!/((n1-3)!*(n1+5)!),n1=3..20)],n,3,5);
GuessSeqF1:=proc(L,n,a,c) local L1,b,i,Po:
for b from 1 to nops(L) while L[b]=0 do od:
b:
L1:=[seq(L[i]/(2*i-a)!*(i-b)!*(i+c)!,i=b..nops(L))]:

Po:=GuessPol(L1,n):

if Po=FAIL then
 RETURN(FAIL):
fi:
Po:=factor(subs(n=n-b+1,Po)):
Po:=Po*(2*n-a)!/((n-b)!*(n+c)!):

if [seq(eval(subs(n=i,Po)),i=b..nops(L))]<>[op(b..nops(L),L)] then
 print(Po, `did not work out`):
 print([seq(subs(n=i,Po),i=1..nops(L))],L):
 RETURN(FAIL):
else
 RETURN(Po):
fi:

end:



#GuessSeq(L,n): tries to guess an expression of the form
#(2*n-a)!/((n-beta)!*(n+c)!)*POL(n) for some positive integers
#a and c (a<=2*b) and c>=b both as small as possible
#the sequence L, try:
#where beta index in L that is not zero
#GuessSeq([0$3,seq((n1+5)*(2*n1-3)!/((n1-3)!*(n1+5)!),n1=3..20)],n);
GuessSeq:=proc(L,n) local b,gu,a,c:

for b from 1 to nops(L) while L[b]=0 do od:
b:


for c from  b to 4*b do
for a from 0 to 2*b do
gu:=GuessSeqF1(L,n,a,c):
if gu<>FAIL then
 RETURN(gu):
fi:
od:
od:
FAIL:

end:










#AveAndMoms(f,x,N): Given a probability generating function
#f(x) (a polynomial, rational function and possibly beyond)
#returns a list whose first entry is the average 
#(alias expectation, alias mean)
#followed by the variance, the third moment (about the mean) and
#so on, until the N-th moment (about the mean).
#If f(1) is not 1, than it first normalizes it by dividing
#by f(1) (if it is not 0) .
#For example, try:
#AveAndMoms(((1+x)/2)^100,x,4);

AveAndMoms:=proc(f,x,N) local mu,F,memu1,gu,i:
mu:=simplify(subs(x=1,f)):

if mu=0 then
print(f, `is neither a prob. generating function nor can it be made so`):
RETURN(FAIL):
fi:

F:=f/mu:


memu1:=simplify(subs(x=1,diff(F,x))):

gu:=[memu1]:

F:=F/x^memu1:

F:=x*diff(F,x):
for i from 2 to N do
 F:=x*diff(F,x):
 gu:=[op(gu),simplify(subs(x=1,F))]:
od:

gu:

end:




#Stat6(n): the expectation, variance, and the 3rd-6th moments
#about the mean of the random variable #occurrences 
#of the pattern 123 in S_n. 
#Also the alpha coefficients up to the sixth
#(for the odd ones you get the square)
#Try: Stat6(n);
Stat6:=proc(n) local gu,lu,i,q,ru,j,x,ku,mu:
 lu:=L20(q):
 gu:=[seq(AveAndMoms(lu[i],q,6),i=1..nops(lu))]:
mu:=[seq(factor(GuessPol([seq(gu[i][j],i=1..nops(gu))],n)),j=1..6)]:
ku:=[op(1..2,mu)]:

for i from 3 to 6 do
if i mod 2=0 then
 ru:=mu[i]/mu[2]^(i/2):
 else
 ru:=mu[i]^2/mu[2]^i:
fi:
 ru:=normal(subs(n=1/x,ru)):
 ru:=taylor(ru,x=0,3):
 ru:=add(coeff(ru,x,j)/n^j,j=0..2):
ku:=[op(ku),ru]:
od:

mu,ku:
end:


#Stat6V(n): Verbose version of Stat6V(n): 
#Try: Stat6V(n);
Stat6V:=proc(n) local gu,mu,i:
gu:=Stat6(n):
mu:=gu[2]:
gu:=gu[1]:

print(`On the Statistics of the Number of Occurrences of the Pattern`):
print(`123 in the Symmetric group`):
print(``):
print(`By Shalosh B. Ekhad `):
print(``):
print(`Consider the random variable`):
print(`Number of occurrences of the pattern 123 in an n-permutation`):
print(``):
print(`Its expectation is (of course!)`):
print(gu[1]):
print(`and in Maple input form:`):
lprint(gu[1]):
print(``):

print(``):
print(`Its variance is`):
print(gu[2]):
print(`and in Maple input form:`):
lprint(gu[2]):
print(``):

for i from 3 to 6 do
print(`The `, i, `-th moment about the mean is`):
print(gu[i]):
print(`and in Maple input form:`):
lprint(gu[i]):
print(``):
od:

print(`The square of the skewness is, asympotically`):
print(mu[3]):
print(`and in Maple input form:`):
lprint(mu[3]):
print(``):


print(`The kurtosis is, asympotically`):
print(mu[4]):
print(`and in Maple input form:`):
lprint(mu[4]):
print(``):


print(`The square of the fifth alpha coefficient is, asympotically`):
print(mu[5]):
print(`and in Maple input form:`):
lprint(mu[5]):
print(``):


print(`The  sixth alpha coefficient is, asympotically`):
print(mu[6]):
print(`and in Maple input form:`):
lprint(mu[6]):
print(``):

print(`This ends this fascinating article`):

end:






#PCfV(n): Verbose version of PCf(n). Try:
#PCfV(n);
PCfV:=proc(n) local gu,i,lu:
gu:=PCf(n):
lu:=SeqsPC(25,7):
print(`Semi-Rigorously Derived Closed-Form Formulas for the Number of`):
print(`Permutations of size n with Exactly r occurrences of the`):
print(`pattern 123 for r from 0 to 7`):
print(``):
print(`By Shalosh B. Ekhad `):
print(``):

for i from 1 to nops(gu) do
print(`--------------------------------------`):
print(`Theorem Number`, i,`: The number of permutations of length n`):
print(`with  exactly`, i-1, `occurrences of the pattern 123 is `):
print(``):
print(gu[i]):
print(``):
print(`And in Maple input form`):
lprint(gu[i]):
print(``):
print(`The first 25 terms are`):
print(lu[i]):
print(``):
od:

end:

#SeqsPC(N,R): The precomputed Seqs(N,R) for
#N<=25 and R<=7
SeqsPC:=proc(N,R) local gu,i:
option remember:
if N>25 then
print(`N must be <=25, you should use Seqs(N,R)`):
RETURN(FAIL):
fi:

if R>25 then
print(`R must be <=7, you should use Seqs(N,R)`):
RETURN(FAIL):
fi:


gu:=
[[1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440,
9694845, 35357670, 129644790, 477638700, 1767263190, 6564120420, 24466267020, 
91482563640, 343059613650, 1289904147324, 4861946401452], [0, 0, 1, 6, 27, 110,
429, 1638, 6188, 23256, 87210, 326876, 1225785, 4601610, 17298645, 65132550, 
245642760, 927983760, 3511574910, 13309856820, 50528160150, 192113383644, 
731508653106, 2789279908316, 10649977831752], [0, 0, 0, 3, 24, 133, 635, 2807,
11864, 48756, 196707, 783750, 3095708, 12152855, 47500635, 185082495, 719559600
, 2793121080, 10830450780, 41965864794, 162539516448, 629399492330, 
2437072038302, 9437097796918, 36549185005520], [0, 0, 0, 0, 7, 70, 461, 2528, 
12525, 58258, 259787, 1124704, 4765761, 19873150, 81864705, 334052160, 
1353003990, 5447702664, 21830542860, 87145866752, 346793185822, 1376521109436,
5452332482690, 21559064676160, 85125006545645], [0, 0, 0, 1, 9, 74, 507, 3008,
16151, 80889, 385387, 1769705, 7902982, 34539352, 148409950, 629096364, 
2637532977, 10958971820, 45197027220, 185248724362, 755330691518, 3066235194908
, 12400715391073, 49991660982204, 200980915268412], [0, 0, 0, 0, 6, 54, 395, 
2570, 15203, 83382, 431167, 2129734, 10148146, 46993138, 212661944, 944504744,
4130591771, 17833668406, 76170163860, 322377660872, 1353835501123, 
5647648935466, 23424344330803, 96671034640298, 397221475632606], [0, 0, 0, 0, 0
, 37, 387, 2864, 18179, 105082, 568809, 2930602, 14527238, 69819523, 327200581,
1501719377, 6773007550, 30100185693, 132099138291, 573518305776, 2466880451752,
10525239411665, 44590535671158, 187739143883637, 786116211789815], [0, 0, 0, 0,
4, 32, 320, 2544, 17357, 107194, 616449, 3357324, 17513013, 88211386, 431654797
, 2061823804, 9649284793, 44378608890, 201071580333, 899293238364, 
3976973488739, 17414618917290, 75596105867595, 325646307292636, 
1393246785700607]]:

[seq([op(1..N,gu[i])],i=1..R+1)]:

end:











#Wt(pi,q,y): the weight of a permutation pi according to
#123*y[1]#(12,i=1)*y[2]#(12,1=2) ...
#Try
#Wt([1,2,3,4],q,y);
Wt:=proc(pi,q,y) local n,i1,i2,i3,mu:
n:=nops(pi):

mu:=1:

for i1 from 1 to n do
 for i2 from i1+1 to n do
   for i3 from i2+1 to n do
    if pi[i1]<pi[i2] and pi[i2]<pi[i3] then
          mu:=mu*q:
    fi:
   od:
 od:
od:
for i1 from 1 to n do
 for i2 from i1+1 to n do
   if pi[i1]<pi[i2] then
     mu:=mu*y[pi[i1]]:
   fi:
 od:
od:
mu:
end:


#PnDirect(n,q,y):The weight-enumerator of perms of {1, ..., n}
#according to the weight q^(#123)*y[1]#(12,i=1)*y[2]#(12,1=2) ...
#done directly, for checking purposes only! Very slow
PnDirect:=proc(n,q,y) local gu,pi:
gu:=permute(n):
add(Wt(pi,q,y), pi in gu):
end:



#CheckPn(N):Checks Pn(n,q,y) for n from 1 to N 
#Try:
#CheckPn(8);
CheckPn:=proc(N) local n,q,y:
 evalb({seq(PnDirect(n,q,y)-Pn(n,q,y),n=1..N)}={0}):
end:





