fork download
  1. #include <algorithm>
  2. #include <iterator>
  3. #include <iostream>
  4. #include <sstream>
  5. #include <string>
  6. #include <deque>
  7. #include <map>
  8.  
  9. using namespace std;
  10.  
  11. typedef unsigned long ulong;
  12.  
  13. struct BigInt
  14. {
  15. static const ulong base = 10000;
  16. static const ulong N = 4;
  17.  
  18. deque<ulong> digits;
  19.  
  20. BigInt();
  21. BigInt(string str);
  22. BigInt(ulong num);
  23.  
  24. BigInt & operator += (const BigInt & bi);
  25. BigInt & operator -= (const BigInt & bi);
  26. BigInt & operator *= (const BigInt & bi);
  27. BigInt & operator *= (ulong n);
  28. BigInt & operator <<= (ulong n);
  29.  
  30. BigInt operator + (const BigInt & bi) const;
  31. BigInt operator - (const BigInt & bi) const;
  32. BigInt operator * (const BigInt & bi) const;
  33. BigInt operator * (ulong n) const;
  34. BigInt operator << (ulong n) const;
  35.  
  36. bool operator == (const BigInt & other) const;
  37. bool operator == (ulong other) const;
  38.  
  39. void normalize();
  40. };
  41.  
  42. typedef const BigInt & BICR;
  43. typedef BigInt & BIR;
  44.  
  45. struct Add { ulong operator()(ulong a, ulong b) { return a + b; } };
  46.  
  47. struct Mul
  48. {
  49. ulong k;
  50.  
  51. Mul() {}
  52. Mul(ulong n) : k(n) {}
  53.  
  54. ulong operator()(ulong a) { return a * k; }
  55. };
  56.  
  57. struct Carry
  58. {
  59. ulong & carry;
  60.  
  61. Carry(ulong & c) : carry(c) {}
  62.  
  63. ulong operator()(ulong n)
  64. {
  65. n += carry;
  66. carry = n / BigInt::base;
  67. n %= BigInt::base;
  68.  
  69. return n;
  70. }
  71. };
  72.  
  73. template <class BaseOp>
  74. struct OpWithCarry : public BaseOp, public Carry
  75. {
  76. OpWithCarry(ulong & c) : Carry(c) {}
  77.  
  78. ulong operator()(ulong a) { return Carry::operator()(BaseOp::operator()(a)); }
  79. ulong operator()(ulong a, ulong b) { return Carry::operator()(BaseOp::operator()(a, b)); }
  80. };
  81.  
  82. struct Borrow
  83. {
  84. long & borrow;
  85.  
  86. Borrow(long & b) : borrow(b) {}
  87.  
  88. ulong operator()(long n)
  89. {
  90. n -= borrow; borrow = 0;
  91. while (n < 0) { n += BigInt::base; ++borrow; }
  92. return n;
  93. }
  94. };
  95.  
  96. struct SubWithBorrow
  97. {
  98. long & borrow;
  99.  
  100. SubWithBorrow(long & b) : borrow(b) {}
  101.  
  102. ulong operator()(long a, long b)
  103. {
  104. long n = b - a - borrow;
  105. borrow = 0;
  106. while (n < 0) { n += BigInt::base; ++borrow; }
  107. return n;
  108. }
  109. };
  110.  
  111. BigInt::BigInt() { digits.assign(1, 0); }
  112.  
  113. BigInt::BigInt(ulong num)
  114. {
  115. stringstream buffer;
  116. buffer << num;
  117. *this = BigInt(buffer.str());
  118. }
  119.  
  120. BigInt::BigInt(string str)
  121. {
  122. reverse(str.begin(), str.end());
  123.  
  124. while (str.size() % BigInt::N != 0)
  125. str.push_back('0');
  126.  
  127. reverse(str.begin(), str.end());
  128.  
  129. ulong pos = 0;
  130. ulong size = str.size();
  131.  
  132. while (pos != size)
  133. {
  134. stringstream buffer(str.substr(pos, BigInt::N));
  135. ulong digit;
  136. buffer >> digit;
  137. digits.push_back(digit);
  138.  
  139. pos += BigInt::N;
  140. }
  141.  
  142. reverse(digits.begin(), digits.end());
  143. }
  144.  
  145. BigInt & BigInt::operator += (BICR bi)
  146. {
  147. if (digits.size() < bi.digits.size())
  148. digits.resize(bi.digits.size());
  149.  
  150. ulong carry = 0;
  151. deque<ulong>::iterator it;
  152.  
  153. OpWithCarry<Add> add_wc(carry);
  154.  
  155. it = transform(bi.digits.begin(), bi.digits.end(),
  156. digits.begin(), digits.begin(), add_wc);
  157.  
  158. transform(it, digits.end(), it, Carry(carry));
  159.  
  160. if (carry) digits.push_back(carry);
  161.  
  162. return *this;
  163. }
  164.  
  165. BigInt & BigInt::operator -= (BICR bi)
  166. {
  167. long borrow = 0;
  168. deque<ulong>::iterator it;
  169.  
  170. it = transform(bi.digits.begin(), bi.digits.end(),
  171. digits.begin(), digits.begin(), SubWithBorrow(borrow));
  172.  
  173. transform(it, digits.end(), it, Borrow(borrow));
  174.  
  175. return *this;
  176. }
  177.  
  178. BigInt & BigInt::operator *= (ulong n)
  179. {
  180. ulong carry = 0;
  181.  
  182. OpWithCarry<Mul> mul_wc(carry);
  183. mul_wc.k = n;
  184.  
  185. transform(digits.begin(), digits.end(), digits.begin(), mul_wc);
  186.  
  187. while (carry) { digits.push_back(carry % BigInt::base); carry /= BigInt::base; }
  188.  
  189. return *this;
  190. }
  191.  
  192. BigInt & BigInt::operator *= (BICR bi)
  193. {
  194. const BigInt * max_op = this;
  195. const BigInt * min_op = &bi;
  196.  
  197. ulong max_size = max_op->digits.size();
  198. ulong min_size = min_op->digits.size();
  199.  
  200. if (max_size < min_size)
  201. {
  202. swap(max_op, min_op);
  203. swap(max_size, min_size);
  204. }
  205.  
  206. deque<BigInt> array(min_size);
  207.  
  208. for (ulong i = 0; i < min_size; ++i)
  209. {
  210. array[i].digits.resize(max_size);
  211. array[i] = *max_op * min_op->digits[i];
  212. }
  213.  
  214. *this = array[0];
  215. digits.resize(max_size + min_size);
  216.  
  217. for (ulong i = 1; i < min_size; ++i)
  218. {
  219. array[i] <<= i;
  220. *this += array[i];
  221. }
  222.  
  223. return *this;
  224. }
  225.  
  226. BigInt & BigInt::operator <<= (ulong n)
  227. {
  228. digits.resize(digits.size() + n);
  229.  
  230. copy(digits.rbegin() + n, digits.rend(), digits.rbegin());
  231. fill(digits.begin(), digits.begin() + n, 0);
  232.  
  233. return *this;
  234. }
  235.  
  236. BigInt BigInt::operator + (BICR bi) const { BigInt result(*this); return (result += bi); }
  237. BigInt BigInt::operator - (BICR bi) const { BigInt result(*this); return (result -= bi); }
  238. BigInt BigInt::operator * (ulong n) const { BigInt result(*this); return (result *= n); }
  239. BigInt BigInt::operator * (BICR bi) const { BigInt result(*this); return (result *= bi); }
  240. BigInt BigInt::operator << (ulong n) const { BigInt result(*this); return (result <<= n); }
  241.  
  242. bool BigInt::operator == (const BigInt & other) const
  243. {
  244. return this->digits == other.digits;
  245. }
  246.  
  247. bool BigInt::operator == (ulong other) const
  248. {
  249. return *this == BigInt(other);
  250. }
  251.  
  252. void BigInt::normalize()
  253. {
  254. while (digits.size() > 1)
  255. {
  256. if (digits.back() == 0)
  257. digits.pop_back();
  258. else break;
  259. }
  260. }
  261.  
  262. BigInt operator + (ulong n, BICR bi) { return bi + n; }
  263. BigInt operator * (ulong n, BICR bi) { return bi * n; }
  264.  
  265. ostream & operator << (ostream & os, BICR bi)
  266. {
  267. BIR bi_ = const_cast<BIR>(bi);
  268. bi_.normalize();
  269.  
  270. long size = bi.digits.size();
  271.  
  272. if (bi.digits[size - 1])
  273. os << bi.digits[size - 1];
  274.  
  275. for (long i = size - 2; i >= 0; --i)
  276. {
  277. stringstream buffer;
  278. buffer << bi.digits[i];
  279.  
  280. string str = buffer.str();
  281.  
  282. ulong toN = BigInt::N - str.size();
  283. if (toN > 0)
  284. str = string(toN, '0') + str;
  285.  
  286. os << str;
  287. }
  288.  
  289. return os;
  290. }
  291.  
  292. BigInt fact(ulong n)
  293. {
  294. static map<ulong, BigInt> cache;
  295. static map<ulong, BigInt>::iterator it;
  296.  
  297. if (n == 0) return 1;
  298.  
  299. it = cache.find(n);
  300.  
  301. if (it != cache.end())
  302. return it->second;
  303. else
  304. return cache[n] = n * fact(n - 1);
  305. }
  306.  
  307. BigInt A_func(ulong n)
  308. {
  309. static map<ulong, BigInt> cache;
  310. static map<ulong, BigInt>::iterator it;
  311.  
  312. if (n == 1) return 7;
  313. if (n == 2) return 2;
  314. if (n == 3) return 1;
  315.  
  316. it = cache.find(n);
  317.  
  318. if (it != cache.end())
  319. return it->second;
  320. else
  321. return cache[n] = fact(n + 1) * A_func(n - 1) +
  322. 5 * A_func(n - 2) +
  323. 7 * A_func(n - 3);
  324. }
  325.  
  326. void init_array(BigInt A_arr[], ulong size)
  327. {
  328. for (ulong i = 0; i < size; ++i)
  329. {
  330. A_arr[i] = A_func(i + 1);
  331. }
  332. }
  333.  
  334. void print_array(BigInt A_arr[], ulong size)
  335. {
  336. for (ulong i = 0; i < size; ++i)
  337. {
  338. cout << "A(" << i + 1 << ") = " << A_arr[i] << endl;
  339. }
  340. }
  341.  
  342. int main()
  343. {
  344. BigInt A_arr[50];
  345.  
  346. init_array(A_arr, 50);
  347. print_array(A_arr, 50);
  348.  
  349. return 0;
  350. }
  351.  
