Counting decks

The underlying idea of our method is compute a polynomial in the single variable x which yields the number of decks when you `factorialize' the polynomial by substituting k! for x^k.

For each rank we specify the number of suits, hits, and misses, constrain the hits, and include-exclude to provide the right number of misses. In the associated polynomial the coefficient of x^k corresponds to leaving k cards unplaced.  The complete polynomial will be the product of the polynomials for the individual ranks.

Factorialize[p_]:=Block[{coeffs=CoefficientList[p,x]},
	Sum[coeffs[[i+1]] i!, {i,0,Length[coeffs]-1}]
];

Clear[InclusionExclusionFactor]
InclusionExclusionFactor[s_,h_,m_]:=
	Sum[
			(-1)^l Binomial[m,l]*
			Binomial[s,h+l] (h+l)!
			x^(s-h-l),
		{l,0,Min[s-h,m]}
	]

InclusionExclusionPolynomial[ss_,hh_,mm_]:=
	Product[InclusionExclusionFactor[ss[[i]],hh[[i]],mm[[i]]],{i,Length[ss]}]

CountDecks[ss_,hh_,mm_]:=Factorialize[InclusionExclusionPolynomial[ss,hh,mm]]

Deck[r_,s_]:=Table[s,{r}]

As a convenience for testing, we provide the function SetDeck, which sets globals telling the size of the `current' deck.

SetDeck[r_,s_]:=(
	ranks=r;
	suits=s;
	cards=r s
)

Treize preliminaries

We make functions to list partitions relevant to Treize:  The block sizes are <=ranks and there are no more than suits blocks of any given size.

Clear[TreizePartNum]
TreizePartNum[n_/;n<0,r_,s_]:=0;
TreizePartNum[0,r_,s_]:=1;
TreizePartNum[n_/;n>0,0,s_]:=0;
TreizePartNum[n_,r_,s_]:=TreizePartNum[n,r,s]=Sum[TreizePartNum[n - k r,r-1,s],{k,0,s}]

Clear[TreizePartitions]
TreizePartitions[n_/;n<0,r_,s_]:={};
TreizePartitions[0,r_,s_]:={{}};
TreizePartitions[n_/;n>0,0,s_]:={};

TreizePartitions[n_,r_,s_]:=
TreizePartitions[n,r,s]=
If[TreizePartNum[n,r,s]==0,{},
	TreizePartitions[n,r-1,s]~Join~
	(PrependOn[r]/@TreizePartitions[n-r,r-1,s])~Join~	
	Apply[Join,Table[JoinOn[Table[r,{k}]]/@TreizePartitions[n-k r,r-1,s],{k,2,s}]]
];
	