Success #stdin #stdout 0.03s 3008KB
stdin
Standard input is empty
stdout
A(1) = 7
A(2) = 2
A(3) = 1
A(4) = 179
A(5) = 128899
A(6) = 649651862
A(7) = 26193963721588
A(8) = 9505265558539015043
A(9) = 34492707658957352154209374
A(10) = 1376838513081116360980295181209531
A(11) = 659507850707475839159343791917325828401771
A(12) = 4106769104118746772826881113474595231437999759350073
A(13) = 358021112850027225543859628161443755675797871252599282145733172
A(14) = 468175032476816030945880629382256175459714480922429623019875920871330858762
A(15) = 9795527835319998046710768097799709473417579340940347645918858113532892323870338842772371
A(16) = 3484146102587748334390296779435940021522491577732448309823094607803359353879420191763901358689610042014
A(17) = 22306805394122490753941864095291960820358701746485345630873511656810222184922165142250438274267278379571212745986065189
A(18) = 2713513581968305662902219591973777705725532174740513916552405403832207665526598655807139579213223136074219489979296613663284723298864667
A(19) = 6601712642785278478751462665264992643865555389346639348610494513131390648936540193168787941374501174368529255232597075286617120304749091153637347979500043
A(20) = 337287718866785762145319419276684707245288652587012048519128699912313232803243580980731548354841381915321299478301900599151755403321095038748459986921908595870502701902699658
A(21) = 379111641476716333365081612473065081576209694688353999754185121197412116985655772687946320464679282459310657362023558679628529314521654221555835826901991375318122541232396707066352412597162992884
A(22) = 9800800501362230634091026769324257881803705362514431588783977781388161108012951271123865693323574353827511315125907103295883287599954280482707633746897632013750306285794829070238254092654961301294091299341771599758591
A(23) = 6080891006776527783613042553895353424822826885244572691649197593778619128770168705056558445395937513247045606106204512029361792245247625947404693454947417685586906456905408771678510252241245498961552037769842014457881212302006158082675622026
A(24) = 94321977656713148507321836204330476779081204464447781830733717075685847384867111213598163322314943308980394915312971600649752487325710354667024697061128800150868358766032339704036098076383409058252818697630351478850657044730595605229799579371437072190684721723743143
A(25) = 38039248185526896050195807651186394457353435291904227943950559094311920389573502193332870960321679850456326384768525412959312725646986580088593129921430656705567580344838510389331293352103130028841752394116330575533439807320687838644942637980946859888456985613165559482314744809259615088420267
A(26) = 414204407484265552226708196758259327582693884362524768937365246093705003628735295143537394592277403359582741309271432082822090437666749256903289494357926734949433112303959721386364929435893546095592685651689402512164619860593806888944010119980517059593088019654731588803604495753281519871377868109335219071663672404069897
A(27) = 126286096128753507413584712069472232345778429125885903482311105381217236500124703837605652805515551070983706659387038477285290638033253298740101100862863239063573874979742397640540552313146993205012307684052851097976775345954080758217594244714463604474843126587852034564094720045458403957980979973405914057501043829486845982976895998384180752596303336
A(28) = 1116591605088971268452998986513018523872228209495774718598717751698120279484882418293245116578736423450637616317844140945396630063656784702292450777013428810482415150782280651758611631201093326171319118952678898310212726772596898394276331293649533461674003127529364112173260386892532383959623997676054978846171367217065375616133278919440406369988307597243122482128333713970615291354
A(29) = 296179116492134296127640953968047446899004265496227795953030519429131815512067074737171408125948747559314548059417636189328234996088765231098832982470276761205540863479224470054672963147138776186360896268675725571845437584718178324995749738572188732830330395623341248125070366836508759558180619253608428680431199624651363609330781989010607007725076918464090168030425837272604642538412077601007018660770351730005959
A(30) = 2435433087651787800115196819189125754606851056342193098712597479944538122750804334816913047686978171520756687746444691264238251609727155548302336576385011525123757772625642520520514818542764461779462284038410810630294061941386634329911166350060837240730700793982693743188266333329178948523214808547718998662252893108562711881124027029643108291429892206247012715192163473296969580410705369464123015459820849227282688953241399754532966864323170580122
A(31) = 640837546649824317834558076904091024877700764327549448891665056866642317988983434761601817032185291938166996238207783470369812347687214784615157937507664043718371026766968468233842441817914496271971069144075703837948726264212426711514623462228530480369217622541931536302197019257587750038380533415886037666691507729276713173677923013653985194326658394243948438359742595467878088098274146002969039500292144349796760822159861105146809689930499450540798951067389428888234699836477069273
A(32) = 5564595959620603725603653045001907621725281504321093974155022648438635574686707874930567766548241818900808103322423620750466919383483087663853442749982097839760705334244687051734830851222554674491004105913370278052582310553324041788056527267113604030394101265526960184545408017564430095214947530441260328760561451194701024600717813513783724268225189602648746885161280700432085583507857337058751350237920158358614430591647581759770089818074023369741436917830111207389594398855515922805415359702017738746831033947402942323
A(33) = 1642851240683262858124698280455679896778506906125116407161273088671249576523141648334507891181335191973705094133975541751648270040395184878751447526211415501799594599575906893329860688811920934583820039038722280629663760395060203690262920795167055295882518230391452984317552312775939888182908434825901242696593236097740377327130043916351140089884498424178364796068030385882690373807114293502182104787504827200210848282808994016943755364168606542216050465380259490898470831016883573707082957978625643413441055510166974596692147660088930746333171700141539407219
A(34) = 16975824956741212729460982035846350716213653739690185534929254934160442248102420653876800368685696582002182951604030880296939597301618773638497868857651017429699024751736193505442459714245070251079855440668030420297552565048815700813214965490861319965692966397882437916164157155435443754762783122236120006282505753677717737590323032933902286081674179967388443219170716343114175638939800262353223221328528017849684245110438873761798821200325234848028289877437056231317699963459373982023165747561119454022824142194741301245611565676604747648472224172187879386779577588192700425721739017728573154196526
A(35) = 6314893600661194645359261895457920080770334337590478513268987554445040636820517962371824451337842242139315470685085021071818362447702796455161670180892462267470944248223876699994885345378461946644502863968139356213721906869408131784815878743723791200517652730922931904232068293548094981679036657643310461128008455985558644564898216070858869475888516341281232539626619714313819650428270672297057155300830017945184552485651287235149083248416490919673677326244822925763903273918214522204015337612271190317259774837531225476278056684369094683722075175389485870027142488201133458644394097263413047445247986808344462009405831839187576854717632356
A(36) = 86916636316865982328338330889171104647755921736413074657805759630330772468764259557568254384028963395684457446207145895852964323729675536811343260492719885993195261938424408056786407834545146209193875907752205254924080235965557189594538983589296973643480334988148694758367443903375956599512364102485696378744122611120914210151028364179422236650430065431607964970863537853832027594577130760130329902659118414696666279655093212422980021123523605787410015213152482473050550468838780570219562290456520984585920900729843516953427010279836216639122818656806199916919826500926232009304769241244817189887848606978876339726940477998716284094277723525456563387553485810083874084461910946833163
A(37) = 45459366627839886451533153970872260472715033840338694281460677631384425584313838505931808973222348392022827832702726969037456906471221772065280472329210781691310116781116507396019861246871092639522233860662390548814491448499126834807878291056687921123757287738575879649839831915298196776921522396822861642492064752768001793356378504933585672298909250840083226046184408594106617173092534416853010907152813659093548171832626862695597009693820369028225204099468463688310997246505857079631595586488502397952495387974098846149512984853586816860349552683278710289303296538175504517274546123715145750482103291875450160256375183329463256179694000975469025392433537620517681604367696261222568551644911611093501483382730733863351267537462
A(38) = 927274799960600265615463442186555718285527581299263053023462966509592321282836586734177637365025648186505508173952063332438006191889242481488265627902769685608203867602396449760409703131622134130945585429959718290121636664292677951054735901740277009423195404473853758472181167530284613977894728737407348785903704944698656630875899496822401017746551778487241970388881013660442386443000060377113974317831663461415828262755703945211062742360374697340074571610981281328214626601471089179442385245862264547420797012833384761156939066637928415119848480165326989056353988898807511596772337047281274414107399888788676866122548300332855611582145179377561598745997150039224954420111871983384694564396554364581009812316929036877798447940878360454969677396975420098166820127979357592307
A(39) = 756577681058490876595528739612536704773592203108304752844300603442803408546543063555321038217237143260244036019415226338657737849515140585458050980416865374273910414586024816346402077507596093899492305403258522388109685953956984251923764801410339878421793257845230429665518290147624656222924154159689399813309601721137121433547971245100665889071754662203577284939035877014820540105004787299269700681189388784632405921507388423868993597487132429739393913870099698696577073278360364715736960989704902414552250562379478767306251468213533953371696063957776573874800264880399887898314606244989480109821935412676478008027888846462301109867177553625279388582025013279519868057817671793093631954209210469280617962833131113324060276375620600461135433052746057198364476324293157727930831688157387092390899234577932353115636965519451
A(40) = 25309435010534924860969826922062478917743705884089367852734622760557491182157912812488102446252454469650327673191586709458042613412858844066376015102945469235722465644570582747964724706685008034006309413166769764948322104796502098203793467551734507613525556656186781812573395859614283398767655162219657004364267148128968396598104382626497033145393613153682241067170467529020785351708578563560175371870357092410677908024727703924917009297718808081533153163803308816415424981901540860562909324348445154754970911607135496451661185106453411651227240770750921569406049060199225786426321243652100944667840460438548643969828140595337224783723785572451100844525150935020595970558956600392935087752849031018796726346172245809838678737432678332386536740305592128777482103982332339610600208704920142041192427981437094372748459182906939870209721325030206083738895386132554907660723769
A(41) = 35559911026670493734713777026891718841403615164388034501500187150899344163075084138910958697587647907024227237853950225478166475707460773799947713769903111195162083671113687193580579924167350132814151743586511321143700564044475240588826024567325676255689196013335318626926466267285019089759114877513746238661159162719036051569387747324714209723873680661135521007400432430328833845407787355472485323657539934733078904244944090304661359198243284454479391989724932944376376040571575703785609855239275511224594650374858464126397477627486222268817779502549096833125415036518562564026825783840000368969848900921920111752191017674660272530551253800240203202932583700905567169197996197078311268359317177606977567167427241499851867950773225270345743177674783253888487565394600205280196617454266265023400207224344613987927978779612620594918999829901953553886020188815966979357565603422446391473447297173246110665592233185336330743404
A(42) = 2148361379186465850005773326863485654088003432658059730380090791366731506121963759255299413896317083614349700037558746967941342713193603807088587807003944255443910861893172733305293279397345264105553453471204068397515718641875587140607427928447708950292512483692100907308712103541624267370339358120505114526701307239390059220997785476514449538808003295765298394932996634851807717012666272136213795824386346838516894080206100584883714820256206479648340180286024110297512391004957737997679544161280558733056901731728242561791177105425094640318233535399658849834552870039368638004081086630392532536455489987108985195281397901548126144066745112681379868443547285624696422253410879657887875215576379358065839421378262298435794742833427162713785734116390368015646237384619274944914746400865285060246338772430688616506118181466974382304417696670393886809476438685997057454132358531612358538183487788837438466750646984603310923385639739187317738395785482335765318668561862845062255002
A(43) = 5710927986664690297324168819919227572487155946874944225397457270075469189532899737808628489670150039342231756874272216202302721635311719037725098340176609935771398589977364952424473368811073318057439405069145648133580909482098518693608706572122902709401400212714210446982554231749244986737236475289098457907269880224320842560224710396908498847982136479286925808461721492843965898593874102832544645617331693603029994719600599594453833245424944096582408834842612880063356485579722441052902677087279658925505686316798484725741237069795128940682437894647776858244248892674653621467127671445633866734534553646118576766157212490490511389454755957086915669313636741816215517314132291237337980847198596337502945410003087861976702283041919063938586999385899173330896277710647339068675263809897397372393496967522310854741307570358890753700189043154358819789953849581967386089586245879617897547905494272910593804924509636021564447269144433847740431347562235887982978799712364427510433507619807722389437125856916117720368701293728091278783403
A(44) = 683153888967655714006293851831678257396350142327484955392228779602483482016765662342230034177352040802156058483551347021564834816519827781806488985566469622564222586065174472536409264776571197055317942294448207368374829642056408164942900010304365711318275956348894010371282764830649279119493629900903711022100049505099658557739118029456240202035857194946873207797672974878630114389048766795844905283134105595275932264706259807282277335642420422530259810868718603738614934161833178955528419193288603993013993204003927081016988499069959566994685715201844918289462187412100009821057273207509182720667299943795895251947479860108888625085493610347312224771347479493952059612671394521766687912195713675318121850123497211614294584343298035383126386672973038742200575497689741176369940020993778007723102268456993641464808268930681454729810679044770805124512824470668076030559149220366239569612981092152418880191545057492164582651919965203777086558807758218701275023649961127348451855257537646999022037539834734268381672221167595352871149144516967041998687641910073899231566043900396859626478838
A(45) = 3759137727995229690451894898830875483173725997997156674246566556823841070556600493613534103090652804225949832249231217544629290250289642107113091534616670032969652960297812227583067723084641104578870871345994184046155280484927935072210282290820441869179585443065810658836571230359585870770857865411626273055261074141307721966061028770480602834944500433100691339683213022214648630620670278157183576174728345753597259188673230408212840786583658734874458547646125926855229769947170516226981131157555415524056488146081649220660657258558741401205736652467221362769713620336705875091439157679440214056447738348391435911769878153704139359695278654000689385547839474317301897706917117083487737366248049016994921264101621364285852017344354902403966027755141114470400707850345531109411262331818253790968656074932483454919963506205331486079833033998171081029497681410224116255181729184906919912259226744819638143377494923554910934360296172268077799787520367149837133254053004858577814782433231593282255679818483373038380048757786550166698083473676698710761712898134300282545569079019896735067355105650797023471438855618671559482416995581445540851829702029
A(46) = 972200384501054328289743988091333511685003315450567794926415479927738555895650514411327549568146200564904803387409664490759423652946236839427890295996900919073931216349576277545380973308020978334624888188979315887744783991396995527920353430755561423815867870869709535370232452720779213284183191163228418005298887089743551203074207699856946575993053563421434349025698195023785440833246004693943434575640721743404656571986236400637930319277019947533697150259299599898954465219976943404526275405145040569040820564587413761583138659119344032998982539780563828813946084653121506916602409988450756317155046178015162112065131086065669050507923426540599098047134502434684800877179366159143349970125051283639012057513198854546339500088121019626694852627012594702206553855751816945456969229587561796920255696477284881384940590140935751406461947483700008727087535643719789112378832476768204242890165527591189438087042455411755217883673816282137509864785465661463125834053275547155542360600696594632642847155682629416626806329576694706306494970311636459577385807394717284047788906821873197248650336433310533992591131436645028792109343655183637257602295413714900838961619065280755794642024521447497539605417083878011
A(47) = 12068813512227203523127964142444050057341019698473228403691596049739930545994656613751545590586514093154195379683926371934496429629181629746589215847490086087565424182384235308620338058236112331455066492273358110691976645886206341172090015584568449908556156553277948527565412927886773659570455126751488280351903077116107738675687698893209201153470180916946630707054049890319796984548591848816993724160415291453458166196179521830883381215171527000264468107929232934795224274672892549820331427369796556697352941933873398956845676487714552274628923743012371809249812404407933033298734687585662961985234679424800657128171526542141364725627997766882033230482130334629393720834738493609412870074519020128974839719838091156901816659399851870125682121853426853176278628823888170234748833968686581955257081318168726285400557234209584077140429807596946727336510184247071194828015350095785181647014689231483867370569515402210492265284392442957269530507147571062489444149268607610203960408297286235498271224558276016407847146350499209963395026597610422077735453449554419835778764454407983670083687865234257111635958306866160000940436407336758640630771405003667497591048169179937296492722865476634804070578186550045548913181733410105152203740102345359947560145585217636533862011
A(48) = 7341240379899518952241750264213486390003969184421062135383258204170038134502124673262286076077836965634341282386586599614508474416079310603832812507003462441377139852151788471615911784758855208182472188104827578333775517552908431551761449938135826512877034697105217230449806710692937963071876312023532198972910659608587149286197462516571164182996204579835771681054064365871415228813798626596879158496564099434578740886473506453965370237910141403068465274995100156518469945447462159928730395034164543573001341718264625628470235341395144709870718953961517839834706762924510385453094047740622390441342937629497101450434837288325158882340504802962246204930993883642112128845707750020998822959036889871892761476873897420402237243653327157067460612685716189210194485465327080379993351905435081266803983313006639237229914889586408808544593234237772813908938282118410679402660871054417816384800131444984103138019160408284472804846520015032393460779541873379373146767005203277441921619100202785503320690036396648697636053090272416335393345870998393772737102624890017593138743366029714681283081354996106279459887655328846696606444672082848950271381326585388983666541047449172739652557987649561075203740883248797014568319990695585549739913179005257861995629614240839492297624072489804592740785074184169509051211154848280135005688227304258
A(49) = 223277169130445696128449059591717851518424733821886455514317531080973152669990048996533287185772996481495505183566194274854663548026695873342541804110522470597037318387279259157707963990249542260726563568857223473319714340595626005632528703878145218999979747310417071991685819512578082465791208298951871891979463860261286416992953953433605828295580176518660946978436018120141163434677802543768619675303219522238058364428085450670130481010159976220264655070340072324781042811455327690425643801779091264500592633472393985896931146668972676903707802465390436111860499872315190278265947648286639409424387928318355411739667583449216589067162589720369267619367169196041675783381374244553060221460825429429780661586801261693822696625280620212147768622131316352887421881194268212757925469413947854102396906582245327028494511513561877150853460716041011586934261440894141226835713584032405833706677895391662372952600947850533220471299868592628064138986583893153712963116308050408166370661579380836321442510641256412832935009384474305609424156066904390020717347828683595534625140657699690823704465654281415829008991822026340968265168290323023324611669597819033183119137131172689626835529392139901580282071183205860028825268453950731752523243512465376448813006397721988373291353397123112534891950148927856496470219686371458881295556640772789530592693037911880436314156141271627402714222163422102256456132
A(50) = 346329404219152924499698280622046879338517509721027005975123769296407129879063241757488875020059495032505748213700389955562264188373359668129826224646375447156830096781514327187951011602513247228016444662460623536659601687389143446894608653452348109658528698996170708447920124643740102126765262121781578917580226490950181799971568531350607707860843878962145790629023248029477666881653061050146915457755383557695923710154184394591232047159980757472430088610057596611959957644049262992715892791846588877192487408320239229170726028296576234752063800058022359978627492019929435174339495332531290666151681604547826761542904629480164518579145004785486785744782692243077015455958911961142222409177309837421558077960660668749527196592723725642710726994457208734583514984032915187352869398377994690964488230206027639359228979425620339412799918623561665619884326961910923473919834238875676257636522893402818077572620880671528074498531246778512307921196462207093657579609061424080400733435954812641858100096627561280770093534297048319104334890525794042404538671276774921044423886694316680727923658875409558488728140749821020512089424084614082623007775315305709809876763240998182381827862652361708838436219947923821134831631918586041823277452924749092461657267732368793880265048722726276670237003289678499697062688671124658032591944977986591435072918401915639375468865582960775135328278157061759200456167379165901613789179129696316568717078810213819001010335896873555367