PrependOn[a_]:=Prepend[#,a]&
JoinOn[l_]:=Join[l,#]&

From a partition we need to determine the rank-hits and rank-misses.

RankMiss[p_List,r_]:=Block[{j=Length[p]},
	Table[While[j>0 && p[[j]]<=i, j--];j, {i,r}]
]

RankHit[p_List,r_]:=Block[{j=Length[p],h},
	Table[
		h=0;
		While[j>0 && p[[j]]<=i, If[p[[j]]==i, h++];j--];
		h,
		{i,r}
	]
]

We need the number of orderings of a partition.

PartOrderings[{}]:=1;
PartOrderings[p_List]:=Block[{j=Length[p],h},
	Apply[Multinomial,
	Table[
		h=0;
		While[j>0 && p[[j]]<=i, If[p[[j]]==i, h++];j--];
		h,
		{i,p[[1]]}
	]
	]
]

Treize

To analyze treize, we think of each pass through the deck as one step of a Markov chain.  The state tells how many cards were left in the deck at the time of the last hit.  The initial state is 0.  The unique absorbing state is 52, which is where you go if you have no hits at all.  States 13 through 52 move directly to state 52, since if you're in one of these states you have lost already and don't get another chance  TreizeDecks tells the number of deck arrangements that take you from state i to state j, so it is 52! times the transition probability.  TreizeHits tells 52! times the expected number of hits in passing from state i to state j.
The real work is done by Treize, which returns the pair {TreizeDecks,TreizeHits}.

Clear[TreizeDecks,TreizeHits];
TreizeDecks[i_,j_,r_,s_]:=Treize[i,j,r,s][[1]];
TreizeHits[i_,j_,r_,s_]:=Treize[i,j,r,s][[2]];

Clear[Treize]
Treize[i_,j_,r_,s_]:=
Treize[i,j,r,s]=
	Which[
		j==r s,
		TreizeCount[0, r, s,
			RankHit[{},r],
			RankMiss[{r+1},r]-RankMiss[{i+1},r]
		],
		i==0,
		TreizeCount[r s - j, r, s,
			RankHit[{},r],
			RankMiss[{j+1},r]
		],
		i>=r,
		{0,0},
		True,
		Sum[
			TreizeCount[r s - j - k, r, s,
				RankHit[{i+k},r],
				RankMiss[{i+k},r]-RankMiss[{i+1},r]+RankMiss[{j+1},r]
			],
			{k,1,Min[r-i,r s - j]}
		]
	]

TreizeCount[n_,r_,s_,xhit_,xmiss_]:=
Block[{decksum,hitsum,parts=TreizePartitions[n,r,s],p,hit,miss,alldecks,xhitnum},
	xhitnum=Apply[Plus,xhit];
	decksum=0; hitsum=0;
	Do[
		p=parts[[i]];
		hit=RankHit[p,r] + xhit;
		miss=RankMiss[p,r] + xmiss;
		alldecks = 
			PartOrderings[p] CountDecks[Deck[r,s],hit,miss];
		decksum += alldecks;
		hitsum += alldecks (xhitnum+Length[p]);
		,
		{i,Length[parts]}
	];
	{decksum,hitsum}
]

TreizeP[r_,s_]:=Table[TreizeDecks[i,j,r,s]/(r s)!,{i,0,r-1},{j,0,r-1}];
TreizeV[r_,s_]:=Table[Sum[TreizeHits[i,j,r,s]/(r s)!,{j,0,r s}],{i,0,r-1}];
TreizeE[r_,s_]:=Dot[Inverse[IdentityMatrix[r]-TreizeP[r,s]],TreizeV[r,s]];

Precomputed values

The sad fact is that Mathematica is too stupid to compute the values we need in finite time.

Treize[12, 52, 13, 4] =
  {74453700157794349450763664790526554131036466560815333376000000000000,
   0};

Treize[12, 51, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2214594640359523443808416003709788977267656900965138274713600000000};

Treize[12, 50, 13, 4] =
  {173698226285728987604653385187522898753266793304896516915200000000,
   347396452571457975209306770375045797506533586609793033830400000000};

Treize[12, 49, 13, 4] =
  {170219247913412538364833193082144007134297588468088727142400000000,
   350856146918382618727099560935699944341257141559255210393600000000};

Treize[12, 48, 13, 4] =
  {173556626271953958213016456515190379034324816035300612505600000000,
   374055229520801555571666267370804516879364711591585828044800000000};

Treize[12, 47, 13, 4] =
  {170506251020205242200522744335443331009150148916655308144640000000,
   378664308604941523538178020503736445084304174234542003978240000000};

Treize[12, 46, 13, 4] =
  {173153547216310745978111873220571803477791541112155678965760000000,
   399670242406804444507069057168286674884012015697582903787520000000};

Treize[12, 45, 13, 4] =
  {170860180739140115897330783488487633764084440061766050775040000000,
   406758248207408184557912989642650736643662526330738111938560000000};

Treize[12, 44, 13, 4] =
  {172970576358349054850626656534167251486315284263555920035840000000,
   426121654873129771048131564864652200642735132382735210905600000000};

Treize[12, 43, 13, 4] =
  {170920995477493947521310886632045287083846718366194178457600000000,
   433746793417562012658180611123292470290361112181083167784960000000};

Treize[12, 42, 13, 4] =
  {172886514864636278874061270516670465583146507518482352963584000000,
   452893027583018157278268812932206496109815398453232898408448000000};

Treize[12, 41, 13, 4] =
  {171103321982842314904802364146384631195330596958592410058752000000,
   461262747933320964912111431510579320853535952235356301033472000000};

Treize[12, 40, 13, 4] =
  {172654107382446019697133165999490942763276063831274654007296000000,
   479081897027600451356436507184971060776817395740323556098048000000};

Treize[12, 39, 13, 4] =
  {171296312159334923307404637122580538552802785763644397322240000000,
   488808782898075759298157357518987049789851884096295935148032000000};

Treize[12, 38, 13, 4] =
  {156400889971820652535205173815365104002945286029512143798272000000,
   473443344299055432363543490765004867837704279215143846412288000000};

Treize[12, 37, 13, 4] =
  {109312163201589909053330000156622426603294878583473739996856320000,
   389175805230077545005536222292188271387116228932556641397637120000};

Treize[12, 36, 13, 4] =
  {105592574326957915055077157574471748907252395276062555698626560000,
   386432140993460017283692557600289298972031053139655572250951680000};

Treize[12, 35, 13, 4] =
  {99792916578944834557242673625421961190354658111440899056599040000,
   377135959972906294453224807125782650769025823181184977506140160000};

Treize[12, 34, 13, 4] =
  {95836149181657910339238829730063817388406166902218766910750720000,
   372113146937027227312915962666289875658943831512786837941780480000};

Treize[12, 33, 13, 4] =
  {90288550464140490687057631936036929716648835736753142130278400000,
   362111074216975466036989337015301573577831205434558154790666240000};

Treize[12, 32, 13, 4] =
  {86168734296991628807500883242457055570987871484179710266572800000,
   355105994589929956388661909675801030825381267704145477717983232000};

Treize[12, 31, 13, 4] =
  {80681490860722519284707347513085523085147164772158928192536576000,
   343655261935315809980287107227500732232588144893410794023157760000};

Treize[12, 30, 13, 4] =
  {76524810937018717936947559065914412448293225348846385417420800000,
   335114397291936774784187249931386106754774144928683753130164224000};

Treize[12, 29, 13, 4] =
  {71127500158585973341313439172854486077063933940904712334213120000,
   322392199425657846484183666826980651620329728851618261551284224000};

Treize[12, 28, 13, 4] =
  {66826948594288622280163272359043854108911580485202424996298752000,
   311868677288856419509032920968054083377598230602967738920992768000};

Treize[12, 27, 13, 4] =
  {61571776170087871514616364313638445296132006053046774919489126400,
   298069295148900354173126757509958527130679684857653280040078540800};

Treize[12, 26, 13, 4] =
  {57178288959173516167305292393211222228432441162726877532520448000,
   285770045527005019102942152191408268980176535396271230771055820800};

Treize[12, 25, 13, 4] =
  {52214557363541489282268224719240859191349798030454438515598950400,
   271269389425791813461382898061516586519950089779759703208126054400};

Treize[12, 24, 13, 4] =
  {48472040866554085268155107144298008465323905360206151777517568000,
   259517595603950789231683580272861804002563437533507124215781785600};

Treize[12, 23, 13, 4] =
  {45466899873275289658065678802948912209338969606257535989107916800,
   249570325449808206397740630918896671918112140206479719660938854400};

Treize[12, 22, 13, 4] =
  {42519858743458847197996289057314446453123868388169498981983846400,
   239350551447485360784679709070970289571666258451242602641489920000};

Treize[12, 21, 13, 4] =
  {39812615829722218102236957918910916008363462724699949511496171520,
   229662341630960494696506525228687594144595223448851712011906580480};

Treize[12, 20, 13, 4] =
  {37136844308865154274693958984323657034222080093728558884166041600,
   219679370573196838959637197629463178696102574665857507596414484480};

Treize[12, 19, 13, 4] =
  {34669869724716399271484800912126034577940367729672229742360657920,
   210148579551544649992898649728932250025620878015615854297911132160};

Treize[12, 18, 13, 4] =
  {32300220260869569482737767811416829459253897017632807645861642240,
   200657958142140802746744928235693880409138044177589612429883473920};

Treize[12, 17, 13, 4] =
  {30093440590641264993233585856403512078875495982759028887606263808,
   191509327460501005227006888612803327625322542518872707810723889152};

Treize[12, 16, 13, 4] =
  {27983759860695130368337444544279062198171486096383662509824933888,
   182457056015834890545671753722599555674028533761473262531047849984};

Treize[12, 15, 13, 4] =
  {26062827818074175779294699528609400332134118314614850488207671296,
   173910296860948997871757670957912962305434474546272348304056516608};

Treize[12, 14, 13, 4] =
  {24224619174163436441391595510968852310180615865479929654820208640,
   165480017562238937413068225525341251489909877260505319342423932928};

Treize[12, 13, 13, 4] =
  {22559485959443388509541940910764066941264278255611007000459083776,
   157549687163137597093679902955075458235853804955649717881087721472};

Treize[12, 12, 13, 4] =
  {22251143368362224486551763977883945009091265682867793056797556736,
   158943166286923233514810051937753533504106799319318468122384531456};

Treize[12, 11, 13, 4] =
  {22425287011941573710463965354125746487947531347146887086594850816,
   163682908788028511301205090506397089502120691455142126398828707840};

Treize[12, 10, 13, 4] =
  {22595282564290892438526313685563207400954354415723444813472727040,
   168463734093369475763303914552401588805411640333140575201672560640};

Treize[12, 9, 13, 4] =
  {22774818059453461693468076043184646918379019165450083241411215360,
   173347767237557897267202494412180998918991811292028752182326067200};

Treize[12, 8, 13, 4] =
  {22956020062379020946238761877370756333523509099776050562292776960,
   178309951693416106312319527292036354521596054689397309050852474880};

Treize[12, 7, 13, 4] =
  {23148634900467403534564431597420068714526093894587067374606745600,
   183393706047441750560885411094628163702263221068861433013547827200};

Treize[12, 6, 13, 4] =
  {23355677849306370767153614424297351339301151814816644352232652800,
   188631455423068096580597309640480348089942996747001379536293068800};

Treize[12, 5, 13, 4] =
  {23581785998474220079172986794034774619501641296803899480473600000,
   194049479542759676061882209952888932673959075963559168097596211200};

Treize[12, 4, 13, 4] =
  {23825054228852131910333431698074005328750320827741799803833548800,
   199657725340154004973875465424390032140791807234763023655632896000};

Treize[12, 3, 13, 4] =
  {24095727984553588830372476800153764838888979104220395571301580800,
   205515260806134322958866147213937640141916478309564644126516838400};

Treize[12, 2, 13, 4] =
  {24396202909415360351385712099031289934686866646761377134909849600,
   211658791452057953469958561669674987514167978493067434162913280000};

Treize[12, 1, 13, 4] =
  {24728506974829360570707818982682279956706607734835387644898181120,
   218114444473428785279862453002931555532626540628644708998971392000};

Treize[12, 0, 13, 4] =
  {25100489129824930166665615453111316382078566119271825030177095680,
   224949945589329570317557278923997384852577033502010533209964544000};

Treize[11, 52, 13, 4] =
  {68735850635872234378564494455306377588293469945850757120000000000000,
   0};

Treize[11, 51, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2214594640359523443808416003709788977267656900965138274713600000000};

Treize[11, 50, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2388292866645252431413069388897311876020923694270034791628800000000};

Treize[11, 49, 13, 4] =
  {330020844735267534732233211392876084195933212313099698176000000000,
   670459340562092611461899597557164098464528389249277152460800000000};

Treize[11, 48, 13, 4] =
  {330163285683144647613396043754789987044322887473301133721600000000,
   696835720984944124946069712272621309432152461770517538406400000000};

Treize[11, 47, 13, 4] =
  {330178048485063681695104849900894631018810626375873021870080000000,
   722751792262498026852516471584454557249326685988261923389440000000};

Treize[11, 46, 13, 4] =
  {330023282938735205472124453470527610385458509755460584734720000000,
   747988587703258068932935281913366621816931925169306588938240000000};

Treize[11, 45, 13, 4] =
  {330162456092873895269701535426973059807348523369464447631360000000,
   774373095497835439377480259125498161751911656863959214981120000000};

Treize[11, 44, 13, 4] =
  {330164866827213017831608321115490227759437224347778353725440000000,
   800240300635211674398281587973020377754207990418541379584000000000};

Treize[11, 43, 13, 4] =
  {330055380316615050660574097141405731417064848637371801927680000000,
   825655240161716786302433562102026637408422596633133863403520000000};

Treize[11, 42, 13, 4] =
  {330136677274407581210479564904795708122885860142597011406848000000,
   851798615965696382160423347291178283736547500470146089091072000000};

Treize[11, 41, 13, 4] =
  {330160571423704206541742085404753242361812177335259106377728000000,
   877758548469781915835867561637790611753129328580109432520704000000};

Treize[11, 40, 13, 4] =
  {330071546597842115877422728486719729507509056798742229811200000000,
   903257924431922634144667401227706697622640151219230216290304000000};

Treize[11, 39, 13, 4] =
  {312619944311766358981408824077217122377386416251136888537088000000,
   894316569014840717894325872722260955977068885747623004209152000000};

Treize[11, 38, 13, 4] =
  {330080451371212925747589737988384063311128743729229587283968000000,
   952277089436843689935403886447376150276890391167845319835648000000};

Treize[11, 37, 13, 4] =
  {253291027868156360106965919354695204137148713493287998943395840000,
   824607754633594866565365621446458240228997177091108410480394240000};

Treize[11, 36, 13, 4] =
  {206078353370720810813722822133733712904768947595635130766458880000,
   743660329347399663085158972002115294771924916127731710815109120000};

Treize[11, 35, 13, 4] =
  {197025520889824227333141794407940461857424883733924312860590080000,
   732474008318098198486357545888149569539255799388347399195852800000};

Treize[11, 34, 13, 4] =
  {187598653524497712656778854609579864389089392239205900982681600000,
   718366823802706306711428246237580377101796506729541193873489920000};

Treize[11, 33, 13, 4] =
  {178538764188375539120557682189656886031248036508676639382568960000,
   704207509003469225431395937009033351043462233467119116222464000000};

Treize[11, 32, 13, 4] =
  {169217146378234507961199269927921526284634183939216578275442688000,
   687627320001887659752709117970098685465665570795410914826780672000};

Treize[11, 31, 13, 4] =
  {160048174301544479611362400457833710900520467185524375377936384000,
   670128497279322237083357257203442599207329873857832884031717376000};

Treize[11, 30, 13, 4] =
  {150751901029091308651668656759315919210240086272258524038823936000,
   650697763716249411969870023528270514926599585294377216947257344000};

Treize[11, 29, 13, 4] =
  {141630731553360799671094115704558323096717599487923910837534720000,
   630494850214869493856254117966555670548949555846627291635384320000};

Treize[11, 28, 13, 4] =
  {132291173648629169670915080124277327604171282752360255076696064000,
   607989764808134341456719838531910762254480320271764156737126400000};

Treize[11, 27, 13, 4] =
  {123451662092676200557774331977778464091387268803308569056457523200,
   585677634069361725763695253478928850567212678662049659759886336000};

Treize[11, 26, 13, 4] =
  {113898832028491694688761903115780924062799339446729578655200051200,
   559751528469742208332293890496628418855325132846286983707335065600};

Treize[11, 25, 13, 4] =
  {105647484340635470833455649470766432392798993546514868556162662400,
   536248990927407986458955299334537910759930268955652797410521907200};

Treize[11, 24, 13, 4] =
  {96661323528647220432493079456332976179712846074409914023385497600,
   509277613350661269231237019761953536121379539714526998106734592000};

Treize[11, 23, 13, 4] =
  {90262278155485577505765491059958940970427916449757848307499008000,
   488724936177003683982179430614987317325768563973312095067308032000};

Treize[11, 22, 13, 4] =
  {84517625978728588408293587657951591053908675565247466887656243200,
   469274880299407721071774761140833421241949652227434869484945408000};

Treize[11, 21, 13, 4] =
  {79134768776284977776309971387725500729648381493649374948045619200,
   450339157072108558750097232644242790832214731006246935585410252800};

Treize[11, 20, 13, 4] =
  {73944314457076949308127932322158795877523233911713539857317888000,
   431401628518671577876614451851319226733381908535454917147072921600};

Treize[11, 19, 13, 4] =
  {69046340456874304999914835901073392775837475819325932001380270080,
   412829460814422415681195633576689761435208890584547123509560606720};

Treize[11, 18, 13, 4] =
  {64382784670506027407810555347239594615844734880802478895021424640,
   394523639059538114330545387904020237328944560648148849105808916480};

Treize[11, 17, 13, 4] =
  {60023848444413654268421323057566133249132021186040078956316590080,
   376780877683963378234585505074414638694197331878206622354206883840};

Treize[11, 16, 13, 4] =
  {55864069204971561508105580467789408000146691874795734916489281536,
   359284246834689510649304302360802208146482616747663973465848807424};

Treize[11, 15, 13, 4] =
  {52014519581906044521708179305189316084872728627488725541521981440,
   342484976627695551698134710885815557186298695194664417260988268544};

Treize[11, 14, 13, 4] =
  {48400270422030444485458634164016911186710299704441925685580136448,
   326205307271202931978994070507763589073451175255746071781227626496};

Treize[11, 13, 13, 4] =
  {45037073981559928112547427793646046933873347198195137066123132928,
   310521439777350830140818142724728647136601253604173776309849161728};

Treize[11, 12, 13, 4] =
  {44872358823587527318095749198791337228140333629958755843752067072,
   316619654001711766388273376386864269608699600411647319112559886336};

Treize[11, 11, 13, 4] =
  {44767985392813604519743812445079972244480477487080104510556733440,
   322916536411818916954971719307174587114973413965102898520979931136};

Treize[11, 10, 13, 4] =
  {45132471969021165854544681523708368527867662296974022007351934976,
   332536079976182314866466510652765131827696426776973650360795136000};

Treize[11, 9, 13, 4] =
  {45494155010373252459798788774103873882971509850633812031884492800,
   342265105719565155757558781345407202591728372088112477346662973440};

Treize[11, 8, 13, 4] =
  {45880005242962945174338987269220506756250233949194383854686699520,
   352245749629699053078674435997412135599594390387555701588943175680};

Treize[11, 7, 13, 4] =
  {46270299584324108233173625050093598207634008039276934812831580160,
   362393283933076055748855444555800299731419930084367338419236372480};

Treize[11, 6, 13, 4] =
  {46696004442099034868957797362356951098962870211118801642481254400,
   372870509677064434280276223019800218901151400782143750810894336000};

Treize[11, 5, 13, 4] =
  {47150774664199850181903213376874795350789699951513817276271820800,
   383671975860352753932028514592007056956159196921497048108236800000};

Treize[11, 4, 13, 4] =
  {47649249160543165005114579647174503653867827774657348498148556800,
   394890778043676315593587204325927230192827616357619942070367027200};

Treize[11, 3, 13, 4] =
  {48186575273920640688778426923769900230642998617548935812192665600,
   406533936565350347454356499572395122793952189167545887794554470400};

Treize[11, 2, 13, 4] =
  {48791321312219937583761573321080028770935593267143861062965657600,
   418773578996058928831724328021910584825436770233457152853698150400};

Treize[11, 1, 13, 4] =
  {49453624183033185391996845299084232585037765757704649717726576640,
   431607911265574537809282832472455795292570650274610736943805235200};

Treize[11, 0, 13, 4] =
  {50194430362929106153361782267158801993455077949690062401951498240,
   445181700717315253891938841672671738023721125776654092943774187520};

Treize[10, 52, 13, 4] =
  {63465696565879340231167301712290674442939712214781279600640000000000,
   0};

Treize[10, 51, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2214594640359523443808416003709788977267656900965138274713600000000};

Treize[10, 50, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2388292866645252431413069388897311876020923694270034791628800000000};

Treize[10, 49, 13, 4] =
  {2211115661987206994568595811604410085648687696128330484940800000000,
   2551554157814032071298262197768698099917282873064507939225600000000};

Treize[10, 48, 13, 4] =
  {477202772452574146440131360571772018521529351608370987008000000000,
   990914694523803122599540345906585372386565390040657244979200000000};

Treize[10, 47, 13, 4] =
  {474282964175338002060079404420305705903982773010438039797760000000,
   1019749198430408535177607703238398128869334248627892377354240000000};

Treize[10, 46, 13, 4] =
  {476943766603396606400470677944225042219787590110418797854720000000,
   1064558426464744083068413943351206455826681611945805652951040000000};

Treize[10, 45, 13, 4] =
  {474508558577651597965984308797599316992660313941282809446400000000,
   1094827268515652468329975062325178981062487356393629406986240000000};

Treize[10, 44, 13, 4] =
  {476746532229407038507699259383429928687457563393114977075200000000,
   1138423537850764618681357966845158447549903869721057301626880000000};

Treize[10, 43, 13, 4] =
  {474699152091621721585061881498285478445553947396444751134720000000,
   1169807238175702438244274403877821977116794261542545569873920000000};

Treize[10, 42, 13, 4] =
  {476564263849856809285793813915201134044958560145546577707008000000,
   1212297336437464172021559193155256198684332514171025501454336000000};

Treize[10, 41, 13, 4] =
  {474855681970393301695874908694856014116673191365343130419200000000,
   1244679224212947638567497671760483031755092038092563419234304000000};

Treize[10, 40, 13, 4] =
  {457412779894367161786142061510741750633239372362379704664064000000,
   1248310743347436133467491156220046114815777510728025086361600000000};

Treize[10, 39, 13, 4] =
  {474923471131423671861474144544950773956372256543487471648768000000,
   1316303188805738109488282139721932612694103599329152612696064000000};

Treize[10, 38, 13, 4] =
  {460220698891270310456213182294473870614974847290918318374912000000,
   1325346202049385302588936989713123941961397168320190013767680000000};

Treize[10, 37, 13, 4] =
  {413007935021687164075285621499023218891050582411710090193141760000,
   1264396520335017628560924996933673054659953763989058948987617280000};

Treize[10, 36, 13, 4] =
  {338645643361196475481074636299284093894260068904581461463531520000,
   1144175600900720837989739899337068875136361995917030321322721280000};

Treize[10, 35, 13, 4] =
  {289418896376029047806815571764153700524711174504744413812490240000,
   1060426245409398383874023822016244781743773935842165551204925440000};

Treize[10, 34, 13, 4] =
  {277135503100072464824298877643237128628726330091088038655426560000,
   1045073721553126675655790443483895345807713628743930123082792960000};

Treize[10, 33, 13, 4] =
  {262935259400112271212076957326940465297728685789540160750223360000,
   1022145185976483735840855424076143944024308871473875223461232640000};

Treize[10, 32, 13, 4] =
  {250497970481688550428947606490432661071941889697652023618437120000,
   1002161526849170780987577418586929513063824467638477895170523136000};

Treize[10, 31, 13, 4] =
  {236442255343594675076920036281004312235014710281083735404183552000,
   975458459085690602570599681179759484040180803904669920473907200000};

Treize[10, 30, 13, 4] =
  {223865644646044418903334055642036520856144790946066592291618816000,
   950862630282739670418990544046766147736928444210740383235178496000};

Treize[10, 29, 13, 4] =
  {210283077291926824820445644363905325032404334360092013901119488000,
   921376233921427755627078958791591850014469535791211056094773248000};

Treize[10, 28, 13, 4] =
  {197279317529840798312479001330269479245582742513242090489511936000,
   891411952866265235385129044661642374985266088308913097087647744000};

Treize[10, 27, 13, 4] =
  {183394803667068835301525910726304898849208866460293245039961702400,
   856810872464303064698045983665861684982764174617004526830354432000};

Treize[10, 26, 13, 4] =
  {172003060205652919401461219740982559211365470478468464139829248000,
   827405384417108528076935571431945711217656815209183289574581862400};

Treize[10, 25, 13, 4] =
  {157974108803729893793682291404247871428443775705486573253636915200,
   788498756734496555508906679601293195847198754814334036825918668800};

Treize[10, 24, 13, 4] =
  {146013539385270330461904728220197457345314040281890321535179161600,
   753450482729689322719169105859530200188239559183611514319169126400};

Treize[10, 23, 13, 4] =
  {134759053917863237337525168011878084975935801677423755153480089600,
   718820505033551929470783900212624318470828259861202610940175974400};

Treize[10, 22, 13, 4] =
  {125929299032845327159069635453974650148914754107530210748693217280,
   689767696502254475254528628804447456388130672425292662934150840320};

Treize[10, 21, 13, 4] =
  {117947030179304728404676687890817028513861849681924517703628881920,
   662292236051430359519946771072395648815756728559596170590656921600};

Treize[10, 20, 13, 4] =
  {110328147131585499101170719382854937929189892553780892819039191040,
   634996956135176065677280429444880187769907001144931373832481013760};

Treize[10, 19, 13, 4] =
  {103090428521584123838770056871792311724971057245783331651830415360,
   608130980353798848164217699584788013125171780458313855109431296000};

Treize[10, 18, 13, 4] =
  {96209740689607834465135106190016962166488231417177666315563827200,
   581606529749157117968484751173190488755440895154992546554105036800};

Treize[10, 17, 13, 4] =
  {89728597902848722470287652604524866866110506160329468473962921984,
   555755763408196351556836199599601111857405128254114333818236174336};

Treize[10, 16, 13, 4] =
  {83611751377893036591199557442290689590491551633884876891509227520,
   530467148898150682008156802155662951123256504996196761824453984256};

Treize[10, 15, 13, 4] =
  {77838201307343149647758410842069479156873469098101067804200402944,
   505798531393608221489605406311313824207625085749068699267510566912};

Treize[10, 14, 13, 4] =
  {72459200092791981515176079054607322500724453325829386422538207232,
   481986497058602073094622581868299572049767586605360193459558809600};

Treize[10, 13, 13, 4] =
  {67470288635417160766559356778404086703481304411829591160182013952,
   459152544121921690139913152207058474785523635879223614462396203008};

Treize[10, 12, 13, 4] =
  {67384723362201297335693547849995634539450517442123696382756782080,
   469648451797545577468673371445215005957653485451322631368229257216};

Treize[10, 11, 13, 4] =
  {67445132923470811318069658277826074514118468479546690385290985472,
   480732597519878211405336162315887492707482850498985379436041338880};

Treize[10, 10, 13, 4] =
  {67570133848377381220704988247858263677959444011386082230754344960,
   492111737710184276435161562644373172234020821769001282380891160576};

Treize[10, 9, 13, 4] =
  {68147861677287020355871506936202850931130306279263661069367771136,
   506787139830155840423288972170810470379173380416263024358824345600};

Treize[10, 8, 13, 4] =
  {68729032603732935507213414814975845085928993456294217961659432960,
   521687601885012820278493811767324800996755681695310013895771422720};

Treize[10, 7, 13, 4] =
  {69346442038566973411776579861753845914131131441782003759967109120,
   536978729036709931836503322500708586330806400214508533867798855680};

Treize[10, 6, 13, 4] =
  {69986643567919468222987473815107383608335796334897011457219624960,
   552626296188964990275125278064559018098909738427304535068539617280};

Treize[10, 5, 13, 4] =
  {70686595417291049489377317059170908967692447313750559906227814400,
   568829693705173019056593393261417167829529223409909966740599603200};

Treize[10, 4, 13, 4] =
  {71434503559622086093540183680211524631355446122717191958272409600,
   585577763832914084514230566512080714233821525513119829420146688000};

Treize[10, 3, 13, 4] =
  {72256209758033422581170374531436909410052987649259929899473305600,
   603026960961190764976834362984911991647935219229894444792256921600};

Treize[10, 2, 13, 4] =
  {73151029355338196497105821193885935609024926435082069345514291200,
   621234231563799901973008743943803544494354200867629742277682790400};

Treize[10, 1, 13, 4] =
  {74151666697272559144237127235791254870951287526055143576688394240,
   640408568705184014053558982544235016965042754480357701882321305600};

Treize[10, 0, 13, 4] =
  {75254292278871417887653738753796913479529874643953376235135959040,
   660611005044336569498661185744327244809302137487760636098243461120};

Treize[9, 52, 13, 4] =
  {58607485870909163119280003169023009374864251486905428869120000000000,
   0};

Treize[9, 51, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2214594640359523443808416003709788977267656900965138274713600000000};

Treize[9, 50, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2388292866645252431413069388897311876020923694270034791628800000000};

Treize[9, 49, 13, 4] =
  {2211115661987206994568595811604410085648687696128330484940800000000,
   2551554157814032071298262197768698099917282873064507939225600000000};

Treize[9, 48, 13, 4] =
  {2211258102935084107449758643966323988497077371288531920486400000000,
   2724970025006313083609167629301137342362113409720818178457600000000};

Treize[9, 47, 13, 4] =
  {609600305078250454829911836324595358939491650274502639616000000000,
   1290383880236233440717272567046977434940352003156021576990720000000};

Treize[9, 46, 13, 4] =
  {609565243472821222727663033875129032291536589931580856729600000000,
   1337874204464942871556908619614898395935512450451155137331200000000};

Treize[9, 45, 13, 4] =
  {609716775574825258970697863902727658362403635702441044869120000000,
   1386125055677091407614469164870267176191674186685727249530880000000};

Treize[9, 44, 13, 4] =
  {609589166406373021051020813590881329870865722570613425438720000000,
   1433288109545435084794415604736823210064125413844166660587520000000};

Treize[9, 43, 13, 4] =
  {609596649429679059916889608939806994234417405452096173506560000000,
   1480963385942650792614879625714223399298347825296771142123520000000};

Treize[9, 42, 13, 4] =
  {609679955839810693987274677943006224227180868400794080116736000000,
   1528932149225267709471427779531024525263352518908089389285376000000};

Treize[9, 41, 13, 4] =
  {588970345546569226386535918153844232777427744977762989899776000000,
   1535054338589791223076752731338233083333725771446510149435392000000};

Treize[9, 40, 13, 4] =
  {609519978010763589133071641734673658704381190802618303119360000000,
   1620429438574297720662526627928447289140754851887888440754176000000};

Treize[9, 39, 13, 4] =
  {592229561064864765020011811654066178584053259305176828739584000000,
   1633866988168051918127867940250581040009480834484980496203776000000};

Treize[9, 38, 13, 4] =
  {609479756197899074239934519557753876640259997056611037216768000000,
   1712879602494010870995379907052364940559261184200552373813248000000};

Treize[9, 37, 13, 4] =
  {532871707583158604073146569930207329469178646006192616746516480000,
   1607653097482143902294949250117362503929631469247180337169039360000};

Treize[9, 36, 13, 4] =
  {485552705267561843415578882924065301733080162719181508307845120000,
   1548163714601500124097093784512080713098958065609101531393556480000};

Treize[9, 35, 13, 4] =
  {411485301999968135499163463029470824863579806334300018452725760000,
   1428783209032496933420941381934164927014004037564699866677903360000};

Treize[9, 34, 13, 4] =
  {362106963606582927139546620486009275316740084353898009528893440000,
   1346182687388308361719616539567867812805134212209770390135767040000};

Treize[9, 33, 13, 4] =
  {345402070899317564809466936678140999166800377221080160403456000000,
   1322557017255804903084728480232646653780212623400177562487357440000};

Treize[9, 32, 13, 4] =
  {328124636202635899153114653149472333952137562992174304296173568000,
   1294070919338420076411569225533329681201648759043956792870567936000};

Treize[9, 31, 13, 4] =
  {311728416207889124216098637012300601666806096889613938050727936000,
   1265897190026915872306882607014438457195246942415964803057057792000};

Treize[9, 30, 13, 4] =
  {294188443576744354507024829923112310545941435522906188995887104000,
   1231458222594564050702694127557743678345803969662397704648523776000};

Treize[9, 29, 13, 4] =
  {277262240493905012409125949008645042585249629989798826903339008000,
   1196295217907419579786289821592894007165270716102638347088822272000};

Treize[9, 28, 13, 4] =
  {260464306515137893819927588953726207137550435773315561866395648000,
   1158589887262638502993483169542275161967864265899757236714995712000};

Treize[9, 27, 13, 4] =
  {244446689559955276122179194839141795282962744661030018438974668800,
   1120888491720000431109047436564555631744468485182584844158658150400};

Treize[9, 26, 13, 4] =
  {227290073270595971407850127087850795499227934329571889175855104000,
   1077045098460589124345970025956737757533261720608145210314063872000};

Treize[9, 25, 13, 4] =
  {211622075017155961177392084508667734584438525492016204587466752000,
   1035154674230143484559113062059999937131717204379571116614195609600};

Treize[9, 24, 13, 4] =
  {194310309501517053587683938137415003614823615730749413729815756800,
   985836901862138719479152907650248097394869465678678598607070822400};

Treize[9, 23, 13, 4] =
  {180358927623338671924795705196712477330084154329037810627824844800,
   943936021256600030533818701330064133539100833988205208907284480000};

Treize[9, 22, 13, 4] =
  {167036361660734592740343832147583192832315723097768774255478046720,
   901880328233468005376418042275132836738655865786726484638915624960};

Treize[9, 21, 13, 4] =
  {156239047161000567446357019837605533220687759512704256810502062080,
   865676855396156880032734965244927915084534380041667481215455723520};

Treize[9, 20, 13, 4] =
  {146210153801652253287854209783820473653438649287234705877201059840,
   830494200967230944186298606616551519816569880220938131026697256960};

Treize[9, 19, 13, 4] =
  {136773564957215232121642553378996939184607545372191215764677591040,
   796100778783492450063141895246080727869091496171150750931191070720};

Treize[9, 18, 13, 4] =
  {127727217550335711788455245808602430055178791971072893110892625920,
   761944850930828374713221511594016439881933271976337764479768985600};

Treize[9, 17, 13, 4] =
  {119186570413402303008379958630135704009025369426432058208064372736,
   728478651702015780255825200846633146028324914704962932368677535744};

Treize[9, 16, 13, 4] =
  {111093438436171988800826533144408901499156333439518704642530738176,
   695675238713186592793935771466546224615731785559215159228904767488};

Treize[9, 15, 13, 4] =
  {103575145145151529002483169064912425152872851721087991339018092544,
   664076084524511302686031615139284382377941915126820231666879954944};

Treize[9, 14, 13, 4] =
  {96405534272367868638872341904421180469935767100601167163189886976,
   632988086663790182497179609202900653939417588375775517518445150208};

Treize[9, 13, 13, 4] =
  {89752303783313066951798585068580899072672708874819471497400156160,
   603090028426683658860044468938536367132770237605390447259206811648};

Treize[9, 12, 13, 4] =
  {89845199482307738078635452356966693234149246408218753281241907200,
   618352299212312444659956020256597931658953786059780242800656777216};

Treize[9, 11, 13, 4] =
  {89995285923388111736708696767310939961325537259425405002760323072,
   633860819492085759896822684871173112027685370662796636302658764800};

Treize[9, 10, 13, 4] =
  {90306904214813238697293135327232067368772109540718484486105333760,
   650115719701495879087700050003748165610271102818077930132613365760};

Treize[9, 9, 13, 4] =
  {90684497351810409814717171429300921418577651711165820690193448960,
   666763543782083437966319926403578950206557423277320965661409673216};

Treize[9, 8, 13, 4] =
  {91499778435160884674855196998198677092477662883206362287933751296,
   686703900951479339173595712470684440864332787857349630229773025280};

Treize[9, 7, 13, 4] =
  {92328085749444038293711290840511861117006098528660421661278863360,
   707003741316282705831228437614144285997803745925783860713692856320};

Treize[9, 6, 13, 4] =
  {93218727277392388817410688489713880690878161249143210305828945920,
   727928562144840020298988557380139272914896672816893159925067284480};

Treize[9, 5, 13, 4] =
  {94148743648162328164989235933050400434496744281655159177567272960,
   749406430029309660383725049867901514068322826497015217236979220480};

Treize[9, 4, 13, 4] =
  {95166127488882787363765360496401805269094340619039594274566963200,
   771710817090956971050194558474578870768447197183436454307771187200};

Treize[9, 3, 13, 4] =
  {96259928653282764774697495466230546464609294826997917505971814400,
   794847203467584738792516679940777158765763854583032885136483942400};

Treize[9, 2, 13, 4] =
  {97469612778644056066776483957456438110579486349730703438197555200,
   819065670748697548986688471790341550711835975294135449794746777600};

Treize[9, 1, 13, 4] =
  {98784343828754472760261742255445476466862770121135629753636618240,
   844395787846221195135293770259474827058018395883461851046792396800};

Treize[9, 0, 13, 4] =
  {100257078432668470189504918762135607584835204229117450127241379840,
   871175187635123307586712258802472672275767349151983754412996689920};

Treize[8, 52, 13, 4] =
  {54128379606247580951997277783543397349298518923652964024320000000000,
   0};

Treize[8, 51, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2214594640359523443808416003709788977267656900965138274713600000000};

Treize[8, 50, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2388292866645252431413069388897311876020923694270034791628800000000};

Treize[8, 49, 13, 4] =
  {2211115661987206994568595811604410085648687696128330484940800000000,
   2551554157814032071298262197768698099917282873064507939225600000000};

Treize[8, 48, 13, 4] =
  {2211258102935084107449758643966323988497077371288531920486400000000,
   2724970025006313083609167629301137342362113409720818178457600000000};

Treize[8, 47, 13, 4] =
  {2208338294657847963069706687814857675879530792690598973276160000000,
   2889121869815830948957067418537239751880391145572117910650880000000};

Treize[8, 46, 13, 4] =
  {734113896080896283220745425404149062397952750889717548974080000000,
   1586971509681092992543073402672938456148344772367428521820160000000};

Treize[8, 45, 13, 4] =
  {731788451954965274895237846867054580573536986635806053498880000000,
   1637685820966492855059143379082199914689663733245774554726400000000};

Treize[8, 44, 13, 4] =
  {734037736839899813828003618650628751238796565024524048793600000000,
   1701372365777149429110205093678937869341713506227974213468160000000};

Treize[8, 43, 13, 4] =
  {731871152176090345140764017757661688012917134042793970237440000000,
   1752323379508807157742127774943725941788816563607760273408000000000};

Treize[8, 42, 13, 4] =
  {711434001174563619271154803993636213893492849222482198003712000000,
   1770446130513203336003590130985009600912018361980785931583488000000};

Treize[8, 41, 13, 4] =
  {732059158865368133857681822159432784891363022482150164267008000000,
   1863930741919476211968131593342664678390271097155883961942016000000};

Treize[8, 40, 13, 4] =
  {714685572770605076703747831719812729313815502043270466240512000000,
   1887784487357594792987653348380176404925037354828426041622528000000};

Treize[8, 39, 13, 4] =
  {732111677983929612633593189495102717041030874451551654510592000000,
   1975538529095546620596009918348987783990750862651516187049984000000};

Treize[8, 38, 13, 4] =
  {717561724532106881172095608117370831616553643811781742690304000000,
   2005164769847393000937638094230929527560757900229771731664896000000};

Treize[8, 37, 13, 4] =
  {670164157637413791461094960507215014815522259671942770290851840000,
   1963598702106488501484198051120466921128581973368933305024512000000};

Treize[8, 36, 13, 4] =
  {595954542166339744684285975135959600172920244803056942123581440000,
   1863930560838764604819340255614313111514845887023825923394764800000};

Treize[8, 35, 13, 4] =
  {546636856761875048467751110403605117928257776913073845693317120000,
   1799927846376338412552157965728848061911130698422893437853368320000};

Treize[8, 34, 13, 4] =
  {474525766429989599184482612012624826556638735192568188811345920000,
   1684996278035114956177785712274786379669318207686441444699013120000};

Treize[8, 33, 13, 4] =
  {424038922776862289323814789356840277840748019443735451486126080000,
   1600442865674679823741705428137054529974978731186598234585825280000};

Treize[8, 32, 13, 4] =
  {404133225288039690220139625954583465252606350717465578793074688000,
   1570552731310503847326247035777174216425021661542881392290955264000};

Treize[8, 31, 13, 4] =
  {382697892313560949750128057341675408480866539886602999721623552000,
   1532715408479057022212207390605484399584457471592312225606402048000};

Treize[8, 30, 13, 4] =
  {363542405452024377840891405350743640968454013512372208764190720000,
   1498489867611901681783639972684316341114509150064969311231934464000};

Treize[8, 29, 13, 4] =
  {341977599528113887111064161000174183122764963515993234272681984000,
   1454002159773907147833641940864551711135030884356706628435705856000};

Treize[8, 28, 13, 4] =
  {323446746265988213260633423081428400325194852969554366890508288000,
   1415150074909351505817220395624385199295889215902694052202545152000};

Treize[8, 27, 13, 4] =
  {302715798694252586458747695071369500606635964757159277647364096000,
   1366921804052173877980991368799809984283883546381614712436555776000};

Treize[8, 26, 13, 4] =
  {283651817087103829587378571532691210312305228749781849416610611200,
   1320445583308169567794020351089220862746777720941403491056327065600};

Treize[8, 25, 13, 4] =
  {262641483456128404581423036085790109296388997920733586757412454400,
   1265164526367702509234435171780725804155982862874071431662010368000};

Treize[8, 24, 13, 4] =
  {243844229750331775945819647976284587747576702130383019344658432000,
   1213192931275175879388686715995496925737701614589503700093160652800};

Treize[8, 23, 13, 4] =
  {224956389748163508008066887084483576372980370843930010436658790400,
   1158155025682689392691293790832330482429698446167421952059873689600};

Treize[8, 22, 13, 4] =
  {209192266896323740585982164525744218828795764854043099616038092800,
   1109577737642725306131754294264560433018766489730635344926254039040};

Treize[8, 21, 13, 4] =
  {194245490171292954058087279727511888173745801878209171727780413440,
   1061393133206171466646648637222630764432934425745413827432095416320};

Treize[8, 20, 13, 4] =
  {181651156116316778109650121491098171036384687297326164710533365760,
   1018299990218662302465127810867665504627100785806590193962686873600};

Treize[8, 19, 13, 4] =
  {169926693471506891163757676255011420625973026213187699136580812800,
   976419712902535853223660382574151670846331290500061776711568588800};

Treize[8, 18, 13, 4] =
  {158882885652271123026420187808288617617089555777932049972094566400,
   935445508427384580479139962994300556184330254461786133725865574400};

Treize[8, 17, 13, 4] =
  {148365785734146860446061093893068014499029331682247708022241492992,
   895060359170826661363463015000641481604625935576663337089795883008};

Treize[8, 16, 13, 4] =
  {138403199653584172161396730560834979074139603190574761517848199168,
   855373974384539621188013098311979139558223245936961553869035274240};

Treize[8, 15, 13, 4] =
  {129046121406267407446183832156985933274674407202051828648259878912,
   816826709327672193866059306296223156321473079652677482779422752768};

Treize[8, 14, 13, 4] =
  {120225566598396545402417195844829326212835518494799255337865052160,
   779205972400281722215246547535111018089418390100933541951384322048};

Treize[8, 13, 13, 4] =
  {111926786829485320994539968326670828906915829296445006913155891200,
   742645599412105795724856447094210029099170245385046567595863441408};

Treize[8, 12, 13, 4] =
  {112142584619579160040968123606456290860979261770095446405268111360,
   762348859355168153016037247509336781315939390297557769593150242816};

Treize[8, 11, 13, 4] =
  {112488165830079819929107083440689267857670674351050951019171151872,
   782683966199117768877728084433823834038435508846498021015289856000};

Treize[8, 10, 13, 4] =
  {112901355054654451786616189034369629368010224580950097785446727680,
   803403573850544021344791362214751338057530804149766902191709224960};

Treize[8, 9, 13, 4] =
  {113482153276153070914513782510389849109282525315849100625203691520,
   824996726883089556896497656054839164663442386327193681102194606080};

Treize[8, 8, 13, 4] =
  {114138433853182381411313143103198216711017576561507288101704171520,
   847136315241620902165615595764192354614936754201049845888393936896};

Treize[8, 7, 13, 4] =
  {115217078308586846962831536374237293042581557190531476547642064896,
   872564918886906253103416857253213567042875681361011754477792788480};

Treize[8, 6, 13, 4] =
  {116328749843883784146775001629136352897030636091530897079098408960,
   898562768459309825488617870424085344385175850333045063140948049920};

Treize[8, 5, 13, 4] =
  {117537639714045755684796070768133966477339317415548066375579729920,
   925476761995094509694812972277074932921363098952560008842895687680};

Treize[8, 4, 13, 4] =
  {118803978798611686512064148741085355829568264205530843819288821760,
   953180514410761986394106678932424365454914896991828791276318228480};

Treize[8, 3, 13, 4] =
  {120191053053377279500508952529641734627154497316475976640626688000,
   982028968967543501375205041192840021924019799849573189294856601600};

Treize[8, 2, 13, 4] =
  {121692116240670105416606686348683393190376210063209975617945600000,
   1012079726504824170035265000613355047329741524198428464562726502400};

Treize[8, 1, 13, 4] =
  {123348104793394930473459236042198905763987175892164155531738480640,
   1043608446439493543054313081678982492622526605935580432244198604800};

Treize[8, 0, 13, 4] =
  {125165652746687864175663595276617988666475058918883672732194570240,
   1076765745421463870109341129847554355734134497755202200282459013120};

Treize[7, 52, 13, 4] =
  {49998209667913912590899927055739662683992871841134888878080000000000,
   0};

Treize[7, 51, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2214594640359523443808416003709788977267656900965138274713600000000};

Treize[7, 50, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2388292866645252431413069388897311876020923694270034791628800000000};

Treize[7, 49, 13, 4] =
  {2211115661987206994568595811604410085648687696128330484940800000000,
   2551554157814032071298262197768698099917282873064507939225600000000};

Treize[7, 48, 13, 4] =
  {2211258102935084107449758643966323988497077371288531920486400000000,
   2724970025006313083609167629301137342362113409720818178457600000000};

Treize[7, 47, 13, 4] =
  {2208338294657847963069706687814857675879530792690598973276160000000,
   2889121869815830948957067418537239751880391145572117910650880000000};

Treize[7, 46, 13, 4] =
  {2208303233052418730967457885365391349231575732347677190389760000000,
   3061160846652615440289785862634180742981967753825388163235840000000};

Treize[7, 45, 13, 4] =
  {846442715805983875224183581548102608708947492875853774192640000000,
   1866994348668530055717034848444295970960484745725869996113920000000};

Treize[7, 44, 13, 4] =
  {846415773363161182655532075734373156440581393715669835448320000000,
   1932944747957887550494318163713639045211224885981248686653440000000};

Treize[7, 43, 13, 4] =
  {822100946277077447304715618988790840447943967809013117091840000000,
   1950416140286423828939908734477659217128990275409741642465280000000};

Treize[7, 42, 13, 4] =
  {846323018255613863955828724169843967657495316908352179535872000000,
   2060932150721236803043889014167349913842615524784442041171968000000};

Treize[7, 41, 13, 4] =
  {825879400429574668937918243064153269090401819570468496080896000000,
   2086412191307917219289923750542909664476010323236647298138112000000};

Treize[7, 40, 13, 4] =
  {846270021150786506187353325756711098620603941091203165978624000000,
   2189663966504602267948524008670041659215606312813195618680832000000};

Treize[7, 39, 13, 4] =
  {829048592415106885182231117998068451241363110429395802652672000000,
   2221708805178765756621755572387761904299590231565413445009408000000};

Treize[7, 38, 13, 4] =
  {846230190458719746733902355937277053725930945719632740220928000000,
   2318925846060315009857145102864445327095060412344258955051008000000};

Treize[7, 37, 13, 4] =
  {769747247828975391634950481570070485493571036823626571705221120000,
   2232540050614114374839696945385527503127874047726126926827356160000};

Treize[7, 36, 13, 4] =
  {722265895484023423614337530318789301949424571324830966695854080000,
   2190897441923760346902806503401398159196726502099048970468720640000};

Treize[7, 35, 13, 4] =
  {648919481438294665531123024301565046816242103624483602306170880000,
   2092156718135003823800953427567539540963008263833754544793190400000};

Treize[7, 34, 13, 4] =
  {598921440012948040333226890826089078358857789461116161747845120000,
   2026221676580893590775609278738305853952155429257427251657441280000};

Treize[7, 33, 13, 4] =
  {527061582447909185116269958042706664640442414191668791837982720000,
   1910648924123357424847376433504428239464324855654689470351933440000};

Treize[7, 32, 13, 4] =
  {476472699303973013713719150135512462420171815524476347465334784000,
   1825701959787206346232670586488056700963326257543114001062297600000};

Treize[7, 31, 13, 4] =
  {452719754519847356537531112930494303406024878902319146246078464000,
   1786931873509883237635475426901474264083389992253714804028473344000};

Treize[7, 30, 13, 4] =
  {428847348858963286482456910425367114907080737055676661988589568000,
   1743511323641595805135537401317097955648149371824045553363189760000};

Treize[7, 29, 13, 4] =
  {407255345394600811493698397233368074945903748559141443792273408000,
   1703652876501780821139747555092917272090241059207092128136036352000};

Treize[7, 28, 13, 4] =
  {383126270203364904730006756928286814484579802847107212384403456000,
   1652507227716444191509088002584079305173804040076042356060585984000};

Treize[7, 27, 13, 4] =
  {360838798187053080496374382836823193117085242568781369705286860800,
   1603373547323662354891100973452433335841649394277069278424544051200};

Treize[7, 26, 13, 4] =
  {337411838417074334304809066278412189511313516849375132300345344000,
   1547150660158156166984858466791070797816154290792695676951278387200};

Treize[7, 25, 13, 4] =
  {314693402402334980756003129675894801206700998169204222943716966400,
   1489630921707559011706872252164600724139973847168445603486944460800};

Treize[7, 24, 13, 4] =
  {290966037475643527834468704435756546857256667554008268132266803200,
   1425328740030309723533327206413760293004116297930143246087670988800};

Treize[7, 23, 13, 4] =
  {270736728522414277025051949964311189690132214528091831791307980800,
   1367967945391900286471928661648844828533907994187837520146857984000};

Treize[7, 22, 13, 4] =
  {250392694897543920767077447807472621807214459304764751714336112640,
   1307195174164458496136768086216422544544965990451598609710862827520};

Treize[7, 21, 13, 4] =
  {233192538881035728646796728963715795293765386569605137067294064640,
   1252997192563302153846734640815210195123665759423171894769929420800};

Treize[7, 20, 13, 4] =
  {216745980445491098420779083168544963545535057994597041056031703040,
   1198776740425195340393809844638932623454743111937742118230740172800};

Treize[7, 19, 13, 4] =
  {202739914076903390071534150658610754733032628751163899890116853760,
   1149933999447768891997943897362697151103055901480037136730748354560};

Treize[7, 18, 13, 4] =
  {189565821033738651428308995287507357380475313820672240736104611840,
   1102019446512325009039180489087324718858669238288820741689814548480};

Treize[7, 17, 13, 4] =
  {177238762415287463228994971915359114396050673930879237138239455232,
   1055493438345199879925931419043003899511957658627843714182197280768};

Treize[7, 16, 13, 4] =
  {165433789142523227791927777238412850076996193337972084243251068928,
   1009392516026904964369358759599066508282408149582500159299864494080};

Treize[7, 15, 13, 4] =
  {154307041457480695457369042294352338974056364390887841174149660672,
   964337338269368652205919899488247172330334532861438115798065348608};

Treize[7, 14, 13, 4] =
  {143798145240542242302113966074783522188144130779046507783410155520,
   920361993280685036306108185399139944604915963554083420151121707008};

Treize[7, 13, 13, 4] =
  {133972042227163741743323610660478793213116392967790798997458780160,
   877770288202306410679670122435870095773436711656838894787240132608};

Treize[7, 12, 13, 4] =
  {134329863871963668482364189536697837265605283781462989976905973760,
   902000907979286067906903636477591469195118776662816175899977711616};

Treize[7, 11, 13, 4] =
  {134802210800226715484348983579832799378504619194761630435688579072,
   926778299925654043308583758254363717216506925582690467346959564800};

Treize[7, 10, 13, 4] =
  {135422895389394816585384096558859671991333265420956682463089786880,
   952363808096963220044162179001050700415713259598101741703224360960};

Treize[7, 9, 13, 4] =
  {136118198095254151830932182703647842865374915639116929440310886400,
   978465339661288308576905433526308497179785450303910312186824622080};

Treize[7, 8, 13, 4] =
  {136992234118319842075859891746787790373164224455226085798649528320,
   1005613587136175864761077941874667131847670666553390237200311910400};

Treize[7, 7, 13, 4] =
  {137955812780897026539533926304004635676394580889233803520476446720,
   1033484997664242375378998122368514765930140306658354134465481015296};

Treize[7, 6, 13, 4] =
  {139340600771077974514899963753683435860088515449672124058195460096,
   1064733968683982596285205527469083012101015686928645549156760289280};

Treize[7, 5, 13, 4] =
  {140782787845435300901874769298782498029064275369753353286278184960,
   1096800698507612478851311246542819528650379923702863089676446597120};

Treize[7, 4, 13, 4] =
  {142348864832046094804596585653567825790620880788153666642871582720,
   1130066991977804556554717231295196647307340121474660693865849159680};

Treize[7, 3, 13, 4] =
  {144000519638455680308167300629687391265119910837363738034107842560,
   1164425230266170649016111041176236871550231895891459267057554554880};

Treize[7, 2, 13, 4] =
  {145817099709885449203705671002840094999016577609666952385108377600,
   1200337237580786370035414071498733495783624243055615298659522969600};

Treize[7, 1, 13, 4] =
  {147790527184503243916918804828657786677963530380171142918874071040,
   1237877146544560502606083704445527418360157506494131348159279923200};

Treize[7, 0, 13, 4] =
  {149978056169746716795854135726487801985755497596558346394261258240,
   1277434891398971080674263671999934346655849215900506140156908011520};

Treize[6, 52, 13, 4] =
  {46189257080051876934443066102345396537381184778755951820800000000000,
   0};

Treize[6, 51, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2214594640359523443808416003709788977267656900965138274713600000000};

Treize[6, 50, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2388292866645252431413069388897311876020923694270034791628800000000};

Treize[6, 49, 13, 4] =
  {2211115661987206994568595811604410085648687696128330484940800000000,
   2551554157814032071298262197768698099917282873064507939225600000000};

Treize[6, 48, 13, 4] =
  {2211258102935084107449758643966323988497077371288531920486400000000,
   2724970025006313083609167629301137342362113409720818178457600000000};

Treize[6, 47, 13, 4] =
  {2208338294657847963069706687814857675879530792690598973276160000000,
   2889121869815830948957067418537239751880391145572117910650880000000};

Treize[6, 46, 13, 4] =
  {2208303233052418730967457885365391349231575732347677190389760000000,
   3061160846652615440289785862634180742981967753825388163235840000000};

Treize[6, 45, 13, 4] =
  {2205977788926487722641950306828296867407159968093765694914560000000,
   3226529421789033903134801573724490229658697220943781916835840000000};

Treize[6, 44, 13, 4] =
  {925552753848569819883127520832361200706922527798215510589440000000,
   2091218708928704824949509053909615133743907154146340036935680000000};

Treize[6, 43, 13, 4] =
  {949811052328968254120237612324632123658431946436763661107200000000,
   2207824903436041988487635502966616714070294689724228645683200000000};

Treize[6, 42, 13, 4] =
  {929566077685602055938328414409038188655547920386219105583104000000,
   2243530611834120963572493985346706655689455898911546969948160000000};

Treize[6, 41, 13, 4] =
  {949915853630169825788121983133673324690117078467796354990080000000,
   2352943066567495723627051710430948773124059105406652805808128000000};

Treize[6, 40, 13, 4] =
  {932792160443896259950518145508109888094534471344704100237312000000,
   2394613555274672136054090154671343770503621208342539928600576000000};

Treize[6, 39, 13, 4] =
  {950082186354237236084222521540609921889232164963479336255488000000,
   2498846906711617333423209892603450230451262840432398423818240000000};

Treize[6, 38, 13, 4] =
  {935579024055817594836110814731774680076815065118465176109056000000,
   2545494571105648644428673040277580489714750831773740060114944000000};

Treize[6, 37, 13, 4] =
  {888807949321785648833115153742664365893706816354115617239859200000,
   2522741653293362772400460092950771635949077079099416429765591040000};

Treize[6, 36, 13, 4] =
  {814094586352933965217742179238479912273950486610636301559398400000,
   2438716468094207537178916128463134279910538610640642882268037120000};

Treize[6, 35, 13, 4] =
  {764511740394827111864904621250988894901571605490049485016924160000,
   2390751230557036540446243157965513030084241126073649432467865600000};

Treize[6, 34, 13, 4] =
  {693161407606484582746545343203493567093825869531814299948810240000,
   2295086645536288374373114042070662392226667581841782327706910720000};

Treize[6, 33, 13, 4] =
  {641537085397312441169516566150909695179557180987159845651087360000,
   2224160070115181653936382954619947163845963487035162842355466240000};

Treize[6, 32, 13, 4] =
  {571375710271967704620940421591374210151275135394240841161637888000,
   2111014970308348862501957755202900418273291647515131159276158976000};

Treize[6, 31, 13, 4] =
  {519280720245556888704004867825475513254739858671411612631433216000,
   2021215654911804162167960941900716480361802582455389403673001984000};

Treize[6, 30, 13, 4] =
  {494833604510168197264237179916001888503244234102062864631070720000,
   1981631514775721068799223700054674023052481699110244563189497856000};

Treize[6, 29, 13, 4] =
  {467479806507595837468921120069679467859925051824040293991186432000,
   1929364761546687398620755061158446957629422844661029018225606656000};

Treize[6, 28, 13, 4] =
  {443390333540586001152460537484844229512514266857637256919777280000,
   1882738801277382855816786814118700065186026398527948616804335616000};

Treize[6, 27, 13, 4] =
  {415927277275817670007088372998823270104344283116810934041968640000,
   1822245568028369461876437765007581973378772601627213268929164083200};

Treize[6, 26, 13, 4] =
  {391094840905516777512015832228899362952881349645591553441057996800,
   1765298238975797220576036931960285464075162753962116288143477964800};

Treize[6, 25, 13, 4] =
  {364320136360165032084876412750322452503733094967061346822337331200,
   1698699637468891117013617211837220907917766931268092833727879577600};

Treize[6, 24, 13, 4] =
  {339068334156031270072838575812745551504779783413172079529505587200,
   1632533120863149469079505603392008907521476125672075320663788748800};

Treize[6, 23, 13, 4] =
  {314204950380477701575954716058966319109462930337623041170735104000,
   1563482307659421881931162595202007057508928050050494350811253964800};

Treize[6, 22, 13, 4] =
  {292663479091918458453201068295465979337922041100558767075968942080,
   1500714449826090939688096276295159886183552344655359935194731642880};

Treize[6, 21, 13, 4] =
  {271271008327832219306318995024604013011024510115803564569704529920,
   1435412561815576879066527576249440167798145022041004127798280847360};

Treize[6, 20, 13, 4] =
  {252784368908274487976752066968163208746430315385126159638499164160,
   1375802303495215602372595539990884686331091754533027521132903792640};

Treize[6, 19, 13, 4] =
  {235208047941593108060971325569295777909960886140641590865538580480,
   1316666035284255148761827206588886444515682383114215001522018713600};

Treize[6, 18, 13, 4] =
  {219965510442756397956869389309934450028005645152921165810976686080,
   1262488012326466845722087235451109770063082008744345191750272286720};

Treize[6, 17, 13, 4] =
  {205652853859545678922163862526526232938228369477680450946111373312,
   1209520619636765683218227229333866491173374941407707618534341214208};

Treize[6, 16, 13, 4] =
  {192132767442644262625517969188098508132603424613252436920146853888,
   1157597666944995977638079622283591160976096553901705686109462200320};

Treize[6, 15, 13, 4] =
  {179314248497397065432821733799679879439241691310565407281278615552,
   1106678317631912794936507995714931576132769558608287293871161868288};

Treize[6, 14, 13, 4] =
  {167165107483983296798739783110267413595386542516948974613351628800,
   1056675230269793046249387540608744169644532612891360792584763998208};

Treize[6, 13, 13, 4] =
  {155786271238031281615925104024883181068162827620923523271187496960,
   1008257663585764692202224319673666139452113376207820890889737207808};

Treize[6, 12, 13, 4] =
  {156373636603986361799274248977532761041534640657423558420211957760,
   1037201096905000393997040559214709483944292359987504439109475106816};

Treize[6, 11, 13, 4] =
  {157001072876326949426920424834109149405216734263668100127021596672,
   1066545060506636719360260221145291220279843182512291083496875622400};

Treize[6, 10, 13, 4] =
  {157753622275259973682313765288553896929331669790510345209386106880,
   1096578889696523113906497309710898409373377764736081164943239413760};

Treize[6, 9, 13, 4] =
  {158675478043360278251835805953953123512964551165588708048817356800,
   1127622118001991193995674749317263410838234959880456454411890196480};

Treize[6, 8, 13, 4] =
  {159672243045225779056869712086343703516664470687268076818058444800,
   1159309904933639711697020841084712660351847923483313130374902579200};

Treize[6, 7, 13, 4] =
  {160869553964514190844857726390466795093049974501481820218269368320,
   1192262345262350378847539970790598977957192951639629611010726297600};

Treize[6, 6, 13, 4] =
  {162180111563521475899057195226198729519640477724928919382335160320,
   1226190618865317710813781277295410807569831994883905219033401655296};

Treize[6, 5, 13, 4] =
  {163911901215945498316273272256725172113860393555939539150172061696,
   1263601829129777627806714305384515859059343723343307542645262254080};

Treize[6, 4, 13, 4] =
  {165724146012422940623218147460571767062927658665358948893993205760,
   1302105050290853878680559976371654271160490137539537031430007685120};

Treize[6, 3, 13, 4] =
  {167694864333934305379897577462165733814151558301621424842363371520,
   1342146044983399813508631108129254997486904494394849282729527214080};

Treize[6, 2, 13, 4] =
  {169796950949819806447591819712962849213503445566692818568777564160,
   1383704206878861440962468661616375821928842265714636358683595898880};

Treize[6, 1, 13, 4] =
  {172109494263546976857136278039193465557114501208905480796152791040,
   1427262647632689129738023905549519776341379164826954135836295168000};

Treize[6, 0, 13, 4] =
  {174641398657580560272913226749948697150935848305264789668327587840,
   1473017732047466004949850389876022996703120499780420015964993617920};

Treize[5, 52, 13, 4] =
  {42676049075492471197941416374887136023531341897014368534528000000000,
   0};

Treize[5, 51, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2214594640359523443808416003709788977267656900965138274713600000000};

Treize[5, 50, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2388292866645252431413069388897311876020923694270034791628800000000};

Treize[5, 49, 13, 4] =
  {2211115661987206994568595811604410085648687696128330484940800000000,
   2551554157814032071298262197768698099917282873064507939225600000000};

Treize[5, 48, 13, 4] =
  {2211258102935084107449758643966323988497077371288531920486400000000,
   2724970025006313083609167629301137342362113409720818178457600000000};

Treize[5, 47, 13, 4] =
  {2208338294657847963069706687814857675879530792690598973276160000000,
   2889121869815830948957067418537239751880391145572117910650880000000};

Treize[5, 46, 13, 4] =
  {2208303233052418730967457885365391349231575732347677190389760000000,
   3061160846652615440289785862634180742981967753825388163235840000000};

Treize[5, 45, 13, 4] =
  {2177276814695093143269656173112449249004032318307246549237760000000,
   3169127473326244744390213306292794992852441921370743625482240000000};

Treize[5, 44, 13, 4] =
  {2205850328896873613743253400568937833970600290259379274383360000000,
   3393187541051548671017586433678869354273448376398912180715520000000};

Treize[5, 43, 13, 4] =
  {1022873967102152997878856110434965448518941816770994896896000000000,
   2353846811668183793381803091865683950527720273269670354616320000000};

Treize[5, 42, 13, 4] =
  {1046989848938227268556084065189283651631393971633083199258624000000,
   2479580177081647302407381764371338109280932396878946147237888000000};

Treize[5, 41, 13, 4] =
  {1026728907007796474125065637051743280074326227471622580731904000000,
   2521250931747841984155162825592085097586483931377928352301056000000};

Treize[5, 40, 13, 4] =
  {1046877644168520920391563483070937730687956044343255448420352000000,
   2639198772494425084229914689924570231761459258068153330040832000000};

Treize[5, 39, 13, 4] =
  {1030674534449216825934833781812840185948387512039292060827648000000,
   2689953696118226924476572922615012997541634584419126269181952000000};

Treize[5, 38, 13, 4] =
  {1047001093060580626421098184933219471229201937071259477082112000000,
   2800346806350592461466125726575689839642860504312141731332096000000};

Treize[5, 37, 13, 4] =
  {970440464442761103801881042546064436785848319791137404695347200000,
   2729258745351642756003127255867099887298415575576782003492618240000};

Treize[5, 36, 13, 4] =
  {923638430776511751510921089287918866449192204298671716313333760000,
   2705202443470552244504228509718942953876941706003682844129361920000};

Treize[5, 35, 13, 4] =
  {849151470559274644115378091802760616266247991132070827083694080000,
   2618811090405434540563229491100857034125884259636110985632153600000};

Treize[5, 34, 13, 4] =
  {799540175024368412155593513081353343622361612063322835821527040000,
   2569376331960309851239454931996231409663467634903557678909358080000};

Treize[5, 33, 13, 4] =
  {728335018407739401901714340439107876055289398139356000194396160000,
   2471335088138124118544184183209146498085964984255532850258903040000};

Treize[5, 32, 13, 4] =
  {676734698837573418532416975763680023807224543284463749021302784000,
   2399032648834511410576192059345749960099443245124764702741626880000};

Treize[5, 31, 13, 4] =
  {608349045781371644325371025128653317202459714412044350784536576000,
   2288514330399750625999447615021606330767399288235925232641114112000};

Treize[5, 30, 13, 4] =
  {556251980556186448638527048489942117579534740964625839460188160000,
   2197640902661476645261101315322065262703773254187038085717426176000};

Treize[5, 29, 13, 4] =
  {528413898176715929778759005695768250586301405167991625625894912000,
   2149091218258174869302851342302341355559946782645988346367574016000};

Treize[5, 28, 13, 4] =
  {498961602554429210458405962164639311389205922832207924091158528000,
   2090855828813075154596981598688801754120239184108123412882259968000};

Treize[5, 27, 13, 4] =
  {471592194088983188537885198971964871809497091340959460136216166400,
   2034751215062474238244168058161823283306206652431145841861853184000};

Treize[5, 26, 13, 4] =
  {441950117403515279508631197304277761858053522458410448929475788800,
   1967216763182311906860243741222624573318339566954880109177837977600};

Treize[5, 25, 13, 4] =
  {413863227151347041313613339421134713598636366182674869553568153600,
   1899881743312639905009896389041431567265436139425945285138002739200};

Treize[5, 24, 13, 4] =
  {384826347667050205617667953128992825665014496908218551082627891200,
   1825176946809421952452091505395110575618867996722878654967709696000};

Treize[5, 23, 13, 4] =
  {358669339848073956965773360851279273980026205462283620286726144000,
   1754833857733281633279478321935352306479017462020358264254051123200};

Treize[5, 22, 13, 4] =
  {332830403075662734821800039940721661160825027433556376133587435520,
   1681224272377681290806680120644775854517308218090477846077699522560};

Treize[5, 21, 13, 4] =
  {310370607142313695144987120461890605534636846569348465153886126080,
   1614235035491429903666278090370441317063656351453047739109752176640};

Treize[5, 20, 13, 4] =
  {287999640053162367876606376580653157750551128510991301922835660800,
   1544349741762618392283845993714578010370257857112523750783571722240};

Treize[5, 19, 13, 4] =
  {268582042104794156370540007932988643775105552581817930603760189440,
   1480417787367488410635155297310736633379840881055220393497560350720};

Treize[5, 18, 13, 4] =
  {250028393083459008484895182818896847568829182982431400399827107840,
   1416713409816226495228447484149192375050770493864905613877538979840};

Treize[5, 17, 13, 4] =
  {233754706462010664787943016033045144143248711153463105793967521792,
   1357776336552778075194849728939630802896161771672266188141686161408};

Treize[5, 16, 13, 4] =
  {218407431449590872632514355789127801503721984296774736853250080768,
   1299944623277885366374258996145597742468809364536238401469410181120};

Treize[5, 15, 13, 4] =
  {203997388140768342030851328051680350818572304416930895485554655232,
   1243619246873259892950976262896918058908768652444444593704180645888};

Treize[5, 14, 13, 4] =
  {190295044206486083148668063531827865855689181484786908341783756800,
   1188252235945487737143779418781099312102035784662499168958501879808};

Treize[5, 13, 13, 4] =
  {177395805884252528220915755608793947845760602262328858776782766080,
   1134248773980475181222594216919575266486585962538832517158160826368};

Treize[5, 12, 13, 4] =
  {178180635380968097723637859907800062969018667161400847363746037760,
   1167778987272350401486968209325409864273620481280475021880974114816};

Treize[5, 11, 13, 4] =
  {179040888249583997410595613259396516966858239374478183364634345472,
   1201837075218388470465615055562525189605938754539634721955407462400};

Treize[5, 10, 13, 4] =
  {179965655607285857872292587240341549923940255488172654795927060480,
   1236500872980375760052335207142631929060325492924240864772211343360};

Treize[5, 9, 13, 4] =
  {181022553888330293748407657201874974963343419691914778027176755200,
   1271994778147550249425025162073194205241375269340330963257450823680};

Treize[5, 8, 13, 4] =
  {182265195241112282910914990847260785590018715741907702775388569600,
   1308701034084680231336961535728739209147171533266977773200185753600};

Treize[5, 7, 13, 4] =
  {183589611710631417511828253570504816234139890513385734960421273600,
   1346209949684507443878647203496687627117564672703136950570398515200};

Treize[5, 6, 13, 4] =
  {185146891177168895029227086805896222722262892139339850882922577920,
   1385278776112388506196324957652371857468704517023119840721135206400};

Treize[5, 5, 13, 4] =
  {186845205739709046691804582864739362165679145629050169472445317120,
   1425607265205195254554306096212203722538056537307734897822317674496};

Treize[5, 4, 13, 4] =
  {188962503758110823676245603773664322993646755461069484338756714496,
   1469543184397443572436472903446417342868181388305990110148642734080};

Treize[5, 3, 13, 4] =
  {191197220863122659865001704700639275539126637446157798184908226560,
   1514927864435538346648165936488124964788742887925683807283859947520};

Treize[5, 2, 13, 4] =
  {193638767069514720012075766671812002517069110774916067754109829120,
   1562295062305464995280124477340460019929751356126126740353402798080};

Treize[5, 1, 13, 4] =
  {196259112089883564602980960556747367132440657576569605722210304000,
   1611645561887942642222881912562067909025089969946941541583400468480};

Treize[5, 0, 13, 4] =
  {199154670127517071989185550943852154571759588458128603926044344320,
   1663583711381625952342152670335470877793289668081769641786201866240};

Treize[4, 52, 13, 4] =
  {39435173342185774859310678473071625569364827703056986537984000000000,
   0};

Treize[4, 51, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2214594640359523443808416003709788977267656900965138274713600000000};

Treize[4, 50, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2388292866645252431413069388897311876020923694270034791628800000000};

Treize[4, 49, 13, 4] =
  {2211115661987206994568595811604410085648687696128330484940800000000,
   2551554157814032071298262197768698099917282873064507939225600000000};

Treize[4, 48, 13, 4] =
  {2211258102935084107449758643966323988497077371288531920486400000000,
   2724970025006313083609167629301137342362113409720818178457600000000};

Treize[4, 47, 13, 4] =
  {2208338294657847963069706687814857675879530792690598973276160000000,
   2889121869815830948957067418537239751880391145572117910650880000000};

Treize[4, 46, 13, 4] =
  {2177125282593089107026621343084850622933165272536386361098240000000,
   2998804945733956192408112778073099290385146834202806504652800000000};

Treize[4, 45, 13, 4] =
  {2205868188317371942205922931027886551138462043845958282772480000000,
   3221246667505816472689634629193873065062037828150816313180160000000};

Treize[4, 44, 13, 4] =
  {2179633660961719635105472909543395249840020187054660994990080000000,
   3340640887961295064543914489878901538766606170623070112317440000000};

Treize[4, 43, 13, 4] =
  {2203683823473492682561865567271072065925133536366570095247360000000,
   3553738960584602604853984569779957320830119991611269431951360000000};

Treize[4, 42, 13, 4] =
  {1114459290682700935200686019192853888731088718151200532332544000000,
   2614281334911463807654361378285688031687339601013421004292096000000};

Treize[4, 41, 13, 4] =
  {1135679930443426025425371382241683687846055879071834539294720000000,
   2740612389197402287894252893466557572345683826567230796070912000000};

Treize[4, 40, 13, 4] =
  {1117828758552960714450075581603151798699348360389890286813184000000,
   2794687383107174509734195429034814994740501819665090344910848000000};

Treize[4, 39, 13, 4] =
  {1134755736908510810014328596887548290828798642298973428121600000000,
   2912025812358971802691007318756428069970060934183724894912512000000};

Treize[4, 38, 13, 4] =
  {1121329874154506491988598204042326839738153545205573415337984000000,
   2976314188604768454097449437318056621118207700742018625961984000000};

Treize[4, 37, 13, 4] =
  {1072956796957415829004607171345810897170580298514342212702044160000,
   2963207084510649045286018310167447234674298533370689786740736000000};

Treize[4, 36, 13, 4] =
  {998864498525144895549294049973726738668251426564476083088916480000,
   2895102419394403650285047066036572334954243293522149410938552320000};

Treize[4, 35, 13, 4] =
  {949955744808838537320122455275007325781791556388121630799298560000,
   2863501709155687673316353441295272389925623067856397293815070720000};

Treize[4, 34, 13, 4] =
  {877553887721947659844330985425628555760603979706553402749091840000,
   2779162028055556373914898691432026228477226078260141935778856960000};

Treize[4, 33, 13, 4] =
  {826290709289877259391321425827717000460822981466948046296186880000,
   2723432505327702822767316731482654024171808437648188942990704640000};

Treize[4, 32, 13, 4] =
  {758504628082137303023688210728948891304332606754551869225304064000,
   2631731867326496358116080788618899002141348099129501774013005824000};

Treize[4, 31, 13, 4] =
  {705487034161209818714549757367062583555507337606289810662621184000,
   2554009408426065336373582016094415682325628053267723449253494784000};

Treize[4, 30, 13, 4] =
  {638463591080383335874588409827373111904710341190159660790841344000,
   2444346535218825293149931753999333240959562036409720668040462336000};

Treize[4, 29, 13, 4] =
  {585092499731045825698346478820867000442760263750539811449995264000,
   2348349014304934747861237584323843598244829951700611116075843584000};

Treize[4, 28, 13, 4] =
  {555253366048629039352845197495467305177748547140543585091321856000,
   2293761552370873832813148526593437933998808112600503342182957056000};

Treize[4, 27, 13, 4] =
  {522815434732213903892827137072888401489645386180437483206580633600,
   2226496515820001914413378835285462877390351134896910042895745024000};

Treize[4, 26, 13, 4] =
  {493305460893120163860392979552065102905025775372684801712167321600,
   2163165916026434419033166064011644593684414291307147120315308441600};

Treize[4, 25, 13, 4] =
  {460820420833549480965214160385263191920650818088657422899373670400,
   2086221397019950120768975385748259295435569323186756982804788019200};

Treize[4, 24, 13, 4] =
  {430626675244510687009979358104412330598492413462037606638708326400,
   2011048215985107540824244866420767736867652621998298059437296844800};

Treize[4, 23, 13, 4] =
  {400947691313704593289054806250493868276557197840108462879329484800,
   1932745795274592274083842712616108325333911980969966411957927936000};

Treize[4, 22, 13, 4] =
  {373959807281619086707688812094622763144274653397293142697647800320,
   1858125822802169011425661903314907634345404982915931682265251184640};

Treize[4, 21, 13, 4] =
  {347518387658641887826378602775794139884557189285585717455277260800,
   1781105349266337778354300656915497285166982469010747575622350929920};

Treize[4, 20, 13, 4] =
  {324197462037637769215524760903120781577461685071322661311322521600,
   1709815576950739047266065077447148928103422414787677504898670264320};

Treize[4, 19, 13, 4] =
  {301172391680338797112829086851930076714899257159994953415304151040,
   1636341038299861046930966764679516276614480442415683800961321533440};

Treize[4, 18, 13, 4] =
  {280859330947716323494581595382150877049624278323989193064689172480,
   1567983901011103219130075856232008536344554265884066154807296000000};

Treize[4, 17, 13, 4] =
  {261543787744232789947467870051029614213129294817743176223464357888,
   1500318669795225156991616246936094823432331373745728388632252776448};

Treize[4, 16, 13, 4] =
  {244376614418146152690466876844067700422638321599051725444351000576,
   1436933157191966950622746912372814591847883905335665464484571381760};

Treize[4, 15, 13, 4] =
  {228289704423602016948676639940693313723489569855657678970927710208,
   1375204314337297002266320099842812829208224129182474513755813183488};

Treize[4, 14, 13, 4] =
  {213110856458714628795884858644329921840126199692712616467145687040,
   1314818273193006942183412260866685215556849487679212199267121758208};

Treize[4, 13, 13, 4] =
  {198787639439845504473155623598266773291369438843172685468821094400,
   1255915359301136661951204598514121629260173052092924280689905369088};

Treize[4, 12, 13, 4] =
  {199783225479572995627729806750016400133568452427197646651030241280,
   1293905810689153514918035468860398615116349240950518512326621003776};

Treize[4, 11, 13, 4] =
  {200850070759256712157345755634752299070047434972464460152566710272,
   1332581142302441967163868065155212389861845996009499717284554342400};

Treize[4, 10, 13, 4] =
  {202004274845511111581980724213449950183575148546938300710288097280,
   1371931771049807536976801544758843251612265904666978894460653404160};

Treize[4, 9, 13, 4] =
  {203244999138975096514743308299556625618499775643018254325959884800,
   1412095137125215239894639056445268022140474168157924739048045281280};

Treize[4, 8, 13, 4] =
  {204628698696841311608602326795235600674864130639529483396186112000,
   1453265859825049620913560765550758012383356808146374369389366476800};

Treize[4, 7, 13, 4] =
  {206208129467679901687728158165172607924340178758839083041449574400,
   1495826800766481661379806857189451137357440337073116600616982937600};

Treize[4, 6, 13, 4] =
  {207896481995683455273202026871736225877365835756635675539223347200,
   1539465249326143655786940202257334862508759221873267831432282112000};

Treize[4, 5, 13, 4] =
  {209852011730391910421649632452324191590298252837881691969284997120,
   1584980603925126177936171970745618099045038739154936057637424332800};

Treize[4, 4, 13, 4] =
  {211984617993374896228658559282418781820933152361274811870210949120,
   1632111905310570962916149639886017972757159410882121566939246493696};

Treize[4, 3, 13, 4] =
  {214541251723297234845925009761071630843831041848601820402911543296,
   1683025591908551357870906981029136755639991645815021808401231380480};

Treize[4, 2, 13, 4] =
  {217266877323899295228758288413950931872673744999361847496550645760,
   1735858220215759424645639703852527962705544204777282396642365931520};

Treize[4, 1, 13, 4] =
  {220247158260379095061845506305322509915006163034131455405939752960,
   1791147481191552037895415819114251185158304535233073740928180551680};

Treize[4, 0, 13, 4] =
  {223473723442053109424136284148456682879787760968655450204914319360,
   1849031014964866115682506915816560790471279011513874297777113006080};

Treize[3, 52, 13, 4] =
  {36445107952209429920018444222468209099830858329414858440704000000000,
   0};

Treize[3, 51, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2214594640359523443808416003709788977267656900965138274713600000000};

Treize[3, 50, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2388292866645252431413069388897311876020923694270034791628800000000};

Treize[3, 49, 13, 4] =
  {2211115661987206994568595811604410085648687696128330484940800000000,
   2551554157814032071298262197768698099917282873064507939225600000000};

Treize[3, 48, 13, 4] =
  {2211258102935084107449758643966323988497077371288531920486400000000,
   2724970025006313083609167629301137342362113409720818178457600000000};

Treize[3, 47, 13, 4] =
  {2174464480165030502686230069560931286617360455436405603041280000000,
   2821374240830196028190114182029386973356050471063731170181120000000};

Treize[3, 46, 13, 4] =
  {2208183707932853995593855257451568467222465491402316715130880000000,
   3055410543226945561283697826945940771027117276103501655572480000000};

Treize[3, 45, 13, 4] =
  {2177394112273345467072286282391098932178963538367630047969280000000,
   3164174931308158388200549436597251097425791741145631718113280000000};

Treize[3, 44, 13, 4] =
  {2205740665731624962399465979270513018750054183009075068928000000000,
   3387457714682798561529703901965375048542510718244700448358400000000};

Treize[3, 43, 13, 4] =
  {2180874019324828652671159799448679335241216336002013860986880000000,
   3508994382323277708508673622346455049179292100820851490816000000000};

Treize[3, 42, 13, 4] =
  {2203774166003346585404173164308739207249630876227653802655744000000,
   3720834694442404939728440657450270699589067169828058565705728000000};

Treize[3, 41, 13, 4] =
  {1196931728732463580436655956221010907139158952380355093463040000000,
   2861888967501563333189820554453189584952212908646784462487552000000};

Treize[3, 40, 13, 4] =
  {1218051884490093881662776211503209545302305373989989741756416000000,
   2995924804125196366621458945981511571766195151112260647124992000000};

Treize[3, 39, 13, 4] =
  {1200171064943049093930011884338277814941655335949756037857280000000,
   3055013301384574563951433605634301018862333328357486969749504000000};

Treize[3, 38, 13, 4] =
  {1217078053234747148226740005494524598543617284027028638531584000000,
   3179998403712685233788633984283030381451175322115506972917760000000};

Treize[3, 37, 13, 4] =
  {1141522153330696365520121848647056847592905062787818710892544000000,
   3125194981789272454082006674175355489009657801802588041699655680000};

Treize[3, 36, 13, 4] =
  {1093255107759299743835575198408347596426883803152774307166289920000,
   3110034924898405811294639060630975766173052920019837747336314880000};

Treize[3, 35, 13, 4] =
  {1019336492337866854008440041503004364008393996878834559164088320000,
   3038276857759059307228124227334190576403563313197132512577454080000};

Treize[3, 34, 13, 4] =
  {970333843842094858737842975802420494374413863052423480276418560000,
   3003845775908226266606315114958374566597476342564785027756851200000};

Treize[3, 33, 13, 4] =
  {900148029178621371268617362036720224074380514426307303692042240000,
   2922230868286891802351285596712005297411452336587120007897415680000};

Treize[3, 32, 13, 4] =
  {848841821567492348727878283962585246893271071646869852444950528000,
   2864227161839467847661352883622935346837852565374783561834430464000};

Treize[3, 31, 13, 4] =
  {780999005571901295229776043725045210736233522031725036288606208000,
   2768952401609269580124732789502139925851278072812717746102992896000};

Treize[3, 30, 13, 4] =
  {728060580294739619023883004559669160743898117654895853270204416000,
   2689287668989061785219452475276651547324486444793552420370120704000};

Treize[3, 29, 13, 4] =
  {660903556342222230699494725692253117304745686030037979509030912000,
   2575816420538714922705241739260710938499228888386027231171837952000};

Treize[3, 28, 13, 4] =
  {607482255551402594583770941957224162995829231432520199571505152000,
   2477302208823261108515416073426219252532115419733321145527566336000};

Treize[3, 27, 13, 4] =
  {574836273620630578361808813139235952330694272547398368126356684800,
   2413958865334475439219640333184997083709803261371437803493339955200};

Treize[3, 26, 13, 4] =
  {540609198499773715020699758478644749911105955790617683479337369600,
   2340193341536754413046413888743662444455166964421916721709423001600};

Treize[3, 25, 13, 4] =
  {508305639918345522176438566398767596617172222516351672906678272000,
   2267375674270250246029095937223656492600467589675034072271814656000};

Treize[3, 24, 13, 4] =
  {474022939392912063217060443543913085329944506316300596283860582400,
   2183250796414026775571062493651465154505293071431449376196237721600};

Treize[3, 23, 13, 4] =
  {443318755470516849829366302395805416988911697928158478713067929600,
   2104683455469541003696365626370136809745665389136219407172344217600};

Treize[3, 22, 13, 4] =
  {413052044354125270320647398256522532202572677232024534187927142400,
   2022641524168944870590293750062560977244378028926408389237659402240};

Treize[3, 21, 13, 4] =
  {385586071448519833278137483709464226140186450285775353038283735040,
   1944835823484356441769348332181351940184897025386441425580300697600};

Treize[3, 20, 13, 4] =
  {358570154113797632667233993172921912571879616913953129955600629760,
   1864238816867247286313273906971956482083529029230967979594282434560};

Treize[3, 19, 13, 4] =
  {334599149431365400463959600439069376361513460416769771119312896000,
   1789206791211951766378699519701254250761280491199414318944999178240};

Treize[3, 18, 13, 4] =
  {310971662581932234039772952379093164203115613641919916219501117440,
   1712105380000636595299852221043710080414376623404739439502892728320};

Treize[3, 17, 13, 4] =
  {290020798722675368646360515100816139040850463881011428915415089152,
   1640092779684702358095102201588234058095782673652904793964026003456};

Treize[3, 16, 13, 4] =
  {270060062809450443643483559450686479438205207093164598559546277888,
   1568712034637894312778434083677327464739812633885215245844246167552};

Treize[3, 15, 13, 4] =
  {252292596651259081645789014284312915997398831614223833046452273152,
   1501857389920888574786007108106668453438080202306667036792552685568};

Treize[3, 14, 13, 4] =
  {235574532424679538430079449833863583477020580734316321588557905920,
   1436528849468702350592700510131354815544733551139385591002109575168};

Treize[3, 13, 13, 4] =
  {219883746817897819947145164963474174765458275526004173475969761280,
   1372977545295853528911852021085224269825694374303642668507550711808};

Treize[3, 12, 13, 4] =
  {221164480111652368581068570208071890910307654728641471559069859840,
   1415742674010231740851195360732750562449388524093625334529844576256};

Treize[3, 11, 13, 4] =
  {222435111518733835535153178273052108669984375010779758984368750592,
   1458835348049602116486011358468763146313100917357599552970696949760};

Treize[3, 10, 13, 4] =
  {223804509918855057576933031724660637644259788268321134707872890880,
   1502828490278203764966412792424645352314399682382870759249973084160};

Treize[3, 9, 13, 4] =
  {225272876602846632097172236987674816519816316477612562558484480000,
   1547657303269124416508743434836942568953285896795708029937574215680};

Treize[3, 8, 13, 4] =
  {226848299118790329980247125657915308693872608062046974561065369600,
   1593517570284209590666731592217163960472805418364684446621656678400};

Treize[3, 7, 13, 4] =
  {228576993932385507496732161806931697814135782422069523134598348800,
   1640565502704996320804027346387675064496414233560824617779383500800};

Treize[3, 6, 13, 4] =
  {230528019199440474933347414064577960958808535771890447739256832000,
   1689283439097703819571294629253479097323308256929888222499464806400};

Treize[3, 5, 13, 4] =
  {232625073400803150504804386490093839238305396273848196941637222400,
   1739412515261225171715528473889105545048665711749346151836837478400};

Treize[3, 4, 13, 4] =
  {235026749425343037954814936266340414829318086962990124821192376320,
   1791783701333962210589572807858557212167019286294070898029127270400};

Treize[3, 3, 13, 4] =
  {237651152370603280689139114697680109958266012260726174725879889920,
   1846195601200700800086735764897070342784736707244140820345804292096};

Treize[3, 2, 13, 4] =
  {240716069328952960074644166743449668692942184757604237471693930496,
   1904658977380499869599275190627125790779303527224908911756160532480};

Treize[3, 1, 13, 4] =
  {243998893789802874147550747377274183515591166692583508879584788480,
   1965528584701291100680460408229838139191597788967594433348496261120};

Treize[3, 0, 13, 4] =
  {247605589509298649028661048818052365618547806107744560144963338240,
   2029481123463100046459407895141398537760245320486975641342957322240};

Treize[2, 52, 13, 4] =
  {33686065621040994913181505308567288344974102625099664326656000000000,
   0};

Treize[2, 51, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2214594640359523443808416003709788977267656900965138274713600000000};

Treize[2, 50, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2388292866645252431413069388897311876020923694270034791628800000000};

Treize[2, 49, 13, 4] =
  {2211115661987206994568595811604410085648687696128330484940800000000,
   2551554157814032071298262197768698099917282873064507939225600000000};

Treize[2, 48, 13, 4] =
  {2174449717363111468604521263414826642642872716533833714892800000000,
   2651353253862367805918692868198142650653704100211421767270400000000};

Treize[2, 47, 13, 4] =
  {2208207923552121883675379311880060519456001778243392598179840000000,
   2882861614340342353850563766137706369425735467229489114644480000000};

Treize[2, 46, 13, 4] =
  {2177253220004937177242347467084369530076676796362318361395200000000,
   2993414762546551347036291371223227487153887972815427831070720000000};

Treize[2, 45, 13, 4] =
  {2207094703957654577871192631838513910642012899746484626391040000000,
   3219047119468372198425921640167671402904210487797491328614400000000};

Treize[2, 44, 13, 4] =
  {2179854667084082382073245462766432636059897343633655479664640000000,
   3335861093379012848447627748704725176603856458614276483973120000000};

Treize[2, 43, 13, 4] =
  {2203497211114096171649444847990293576092066366138443890688000000000,
   3547675007172464951368087100565111855459173444763917400145920000000};

Treize[2, 42, 13, 4] =
  {2182836735805405648933318224699309294791567074289111726555136000000,
   3679373656741304306366244048452668899990388230025944024219648000000};

Treize[2, 41, 13, 4] =
  {2201888894283796953322058007747203819165545362019749791268864000000,
   3881930042182711048814733077341719472884249769801023328616448000000};

Treize[2, 40, 13, 4] =
  {1274622696552438120749298755351823094846674608691015283900416000000,
   3107673004705601274711083101725383369281994608789217146306560000000};

Treize[2, 39, 13, 4] =
  {1292437285259463430652747534109074722342612159141766970212352000000,
   3239787656484811432265762929328489414697000369874712339152896000000};

Treize[2, 38, 13, 4] =
  {1277469019000890122880879102107243304159025425536543090540544000000,
   3311726970532286887111016792770893937640610780704393794682880000000};

Treize[2, 37, 13, 4] =
  {1229628831976769300894274744083145567685403930202912339221544960000,
   3312050538732366596032436557259009244724684229831468670517248000000};

Treize[2, 36, 13, 4] =
  {1156508273371431403194716207457848771411333466831651802668072960000,
   3259103712773851754338531737414536635580861217125166836581662720000};

Treize[2, 35, 13, 4] =
  {1106207414355423742179708402078049517449081613238947424208158720000,
   3235520501478958674584731116290325333656203246918264660804239360000};

Treize[2, 34, 13, 4] =
  {1036429216484495810403412383809339590336850092710427945882091520000,
   3170947897155309221504914950108800057583624824832184158466867200000};

Treize[2, 33, 13, 4] =
  {985734135318691638618224527353304523153765377179999721582755840000,
   3129558556181457182540234515831917739907010904841176310580510720000};

Treize[2, 32, 13, 4] =
  {917099572748080719862081740891907809910957084819781239418388480000,
   3048088625702851928014941316390543370139408918763918703600861184000};

Treize[2, 31, 13, 4] =
  {864237969627882686057396591473037162643662316674338608396632064000,
   2983143791743985535515620678587050622951863358996766591826264064000};

Treize[2, 30, 13, 4] =
  {797695798554176503063723084339531099818923059337833141745221632000,
   2887462366044616835012870635813880689026614033949643273937092608000};

Treize[2, 29, 13, 4] =
  {743564955007143249811547283246282325892831082215430065039081472000,
   2801864531203244828290959410975108216597056089170604265297674240000};

Treize[2, 28, 13, 4] =
  {677512014917134612626501651956090999745756954373091316618756096000,
   2687525697740541554863465490484602578888886821967661332567162880000};

Treize[2, 27, 13, 4] =
  {623084340142348162415408171965174121879660342295288528939830476800,
   2583544902232546434047696340711688373851457685887779019138531328000};

Treize[2, 26, 13, 4] =
  {588722077707167769014151027171939978962406249252533758117439078400,
   2513626182300398698155931073116123789248629347184559790267721318400};

Treize[2, 25, 13, 4] =
  {552024645202243748093548854587609247026161423315424510300966092800,
   2431044883909005642454189818933452597823884048207939477731226419200};

Treize[2, 24, 13, 4] =
  {517946630901421220811952307149030092745235057768210771355264614400,
   2350875973877593127977462669571158960175716879143787909144274534400};

Treize[2, 23, 13, 4] =
  {483446595326282697141713748315948757862047427583001291610338099200,
   2263997303590164905520068148989777648095812190299728217406596710400};

Treize[2, 22, 13, 4] =
  {452272140190789604970394679016105736612514798958444919706961838080,
   2181867505169855055341184961470005076707832876314142910612619919360};

Treize[2, 21, 13, 4] =
  {421756163405396355832232141558068448465069185473881101803517378560,
   2097156447804515296146689370761203232484086644532067655292886712320};

Treize[2, 20, 13, 4] =
  {393717503530873514226272267084780919431071647021849721928857681920,
   2015538539352152239550028789732990980950717223270136293187901194240};

Treize[2, 19, 13, 4] =
  {366352831390875119163274611553365259222861239355209221994341990400,
   1931983084525532231596737523077112936338033081364687387991432232960};

Treize[2, 18, 13, 4] =
  {341834798932484916160512515167590721346165914913425596343501455360,
   1853365853396056077489220696838028611058901758802321043760768614400};

Treize[2, 17, 13, 4] =
  {317848595383470698306189705690953331744655416458822606568546107392,
   1773385400390153964728365596447213364483157991128195396655403499520};

Treize[2, 16, 13, 4] =
  {296373855082735088197415000490248906726243704625592117934682013696,
   1697975361146643674463816311436653061326184008406647767341956333568};

Treize[2, 15, 13, 4] =
  {276036308487002304849402648361423469166207307720546170917930139648,
   1623776660084813205716296603645991210471384278785891619873801371648};

Treize[2, 14, 13, 4] =
  {257760931358504863685323297727538702486576719223397613274969145344,
   1553690771065927405247093553614621640755790648446595380005073584128};

Treize[2, 13, 13, 4] =
  {240652561146728895783110431064415222904221897219135475698181865472,
   1485594483068827342586889662029812910923611316667957896406313730048};

Treize[2, 12, 13, 4] =
  {242240750154160167824631611879829708692487462561749451155869532160,
   1532973037859157879960689726060370949886566267996772265534230102016};

Treize[2, 11, 13, 4] =
  {243800719496701818008517524502067016012411035212262414588682698752,
   1580850414832929259227993747504659826221133687221204700815519907840};

Treize[2, 10, 13, 4] =
  {245367637261967837640676045806688197861793800673555145525349580800,
   1629222343085952635831076186275640776887907857915513118742879928320};

Treize[2, 9, 13, 4] =
  {247058038121485968265490045712781230349008777781330327295439667200,
   1678707188438063415872842494488560688256685933482365834931921223680};

Treize[2, 8, 13, 4] =
  {248857770771630011001088248516907091976567409638768501098073292800,
   1729205582261129534483527881048244606772562630099003121177775308800};

Treize[2, 7, 13, 4] =
  {250786762125164030390394312897921148515203879547111315989751398400,
   1780964091307661217247908067240806903542103207779652832279815782400};

Treize[2, 6, 13, 4] =
  {252896451273860904143436813020912320629862484876974390142985830400,
   1834202736210259692755222384290344023231689130016722005490506137600};

Treize[2, 5, 13, 4] =
  {255264016146627156300007746718966746030438608920006099534558003200,
   1889440268798082718914912467901946756882945412058294922322431180800};

Treize[2, 4, 13, 4] =
  {257818638520051619217048138728609643147697112483544068987132313600,
   1946476436995804151532703155650159222424529822073298315135418368000};

Treize[2, 3, 13, 4] =
  {260723895854801744306777196987531692562128557174367701109644984320,
   2006181589322573505941044212946438067069042553452136199171866624000};

Treize[2, 2, 13, 4] =
  {263908120048537849656646619324163242282264676447918356756661534720,
   2068444947087266690638478086020024887497497451046056762532582916096};

Treize[2, 1, 13, 4] =
  {267547097542933416759685448073365693341509242767457317284212637696,
   2135045412529427722361179653265732100053710471274210110455918100480};

Treize[2, 0, 13, 4] =
  {271474475351154689762383344060865523825412430534468828542774804480,
   2204692576079471744612835379682473308138533095518814706820521656320};

Treize[1, 52, 13, 4] =
  {31139851063935843825924927426095117001645514875028163788800000000000,
   0};

Treize[1, 51, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2214594640359523443808416003709788977267656900965138274713600000000};

Treize[1, 50, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2388292866645252431413069388897311876020923694270034791628800000000};

Treize[1, 49, 13, 4] =
  {2171112339004570048756337999981780270742845488966621829529600000000,
   2471547511848758179673746574523438470105598458741090628403200000000};

Treize[1, 48, 13, 4] =
  {2211115876572515532598930906010502590681172168107819532288000000000,
   2718153471097278745122643553291408210811122695364660114227200000000};

Treize[1, 47, 13, 4] =
  {2176202577927445355068703210840994715872681596707322273464320000000,
   2820302383613598463991076759837157060478878176075297954201600000000};

Treize[1, 46, 13, 4] =
  {2208190534429764426969692465695400535413190138851610706575360000000,
   3049439341549018177322326306933412265082422154035430686720000000000};

Treize[1, 45, 13, 4] =
  {2177286104770125918861070627463615083278384709758124063457280000000,
   3157854665004004944177796492230579816899125421457422973665280000000};

Treize[1, 44, 13, 4] =
  {2206973471668850121619227010676901453029315441039434391224320000000,
   3385146425263962545672345347994337890224882496562458630553600000000};

Treize[1, 43, 13, 4] =
  {2179842959843697248275789441674853812627515983032131015147520000000,
   3500281833983791982743888889832304200009679934548079668101120000000};

Treize[1, 42, 13, 4] =
  {2203601566655601507772245298620042384005209148646002465439744000000,
   3714349982498891854166723868196836910079436922093255910227968000000};

Treize[1, 41, 13, 4] =
  {2182767030158699230133405746685409266065538578697414491766784000000,
   3843846698969916014585804962203913601993544305252519638990848000000};

Treize[1, 40, 13, 4] =
  {2201866902301405644835524560459923298738899157297614169309184000000,
   4047979769384845149863079165489448565184154876577212979478528000000};

Treize[1, 39, 13, 4] =
  {1344699825576963790231731608661138852904289331871632246964224000000,
   3342753773608624269859933962096861170994014723102073667190784000000};

Treize[1, 38, 13, 4] =
  {1362356831438773006717967271800022443235613564637898212376576000000,
   3481104044081634844303896772554110679502196606805250613968896000000};

Treize[1, 37, 13, 4] =
  {1285374386052329948129290127492362397077926773375156084287733760000,
   3433287694982867003087271884362248754304941474028137207981670400000};

Treize[1, 36, 13, 4] =
  {1237601096179229782782085594916818357792572548628517465872138240000,
   3430502567257400483390534173921755307496370994641888692309852160000};

Treize[1, 35, 13, 4] =
  {1166859087385173258582930446492859923547588514611422311533772800000,
   3379535217431947684482518170965881503221200228404566544298803200000};

Treize[1, 34, 13, 4] =
  {1116590468740400236693109338685629506692883433133962263244308480000,
   3353078237302398783004811336662179715548303579994321945425346560000};

Treize[1, 33, 13, 4] =
  {1046734900784978415261172700588244999238060811609465782869688320000,
   3283795362453066837521864967598011132964169381397511838713774080000};

Treize[1, 32, 13, 4] =
  {995942423589971232992315940201477999342644301629770893398900736000,
   3238994023809394807746851533462452078574388175069686464902070272000};

Treize[1, 31, 13, 4] =
  {927336840398632761542251469905468990306431767423158186967826432000,
   3153240839965957257398121412269724896525707241265653190848675840000};

Treize[1, 30, 13, 4] =
  {874534208497881839267322651214211440201128909094496179989774336000,
   3085341770832658662614768024048307223460651558938796450679619584000};

Treize[1, 29, 13, 4] =
  {807932460895310327839751156442041147011609201307316264124809216000,
   2985232363463369238880863608144558001392433467606592615729856512000};

Treize[1, 28, 13, 4] =
  {753805971460263687845936073093918951452805970691965604516069376000,
   2896326614768391781949367211089998844318067050455536212973191168000};

Treize[1, 27, 13, 4] =
  {687798529117552758127291186349730151127802495848696847529515417600,
   2777996516679594655947129319183458864604357712978648267479213670400};

Treize[1, 26, 13, 4] =
  {633318702078401711572553005406895461788801425473775897760550092800,
   2670503448556251799377706689875846213549963564500221909523444531200};

Treize[1, 25, 13, 4] =
  {596539922426642641075279673270258695011239176310048130619932672000,
   2591642234329741293338460317072028774475125681572768478196767129600};

Treize[1, 24, 13, 4] =
  {558383024914679588957090736178781535237813160796068408862756044800,
   2502408209352060507411229353252334767876426241139168852223983616000};

Treize[1, 23, 13, 4] =
  {524108599962536509929678053701065382640318857786298957393244979200,
   2419337091151286622284672691176835958282567945920357003535633612800};

Treize[1, 22, 13, 4] =
  {489403666209175741753696467033699351872121307158815373640838676480,
   2329464075420307244833562303197054762843720939906928940363420794880};

Treize[1, 21, 13, 4] =
  {457965514380587716786962661708622626560895352085482575006783242240,
   2244345692553654898866443001099948769730509477357567890329016729600};

Treize[1, 20, 13, 4] =
  {427126381866028750351644971900592228960075529050195391475928268800,
   2156415338877074158631057387664367542979999209338972095539880919040};

Treize[1, 19, 13, 4] =
  {398808309880199733630747111253118517504542022355786462365965352960,
   2071876268706559427746922526134433616518769352177005261391155691520};

Treize[1, 18, 13, 4] =
  {371181213773567831702249531870111333508056689717540263202400501760,
   1985492800812991260718189370778044925537071632468731605316859330560};

Treize[1, 17, 13, 4] =
  {346358396011100108323552131283745343461564149896742768145162305536,
   1904052838938886212750002130092700986094342596263686594571278483456};

Treize[1, 16, 13, 4] =
  {322090067204691752444000949351838661339496656252210703855695953920,
   1821316857408328046443957143043351637433422493737590133979617427456};

Treize[1, 15, 13, 4] =
  {300346652993366597598704165074400249295894655928624098591515869184,
   1743359431099281103174516626925023762008521822037226479825568399360};

Treize[1, 14, 13, 4] =
  {279706757628502095756584351024596123413605375903156350308336009216,
   1666526265725570802648424611825497384415160539583940676347014152192};

Treize[1, 13, 13, 4] =
  {261152032317508232709967205870371410340805994016288753001655435264,
   1593996430767774349505930654059262207013096864420593365091214163968};

Treize[1, 12, 13, 4] =
  {262985974639091894081393414354485193657039704874784165452838862848,
   1645787244452599275753286655232890580678918835810489874488435408896};

Treize[1, 11, 13, 4] =
  {264842022319761020701478761107906308892405509852226660586217275392,
   1698223241926505265815043439854941248114196599706620516473325486080};

Treize[1, 10, 13, 4] =
  {266700412169889567508133485291769218471148897595802897460295106560,
   1751375981363519941628192927781968190604003855835385916704581222400};

Treize[1, 9, 13, 4] =
  {268582968994450700554857605183453537609152438348844310854966968320,
   1805201969221949033912209739321590680508738483414302370541328138240};

Treize[1, 8, 13, 4] =
  {270606339620260024600460615061066788258447488300714380228978278400,
   1860349045278909622277686598451602692077600509828687272106105241600};

Treize[1, 7, 13, 4] =
  {272769630288611542691659264033999470171930860332757205284133273600,
   1916773374642154791275291584419014561490691567703516458578975129600};

Treize[1, 6, 13, 4] =
  {275091109374584948861387234744273141943008215051185666904188518400,
   1974757918015529566548218726214631832531082068893687983087865036800};

Treize[1, 5, 13, 4] =
  {277625797771028831086165555531735150501117642911623863459853107200,
   2034548544659296479223076151070797123543958115434465011555945676800};

Treize[1, 4, 13, 4] =
  {280457202481013418073374142427338935881788967502891332055072768000,
   2096713806954153421766554267362058619888384451703887718806611558400};

Treize[1, 3, 13, 4] =
  {283525302427588892780163100616771500363396641167606824068081254400,
   2161125914483628062033150048493734395644498699407711346306632908800};

Treize[1, 2, 13, 4] =
  {287003425581650476699197007655462742320680495653129421166078853120,
   2228743217803970106448558325833138084406731094016970669386891264000};

Treize[1, 1, 13, 4] =
  {290814799182303269051969448570553711552796197996180429573875302400,
   2299457326857082045629105269196316027854892606736904592002065104896};

Treize[1, 0, 13, 4] =
  {295114206341628177931843939428810828164423316638502912570005913600,
   2374930927688609293218676736864370388155078003921889638036484915200};

Treize[0, 52, 13, 4] =
  {28789730324673804769509408048227256704479539712546797571276800000000,
   0};

Treize[0, 51, 13, 4] =
  {2214594640359523443808416003709788977267656900965138274713600000000,
   2214594640359523443808416003709788977267656900965138274713600000000};

Treize[0, 50, 13, 4] =
  {2171112339004570048756337999981780270742845488966621829529600000000,
   2301328263935345641308913381441294462971300870273001901260800000000};

Treize[0, 49, 13, 4] =
  {2212860079472367439634180305246326970170475947008315306803200000000,
   2549829453524880508015375294483690970244709216030846825267200000000};

Treize[0, 48, 13, 4] =
  {2174626855251006595916644412263505585767405596692624651059200000000,
   2645388945150378180480205838512020950643161033472861850828800000000};

Treize[0, 47, 13, 4] =
  {2207917537833137576532037018562917602708904460830754010562560000000,
   2875465570182733015870860231205799281624648196171190616719360000000};

Treize[0, 46, 13, 4] =
  {2178979453560632410369221454060627559092252034900738640445440000000,
   2992180657956265080285805379711547814940423726391985648435200000000};

Treize[0, 45, 13, 4] =
  {2205652451929943084543579654747118042560438986613724492595200000000,
   3208604977283084325296264295614161051332069829386319838576640000000};

Treize[0, 44, 13, 4] =
  {2179742187871834334149656508395334826678237757695081463152640000000,
   3329009703156252895663456359514696839510094043679315418152960000000};

Treize[0, 43, 13, 4] =
  {2204611402242154453979915345579340068453423530423134569103360000000,
   3544504321141116491019761978284364343594476127890479282913280000000};

Treize[0, 42, 13, 4] =
  {2181996264168572827239089230753419769084421020142013958324224000000,
   3670813897344399800712449245194104775231519692559235650945024000000};

Treize[0, 41, 13, 4] =
  {2201726096448637247591884444785725745234076513162280193490944000000,
   3874999743383915693495007238754485719478294504145051625455616000000};

Treize[0, 40, 13, 4] =
  {2184402818691287302386118428426087512963130622734339969908736000000,
   4012923161832282977110395123953989085718597414743874528608256000000};

Treize[0, 39, 13, 4] =
  {2200370940599138716784220733661589636490521302004977079681024000000,
   4209673853572529211432163701058225053791014525556023514628096000000};

Treize[0, 38, 13, 4] =
  {1410635003466157749230671001396104064801196773904568320786432000000,
   3575870788394215393091237689125302840684915476562169493979136000000};

Treize[0, 37, 13, 4] =
  {1363494678403396056539003537678067017401790344943641400746967040000,
   3588541890268706198505181976879290648277897713855151579930296320000};

Treize[0, 36, 13, 4] =
  {1291557708412865881799152735558453263997186161073567199290982400000,
   3549511210731558233263643382632472727110533242347001657342033920000};

Treize[0, 35, 13, 4] =
  {1241552734862972054755576828421251257794122394527267688420474880000,
   3537281937787580003942014527758997654663464481980055131479080960000};

Treize[0, 34, 13, 4] =
  {1172575725019364370409793740051963535540756336127558096267509760000,
   3486009786804602497586047726535010367541360469102009609061662720000};

Treize[0, 33, 13, 4] =
  {1120743367569463750812392072743888918787218149116703186836520960000,
   3452112551205361758126303074603188739984741419425271641727303680000};

Treize[0, 32, 13, 4] =
  {1052386577351745573798428341309575973773876730337110343263715328000,
   3381916413623881515087706050124863971484429841355105194135781376000};

Treize[0, 31, 13, 4] =
  {1000130463907099982708986893726183248331749355062149975747067904000,
   3329696341441036840921609046918976129424343299839831697319264256000};

Treize[0, 30, 13, 4] =
  {932891359036671493972289446139725146487235024830772870224281600000,
   3242878320073020848708965930272143014754049029886271740501295104000};

Treize[0, 29, 13, 4] =
  {878883135975649928777941983833617279176144318310439115433181184000,
   3168177441167150833963013934817951925090313865639260937651224576000};

Treize[0, 28, 13, 4] =
  {813327235909416476366879056065716736658845645300379582772281344000,
   3066147292274243578082522468519927303435755550479590289884315648000};

Treize[0, 27, 13, 4] =
  {758257988311106170532785537199777225927504258382218782973519462400,
   2971116812384771940360201621523272823082503003567939492524746342400};

Treize[0, 26, 13, 4] =
  {693149957321778980259801044162089537144889148304609373342977228800,
   2850565397707271881819810728267851439535416193699726219977896755200};

Treize[0, 25, 13, 4] =
  {637794962598036580840818536878159883470582172591454585593266176000,
   2736992912539798312432054117185315659996710599086342637810509414400};

Treize[0, 24, 13, 4] =
  {599602756923732162514729735912022406603261673805572651267758489600,
   2651357031379610052104789146657835891898682795203485151123839385600};

Treize[0, 23, 13, 4] =
  {561536061763406020014340955601123753078751950597819018739344998400,
   2559846944176105226070856395448682564524066544339912422546892390400};

Treize[0, 22, 13, 4] =
  {526941279854695992340266724037188610130453998910759337852214968320,
   2473112967050159638385128356141795351014008263286303804089968885760};

Treize[0, 21, 13, 4] =
  {492274133731125543746886956976383517803777789523162897935876751360,
   2380976233085702019038066450934516120344753670940554268572081192960};

Treize[0, 20, 13, 4] =
  {460568320747051505199787938259605240201384536600919392879483289600,
   2292601504656817841780719192510237249315413397699829145374577131520};

Treize[0, 19, 13, 4] =
  {429680879055788827594785276636947040781038796194284789099082547200,
   2202303306129192776863594328586444950234129138281227254173815275520};

Treize[0, 18, 13, 4] =
  {401156862185204339441569609592832763892167113352860695749805998080,
   2114938641271061910741716805690737101028959332912546837375913820160};

Treize[0, 17, 13, 4] =
  {373473704440892328865383775200887041243095093491014971374922891264,
   2026362306873816602176814959335151042293223193227688711047392264192};

Treize[0, 16, 13, 4] =
  {348422410162072607769004818998913153713640760840963151668552138752,
   1942233624914871515923682799225613516752769415434643339943767703552};

Treize[0, 15, 13, 4] =
  {324108178609034651492885154741486272117940269746979482333171679232,
   1857541428415984378728931152136961642978575538216566851757135626240};

Treize[0, 14, 13, 4] =
  {302159781733502572490607946056942816711497780807229413458075189248,
   1777185848926298960363944266161969478850052722560151620623863382016};

Treize[0, 13, 13, 4] =
  {281429104718910592827454178463939092593141827742817692841353936896,
   1698449407336028322380510493358212374091631862031800048895532204032};

Treize[0, 12, 13, 4] =
  {283453011236467839158744671594988194900845700992222464815015133184,
   1754390499971680528119399107196219045044585379670226983074278670336};

Treize[0, 11, 13, 4] =
  {285554408217196748905593209089243826301159684291167804739991633920,
   1811228305011672916082413813810358019520232851864684086826358538240};

Treize[0, 10, 13, 4] =
  {287698329718378852011322524250536086115483295977206199001106350080,
   1868885077662918083028842289005011118584503745817437951157222768640};

Treize[0, 9, 13, 4] =
  {289870512518887501027037419725988699181955363547205216158498160640,
   1927469815026708139199530496925939862488918055281649460418843770880};

Treize[0, 8, 13, 4] =
  {292092437241172682128566651534370315080868129714038278306817638400,
   1986971357356877512633507487688411231665292508999488971615502336000};

Treize[0, 7, 13, 4] =
  {294479369032703117717247533260428656656382473906737058944752025600,
   2048027326770757155828268475665678824738322744462806990637655654400};

Treize[0, 6, 13, 4] =
  {297044486686428640267690828473336485405657995639895115510369484800,
   2110704456183437545376862417312908030402905010614928774805848064000};

Treize[0, 5, 13, 4] =
  {299795963124927379948418214749822837459152248591163844232373862400,
   2175250337091810752383148273970029494499720456080026275100701491200};

Treize[0, 4, 13, 4] =
  {302800728385018526618965455864193421435466738570624746625643315200,
   2241989390632971983533997603875196592839877459998621898767754854400};

Treize[0, 3, 13, 4] =
  {306153652457147683969608165429028116550668742416134527537643520000,
   2311560708605118768913736650523424548489405347665061468358836224000};

Treize[0, 2, 13, 4] =
  {309804725113904029360081551090021347245953625008081517728183091200,
   2383928412840693461682147441533749733171329654346155457556303052800};

Treize[0, 1, 13, 4] =
  {313921135586722226283468557245209021516167730493105809649985126400,
   2460047404830107781590524997880032796935987186009171000091161395200};

Treize[0, 0, 13, 4] =
  {318448647447170897960958660052935897583165432622329213204272513024,
   2539965705629880086915417210820035549717692269070107632907212292096};

Testing deck counting

Derangements.

SetDeck[13,1]

CountDecks[Deck[ranks,suits],Deck[ranks,0],Deck[ranks,suits]]
%/cards!//N

Frustration solitaire.

SetDeck[13,4]

CountDecks[Deck[ranks,suits],Deck[ranks,0],Deck[ranks,suits]]
%/cards!//N

No wins at treize.

SetDeck[13,4]

CountDecks[Deck[ranks,suits],Deck[ranks,0],Deck[ranks,1]]
%/cards!//N

Play treize

SetDeck[13,4]

Table[Treize[i,cards,ranks,suits]/cards!//N,{i,0,cards}]

12/13//N

Table[TreizeE[r,1],{r,2,7}]

SetDeck[13,4]
expect=TreizeE[ranks,suits];
N[expect]
expect[[1]]-1
N[%]