fork(3) download
  1. <?php
  2.  
  3. class Imul {
  4. public $container = 4;
  5. public $x; //pierwsza liczba do przemnożenia
  6. public $x_arr = []; //kontener tablicowy na pierwszą liczbę
  7. public $y; //druga liczba do przemnożenia
  8. public $y_arr = []; //kontener tablicowy na drugą liczbę
  9. public $result = false; //wynik działania
  10. public $pyramid;
  11. public $sign = '';
  12. public $suma = array();
  13. public $pyramid_bottom = array();
  14. public $output = array();
  15. public $is_test = false;
  16. public $bc_math_result;
  17. public $comaprisons = array();
  18.  
  19. //rozmiar kontenera liczony w zależności od tego czy system 32 - bitowy czy 64 - bitowy
  20. public function getContainerSize() {
  21. $this->container = PHP_INT_SIZE == 8 ? 9 : 4;
  22. }
  23.  
  24. public function simpleMultiply() {
  25. if (strlen($this->x) <= $this->container && strlen($this->y) <= $this->container) {
  26. $this->result = $this->x * $this->y;
  27. }
  28. elseif ($this->x == '0' || $this->y == '0') {
  29. $this->result = 0;
  30. }
  31. elseif ($this->x == '1') {
  32. $this->result = $this->y;
  33. }
  34. elseif ($this->y == '1') {
  35. $this->result = $this->x;
  36. }
  37. }
  38.  
  39. /**
  40.   * Funkcja dzieli pobrane liczby $x i $y na równe sobie tablice
  41.   * Kiedy jedna z liczb będzie krótsza uzupełniamy ją jako pojedyncze 0.
  42.   * Przykład: $x = 4 9485 $y = 21 9458 4398 3458, $container = 4
  43.   * Result:
  44.   * $this->x_arr = array('0004', '9485')
  45.   * $this->y_arr = array('0021', '9458', '4398', '3458')
  46.   */
  47. public function splitNumbers() {
  48. $x = $this->x;
  49. $y = $this->y;
  50.  
  51. $cond_x = strlen($this->x) % $this->container;
  52. $cond_y = strlen($this->y) % $this->container;
  53.  
  54. //uzupełnij zerami do rozmiaru kontenera
  55. if ($cond_x > 0) {
  56. $x = str_pad($x, strlen($x) + $this->container - $cond_x, '0', STR_PAD_LEFT);
  57. }
  58. if ($cond_y > 0) {
  59. $y = str_pad($y, strlen($y) + $this->container - $cond_y, '0', STR_PAD_LEFT);
  60. }
  61.  
  62. //uzupełnij zerami do rozmiaru większej liczby
  63. if (strlen($x) > strlen($y)) {
  64. $y = str_pad($y, strlen($x), '0', STR_PAD_LEFT);
  65. }
  66.  
  67. if (strlen($y) > strlen($x)) {
  68. $x = str_pad($x, strlen($y), '0', STR_PAD_LEFT);
  69. }
  70.  
  71. $this->x_arr = str_split($x, $this->container);
  72. $this->y_arr = str_split($y, $this->container);
  73. }
  74.  
  75. /**
  76.   * Funkcja wykonuje serie mnożeń i dodawań w dwóch zagnieżdżonych pętlach
  77.   * Ograniczenie jakie występuję to przypadek kiedy po dodawaniu w słupku
  78.   * dla pojedynczych cyfr dostaniemy liczbę większą niż pojemność bitowa
  79.   * dla danego systemu operacyjnego tj. 2^32-1 dla 32-bitowego lub 2^64-1
  80.   * dla 64 bitowego systemu operacyjnego
  81.   */
  82. public function processNumbers() {
  83. //zerowanie zmiennych i ustawianie początkowych wartości
  84. $this->pyramid = '';
  85. $this->pyramid_bottom = array();
  86. $this->suma = array();
  87. $carry = array();
  88. $licznik = count($this->x_arr);
  89. $pyramid_length = 0;
  90. $suma_temp = array_fill(0, $licznik*$this->container*4, '0');
  91. $pyramid_flag = true;
  92. for ($i = 0; $i < $licznik; $i++) {
  93. $gora = '';
  94. $dol = '';
  95. for ($j = 0; $j+$i < $licznik; $j++) {
  96. if ($i == 0) {
  97. $this->pyramid .= str_pad($this->x_arr[$j] * $this->y_arr[$j+$i], $this->container*2, '0', STR_PAD_LEFT);
  98. $pyramid_length = strlen($this->pyramid);
  99. }
  100. elseif ($i > 0) {
  101. $gora .= str_pad($this->x_arr[$j] * $this->y_arr[$j+$i], $this->container*2, '0', STR_PAD_LEFT);
  102. $dol .= str_pad($this->y_arr[$j] * $this->x_arr[$j+$i], $this->container*2, '0', STR_PAD_LEFT);
  103. }
  104. }
  105. if ($i > 0) {
  106. $this->pyramid_bottom[] = $gora = str_pad($gora, $pyramid_length, '0', STR_PAD_BOTH);
  107. $this->pyramid_bottom[] = $dol = str_pad($dol, $pyramid_length, '0', STR_PAD_BOTH);
  108.  
  109. for ($c = $pyramid_length - 1, $d = 0; $c >= 0; $c--, $d++) {
  110. if ($pyramid_flag) {
  111. $suma_temp[$d] += $this->pyramid[$c];
  112. }
  113. $suma_temp[$d] += ($gora[$c] + $dol[$c]);
  114.  
  115. //jesli ostatni obieg petli
  116. if ($i == ($licznik - 1)) {
  117. if ($d > 0) {
  118. $suma_temp[$d] += $carry[$d - 1]; //dodajemy cyfre z przeniesienia
  119. }
  120.  
  121. $carry[$d] = $suma_temp[$d] > 9 ? ($suma_temp[$d] / 10) : 0;
  122. $this->suma[$d] = $suma_temp[$d] % 10;
  123. }
  124. }
  125.  
  126. $pyramid_flag = false;
  127. }
  128. }
  129.  
  130. array_unshift($this->pyramid_bottom, $this->pyramid);
  131. echo ltrim(implode('', array_reverse($this->suma)), '0'). PHP_EOL;
  132. }
  133.  
  134. public function init() {
  135. $this->getContainerSize();
  136.  
  137. /** pobranie wartosci od uzytkownika */
  138. $ilosc_testow = stream_get_line(STDIN, 1024, PHP_EOL);
  139. for ($k = 0; $k < $ilosc_testow; $k++) {
  140. $this->result = false;
  141. $liczby = explode(' ', stream_get_line(STDIN, 20001, PHP_EOL));
  142. $this->x = $liczby[0];
  143. $this->y = $liczby[1];
  144. $this->simpleMultiply();
  145. if ($this->result !== false) {
  146. echo $this->result . PHP_EOL;
  147. } else {
  148. $this->splitNumbers();
  149. $this->processNumbers();
  150. }
  151. }
  152.  
  153. }
  154.  
  155.  
  156. }
  157.  
  158. $imul = new Imul();
  159. $imul->init();
  160.  
  161. ?>
Success #stdin #stdout 2.98s 76736KB
stdin
10
43594385934 4359349583495
0 0
0 1
4 95
4534 4534958349589348593489534895389543895834958934589349584398543
499534958439584395 43958349
0 10
1 4035934058934059340590435
54654 546456
3453502908085032299787213921985245197793813792782241807632777839372174035687492693657039082596334742465804397616533685984791559858351931030640234162184378570993325879097931582792023428410995183341995404177450908493195507317857764458393783613713447508469725656183425643421438590940839592397549240764770145595743180460175722510353525707607789218000740321351937459613542640860490755847714652342203710250367316704988593881596983930272658174544078793475492607447327692180060187337193807124592380285757129876761095628100720459968026514733997889905664576280115167858421231406645983883058280153302377875152143459291221414912099566756240180588746792310578848524186094094756948191412820275896606035268956292350295392298249823287327548925271768030871498478019070565454048578100236983227076939649551103715555833859333839749775482360966171164225522978054829765321530425546819016809167028502649717755012138031114040961505213208826383739044584072525876808935815619159797291717599238512786352139611615789298881143531004168103156161858642167889389119020313195413659241084234862603660955093963106588922242036620907291326457220845228197701395928584189602012343396384225004802198225313789921222956928833775136551757203869530188284171455232567395176687151539884528882612833057222881815463134996504799256338724835094175725262715917613011576025735836138753991056528458702979065621146711080254750815831022455823451159588534170434600717629435366490883760593582390498304185080199163903944296940465714167012832324438995202607608709225074536750611085611165632998457383452291410462321525997108170353348693665664951477916239027887742121906719931375856087933837303466843127729280789306698370406915200808352995598072796327066536240057108256770081279401231640292232322242012422555004529078385974781801744809913349502908399404032926638412711086317975739700836033958046086423563383684147342286216825079575270120377915974139958251638690279584338097272909291142738289183610780885129636117733406073851719682387837557489163243518782281221321806939348194497954298688591690891435294792869205701755817487558460385053109036266460713479220000194569054493675758440913464270133612683920595288819404566966216664438687932082488332639133283034194249084033606339220512915301523639523266397764112277373164391147227321841433052737672779755086468041186421296486838266900638812723685880080661563676540546504857909852506272884425627552833548889531771199363118426078492235720719010056461885728060808205992225357588250447909631617753452056766244136618048638770415301771506243790140664574738235751252190930212672685798791113285660415388019013294904232181982742000810939015076541205035148295416521300527553379863721615123487917230967575307366056288009767618505197931119838959133216721691454261497402969037635564534303655807122731806682360949429943098832937222443575813285841990617588211440410355822195523793971889793455423890264384264635395453933219077638253393058764373299582847404195945607214738761300395140029811710492547835462720959152622154177489620914318558755261084268260095053324106606945281274336165231492528989987628589649855766470195152169274459613651630693088055833074890950560283178469402288612741859292319992870769098422768008758198276658034731572759193417178930895529896099279665318501338929467000978722783713891177796516373459894393334747960964686536016743785332202001051809509688428075861065178073386491147334831450431003578618758273842688601659548654310228114086871015153845629515923552054351847455761593829737653525686647204640965187496971835291585038041784783155324292768438671475233616763266689340574328193574655983324504243445754319752983815698369869638280053188598312766148301726914702494312451195216259829496762446839977199012236846103391633468735585240429993456724318434102715274858022981765611719028159995932377626008290254825082544535601359886384051930583925541504805178732389399634952316970406396226868368949561085891694559257563544662836222101253838177656887084741738405674200203731346830606746120050827722758266026874470508164247499852425327414361721838366565114217075754702907470231423895820281906728657739837031984723260235966227512742044181914741016077416303346186318527687852817085390295632066216713399012623998183651593511542377408654125883380671806318284073493660805762726957692621573871901626632563910338164910632267430495040987217825738729393202053843339770302505565624554548869818482966799745495619986579412785321068238890610329380123588746915331803331218780594755006688931448549753361940377009877619931182225754244552178117847308201768420506423312887415497766360496513810274648095238206296536266338560961821262559154558833377963763520778382877321524521320718925453071329919795490682470055847273674777906409717860006055320871362132756250579351920157659394009007052719010133686304226207366105587992248635238837907939272649481339993461171376121908107761044958964526030388634631367526053677844271152813149454889380516816307109134589596521916651302890414537210558701241584478378313665247491323100367250406314288413400460179185178113942583916520033180013964082944056018006075957317699337952257810343402151188643648219482664407335552706506763282396817435689179374940333014185462168281004050305982711726887259844474679627242169259584138412575026215648753984147512844268114036437409274410105713745215123348187371798712411827567202322976184210890287617230006523096346124467408981583027728095947327833440984412158905311032831664451112343103507100489728218721335553940782870953378748271421134175688133401473896226513343227618754583636781996571513321334338821659889667747377052906414021256321135892161401851376777803276924193569030056231090524596034906813173747360211922434174324999212574912909012141655985475806119176776173712359898535385133788177441637874158971530994602663108676203234417745313402784950785937504783547290913100625480564534238989445816184794634937530942992555251954881659532807075727602364202540519393021312773000269471436046551571825625050426738503999109448040318747144965510635806397416109442859690921091834352554871071010330397151619667998428506711442282570716238683947523133911471149906776593689456993459964933054558116582981535991931653665860499072393536938857958636887378236086797760174513799881756314587449978672558133653197841399856777291328613245577242821491255657144892375368432662830255291312096814528763632024318948033164192947059440221848740785073537850736823676922882450583235964139233550129914534664345600696594776229072410052491059977658941306968550738014528349541114019559106509798968270203841239572874634445536244652960519201387282326292113228036501275163214749160005950246772284025400663422204583330227002788913143753165180124151483367909592768785816794146321418235170440864096833757522281836058154621035128475218351337450533840312153274878389526975567504941681147978335738174739553404960033532377499433029204171089896798780184542440320415343898374800921340433570442858168457434939471540069018822323290696985697883347005746700416970456760178589196208076544716994215734275874681138311422483832580204908143069111733926862917318002972804386102209253293168960200201042803378647083246316191499841083439847070603067099039074203187782103960956870782262643158501413253126425970420506961261297040742830845098453158588318289562230771518006460893874481343101087530340165974910027182636302544808412338110646782259134201047842703610148134131631598509889638614438687752263217966024823092642089729282243904178774353918672457740495605230026348452074246817128214567096578647387090436378754021043144983833689509916620276664530935645945285543665615969982460188560884629896504321281555960534110663703390055056040751005032151812837742524447903479623980510334195396920281786727028150426656074344126792870992748966093605389353186728840758607191361383840329949185879235561114881621949529771600175334781876418198911097250264657365929626677265900958172442304756877388521450737079589923541555213944262327384843194590711349553543831799144997471433802734123121471999334366776434108921334600560625965927303033286735514132236377990062068446086568754216244681874529483425256524099906864375313664543871520474646461943811370122029779318092234814520440350270552953344279460002385864335480039335143166912719426723606916629782637582299683391589291456936058914859389801965284849230918074621956117611188583986185474661806831127741790123871569993741414785752440194305220974415442600499193053559862738468960952356536477366031101406989609542991633564686546905895652803622217599224605015277919084068101760730503891108748034275389831724404591685945410059586692611533853833038995243348603541244760159613402846234648651084108601290354913817964870313803243055972314770413510879011404814672893312181534972715426748858101539167132033290846457381116792749668557136978180981614951904428743335435576452908039816555238987518528906187745877968682834448547401439411097853420234000191861864693086577663857007781374389038752299593604680026287496667126228967328124599112480714576764429635270075782391607236891222114526380062765777289779155298259078123438479165609730343093030430155863302410797199032391475244679871766023048401196465566580426524713163075762660183108859243285363503459513912829113173028000274732236522804995009350341669107643591664324409902765055049591435825262873538913111089396175350461191131369777349718861973268798315178301900839310420158378235414779864985280349862537681098779138731098916805480196420559365632655757813450264552583819699455160302341753657726914453317275634173017143834984863886258593994871868556756608093523064311720401113734751383223355098026842837071610560644948123481276748743858707012078986486902336293517553541399256011553585923327402784879013435996020421094818165955496445235831450374797231608102245062656759848504936000533005430614809243513806434790262556474050632197416129000925890849747925315380657352176048749757717310976225272058375689942530800740142181336106153562990174050778825941678949623939053266771111147812385637796715965516176470331650928045648463794043871540071597432095325631910778301947640473751 3439773819098356526397927909620107860222501436723323960814136384587766557881270202621102680515336446771492483916181444095246144717189149942217865909659962051372473861663309629156752215766359213487990052751269121343096463200030004324983013081651288959021836840492487456375968585400454034816434701186999542155855028544618095389305927067418933213837761332763761830390973118503666231405685071180583621307104759483499691033684721438969308734849677871905458577146238760730475737937187977385545406806174580877906855135736940579736872655606017527241761151825234762016134321497876462668330175797855883837916000402491290459849040684951808294340900512451039934802429245480499065505205317347881359307216098702331609179831571772420870597345170660323754479194158289523701574250338054573244876997998308214263479162117739591955518120095476315179505444552593301625344027990104503867630056272134595574095131365818642900155312380416370343652517105089067848238148742707449890111257232888080369159109993257492037260577735637888769494361358928677093522747138375019140364258714355989211692473841790180253104435307769838380024154875927228469920320646525569815536468274142907542601196900831195861160888038270551885921624526522839258933659255449350740438858563167577939852805303457222890353147304728311628304642680642126172504210479950213252251543695718820908949262355569552870247851139029561509281118702420295831816703539486068581897482951078504386863966510774262679036500079622662670342698192019270253845872290763945881975498296642391641694098247354285484426702704575982748632582403336884026212073459934083592593947514339220756523029857536935528762625598447496599532721846877157512131565136024056689654720954448584850459710874600705074231354837024370122873640101980503704371870899217960751543392676270137501920709169363817842957877228398908766740447792511809827437575294024276222880906518142476281107389553441153618088170577747408409007585582147077934896401141121773477482758431677692712629980067534275159678552511538022943485273854756103904341890499084240552630358145803150031272806720436327473711883400008275727018371743178050462800120821529335184262186589586738232036432973448809631756447898618862089670461444171519705734351105079942331425427096123607395536952959411557149158194835588513934744054597097216441682483856368282309518958889237314555273758926984216480722554346786872227024553922129721427291520862275947426483434431146289829443648497083005369095858535033766599125148007008566311459731813965985628308178334283823858338495356121549054350283868029977100165410050998161929907309607113495220566634922731315821871081271422861684115234191753474498337539531142025087149698710656415977463331278475102637458705406832616567483283163244062456337649519227222965327776387096608694887603893857772915732530391724157866517815581628679668899048623392544525864711936260712676491139581129574115944885711695201366639150537088178542831003969212714898830998991842247849908276722084276203307871693803832886784208719772387162287556930032118316590180299751550349019129522601810286894511002369225819979604860106004176115670143602670712640440282317173022761282046528992268685817735112115076943860142354665074173472936911631848034057660689599951369873030165004800047427737667428295846472506400644400649687819172664358552221287748339908518155157219355799175641225312111474098344845405846647204087510491846367050016260225205752447620194164228693797379023692466238739724421876786467059616638399189053434647601172068989810466241808050735700590835214414634713721452436928819879323312101461594705248175686523624502165970713189785237954123581931296010726315563074405154475237894472766611558521439476236714610739437808073594992653161183380527498576253210536029343912072479152079097623679078535648188794496888803367152767100182138736282296608105766124282315204035635627719865114862687717220526771196822157850439403125786030887313953473771995116298844763054774733362067400007928915409657410974582831182773421717719235045859361976467546899923305669202739286051405994167580101011347445529296505266988535842254562545857395623891287271384500044769930701090351157228495171994051498941748530308019485787923698082744963041324497827980373775488360238877069364760475580466099409658200311077626553518182884397211618747805530295630693919286261505404475272547343561442982915501595551127569274117485285798245831271535017544074816843228911400915751870874076184213557262050691869761212421421725484406825614010563696520463841589414391201655409376131097526471495160964996707052634074404109603589864171139731867395836098283443435645660155239370701674721174027944779101949679837628656861245727023525345045552649507190643748939044996884586140347165417218001842267370479036337745443243561072230648877185331186813127134828156470953343551950259974687580244015706431233891522518214505767891216342971591994343803759260932880953820269979595627519893704697517927791273392644072421006037047704215775230443067911301655034474633064885420491905449122097019541430625006899409684670997101701290595852100518349809984218192868395694318383372882259248431800038908858647504503214337380621912778826659504352914669258266463863738624477038854728441193112201994620904030913578344152086878036429033891249471138997664179656913508706016851128317061791070839481900218033745997795958552778818391353487550750444803579988862310323085503491928064629281521487879065951504332407727884289014779493746416473881104801515346805111018507511532484241616400422272440268482634141513240419060847976069776691315166737405768197764431382260552060000785230326942523155144641715052666110956610994540922512662908050819103449077599841316246034469943175926945678446681441658926707604168543605271782149726426706213219407696975141079795055080508381208507716793568624763095210716280650120058372602927702666127819963068972721078959062515203108242660711380270301686680997956348711819307887312418496455875645116138238883772964203777449942036127344389043522694081361108649399999455161942217577877608200351954574970633566846349060536666552825817103816281122347397349768018383998183714046091494155161781906820419754864374318178628394020978714491389306285525716870248948741041868476046651967728976974057917092344786893211156601744583807341027881477743552586065716435069238612672403389714744842205130877681437931025441634758187909924062041040120720508355545460341856106768329036183927806398470538781167863399187957779822840306080768135285297009927768020017206332577647737264614737277822751561265697298549215318671386883685887266545089041336954122091386627364038742655059939483890698565345742857238364941972521376340312684893738314371568252345522390187386000731777546388026108373223230847457229196688826961585841781467553335888877154434178365891233767452983741949797171010293851388507394533056076025100171562121277059748555308623629990570993008287109025667236342771998768844611765626847242814369619187214310337109622054367749614219469453861117662083203750927878178412629239204078141361014870478388074857432679878015323597272669526100370321747255138846837520500892593368745830937155655769205972594049326198478744474847795417585448948174378934586720484730926594848520095815817229839311073728252057960484313028883817749715042651155518372539062976105407473464018912982845208991684432492783274831887419257513460290415269404071785044029983733255221051036796533344381328479111716194731047503832798239886933575095770024835251408977326378922206251350866610129282421507616150786686996226455159326094770721071272489028136974822304645096677221143475129908276276694478752602775767755272695414849124214436465035407194367867097308504187728535018388823175831481729342607178281310557890931650101575482859104535015678527054842271929620375715344532004680134586203352220964100833582242596976615276314116392268295367939434134506466505265312099163559415275938645559951755394050604809317823298053805231121503259829969984137586501616779938555230158757019320867802061057340137292209225918259613931880605521397023967554387107532360279794455365497881165125784484743561213999207206494656669305214967234625270194507256354804046330750662771784851026360827527737749606573799155668297564284243602724870152777890391541239939567573859806123117136000741318830335668361293133044788684774896040948269196068955880334351437453450723790627607117233323066543991848389089197453486901510937326804743035718244097550886090246863279413691535220755973361886925610142085485963265472244107548027891005771811439466029748103118188876936331368916646919168885515514105139763500361080836249359423312619559588950710290643298775329408326281774080330495772898086331039706377571104206932609511023873315654938290258293041996354824218050313173820741350725076314048404891519332815413169702338001856899555529672204051760343632816448450715508726132604929819913139761602069212222685515564777990441517428727329463402743208229994358563557757879376683953049617415333937376553122155548968703215127727555546701989928489291578993264666587927405130181755948341905219361360017035367231325969377582138873396436544100949399446140152574412449762338494393231280323464529754333070526772018063716998365089346257872373489377484814660602000666281990785872163694367386912136945939695581033717434572744418471430764053199050457310301547411066242164849857116895319884982996436863348886907754922671574600442531249016831360583692161148416107373678803068908243182129187292974868032440998844899634793229339420946850664857907408113076444378892856236380038649028814526985652383630826986381750135927128798739236577313862600982640245214154920029642805772893120203875614388607752372085297922083934284168154519179747709678092271109577065377755903313437707224056655754623989507158683066327674906097530429389413667014913598672397191859160796329280045795332235548941192629899613027168128571867116751249611540626156026111274549839151946645231926674816812643780621960412687891068007767831541704556501173563078635339605925171081664426482887051761488621156334367696406872919748943164910176201560069311984494153359976867439992759417
stdout
190043168164103186559330
0
0
380
20561501157038106522881551215696192023715703809428111015662993962
21958732040787746250363855
0
4035934058934059340590435
29866006224
11879268887410932080521804002483256232108523602626931456874511387325497160933001667799264664224336944295848612211867853156784961796895307665890579136801644616406917270214546348597919829774157159268659097308236387788134051052384057976131085599412417116566202556942387008541218028404513278164258357466337972640372617373282802402788230700718247945186922560933882581720440020315301272574772242625385953389115623018085096404013115434832040698956430122093586718409626462242618835195045852872338091519557978841990567603144027716190112782331921249081066291562593545659120945027379539639503035301613775225651238298811407622266098861775442081767997964410668276129429765514428388001396568514645691281221919279610101820439093503809795846268636234431662583183022533376752352109869062392367005042587157918832144573953161771045516589523030952156172683255474786166284794727263879808968896512972327511166536885475141619542679007088076811721099858139319952520448428184564238497083353307913004995554599446851128991442652460596759094389521471608066826799670228914356443310230376205527424645039051233716339599409356181919745463741003642333106734522915092852230031362157170924616090670609796812716326510162877509353450844572869632540428192735262800896872371882497593895314500607215041619449951311416692933951723687461228221509999835887331081797695857336258789143603308967951748352765297501111588427287288884603656122474439618939102932274236247488065722789783486961161265711109060519178149549821006040637138931332958798445930453673189605050453724134708393827899192489221883552194956824057735070204800251578992578484315061645361729988640486543396730663199225261458175092979366592221541531489015724304090325674340433369380303950395013363338712759555471438471936870185961748489921283329499314438392330081109050816515755534282777190781754812085203852891159414800580968760639438666034603609973705494437797937170504698092489532536569029715759043585123828768087100808032334397112808879961583131527956757786884214792874686447484634160698337446034400261413786032919450407144391970877494924600728400684638453667029429691317180744356732296100820234441133294323898062547870523937376043217385681297366180864937629112888290108294575517537633095339115219583882103405050897736109592807868816393387751279130495459611003278004683480858749003392999627100124799412266652346756173460871180680794451057420785493274031700606251483561995347199350892230937109299300754312971517708387359095770662435036579372315466669169702439315629607853841816795439694479657128110954662931850894626176895726334768805534980129719531216461815737249629463854062596293968152726054669918839123903384825160514740327605718260157742804993023187327553083519050907989783896412247626604083800693174078807141697671462567021909741329477954247022435934046457626412265220475144729305198155825601754291360923243818485138826503230305681067199805843282707425177602609684063181944268154530743149207617412575613145873075311914748421499815733722584210496616645718236368488284972269709902726508138507526172347332211642336557596401176346086523132632071410605665194853723778780865222235546986828232936872805307471064454065924338475902435534398060743338996611555119210233637369259556578017697496948814252050813055922007220639095784089564994526604959616949905873835245369152276179125762008404867686425025747533830627252884097882734341746884684412647882269852686148329063256784076290082975048046607752983323910256154326304201109946641352228221391542776818577915093384680321816968808248013413783081448514165758511971047725948820862658755155380480647112975392170632822376777550218383986572502767087885648435717529757538852140627739561828921158502896704589235273614845405818341554182764892417419842438847454830653150507515900370670387351181827244296825328829585647625864269633005546568717689654431981446497301623261391778334241525851788817013851840793099459314881231511077291641183006815701152947117089542868806717214226397901082927566604339942711444633037043106287637844312209355772009862650646479936207345223632198476528489178380431800097623154957909307872495896407842155657133572962369316791829556323954289168736945167833255440355167809412730273495885710155767800300574209601821949898153460699482563446685974216907798046488054643140823735237773844849160779521590287918441291087894549856718264495973251111128607100348090932854655020246943406843082887136148518521588448305228947563088150942180074768095014360462757709317320756830376710630745549509930961813085986575640761045342946584236798609786073189208798711797044595618263742737532407760230159639537467885272814916657457713061690782856441756498840007669953545149790982074335733368696091282201866775269657826073539061783732550824021453872616255393473145790291997268334253732534152072818611847628882094851586417451864457159121289017974797923925354633060419221309396810969223011581518262402212091819399308366987505766900122221170895599945288575158815259941799796699410116896317985256966416954999107150543277538748539660892610821937376357412418505391713938148162596639802005517823981691165667379618081617891912544023946445189674402711820099895241571173693343547111121114830923294766959284639810435479022846047754337665439472099201789617989657310281280983790612700718854881774976207453209215819447428323428871214957956182698476349728692382202192934360176469575664864889349799179028688967698164833104915203066647382161553450493879357504337967352857890555080741592347628028010419478317867012936253396163073922096586920826040088815003421966461999147893087800096134582955793948513586700531147873368343476946997773438739717894377608580484040830818641751810719800040902923275581248668483208395896933672756359407080371806134928482746193390214688569577167102138969406597323944231644339641084813232888244493279242597992641893840676052828193500322228311654276038260324975420685176450670868253401173648159609288149198781454045098738264007273723536277268905263005788220683983647563502746136003224356613464356242825096599114620302291908866791353579235027637330966036089170762750592549060568038150286612819523289156255827537977061057732726261856088795864641801820473905762229413349105533506168214413903264432250121585240478217105632154591959512352158041631741826869335961471143391625614426213188077833929671747267610255079562383025898220880481136281600152296602210881530985818472149804706645495885326829249990377829922940435843874960020250814114717235994026188856844256689748146784832791678709664277743680552032868516806798944806753253726397750428823656134648752583372273904684831874907255933967657716563188051694874586759869755001139516017962792937494700928736568689409614243676238157310255749483716415917813672802791698933137396134750125986104333993054084286663535856530983530490656549611777707218162284775656350432145856640403844990612309167333302716612618637658117414748126241446659053785122464509649256659590940941416754139679177243203090817813110857668146084259097872182435750376071754585330007049727865400681141206181279215610604858045436087990801670979180017364213822939315804484882071238328862213405269540417239706234587881520864577534418990848113781965236772040818319136127480541457633180395691147438820322018108951748487167669968828330010544829710213481688563354341896602476748789803605972481936365205654832457512143209197127284627129276000203918027684243004258435639535899472603589600991694674361438910919870713497999136854699757543057892495144334913443479352868332065109680198581147574293337949464252652742424313143129188082749257696896869701476447266903878229491657790041796797404784102642776471132199297099657252413447777912475135324104256607723531744756685659869165316676843437809602048195241255064263631451886866396994934388550457886701151842217803318482726635249445944691679329624735326372194461233001169278392073442973220204833233859716962531815803497512807296156576553945607755889166399149503498566514740894720888450787108585259764385929781250663371768645278509899633331459826742501559782010972130498823156459109218386948624138023949550453437320974426057552021464954884755436746405297583901044289760215715969048864509952208696412267580176264994774270560224061749540786615974029755929428295236664072536484687471871045020954057139301586089480031126351165330047226019293415366856933019599192092414277779835602585488780371692607996840935825538885245627203014351742585691650474855519191961795037959349279724308760664142439867927613671786666314336450679258290280937596881512948892441104029680811636343038398632504498895535536217401839553623346526866710038270981663379035101769357094200719124798946283516338186076747213890099920161338852243862099261038982128278497058471139203270283731129524509060922850241451753400953292162825300695081443717963289272561462135827604814202691416181162364935091537605572459532684736254640691903565920862460162017108860144443783177515761538304399066057034966993565532081293808707946778421802357112966619261430350894073771112506414419403030489378791541099076577024199300036304392429248312774208297686252049765974474013550754889076002575145957625227269804790396326799133925783850322290896001864230867064830026823588460573504050505562109833200418582491970426137626772948573389176900134853854520996135981583831060300969005368014596879609276892516998575107392251494407827168348102004412236847613858632454077754450199517845718664688445453345776195230429286876998507045226284089796781642050024901196077657493170029405995086348750208929378824800601862539853231277910894729539706538644047584861052381134627800950429715085395299033718073972850448736797795533974201322795110861468284322662708792480499227817304390642195893554567806208536032170803083845892710231518592676051614687551797105799413985633959939766149652428748604203113042394338980558629862288736557287922147951853932941934480070652729861914793091127433295338989587918377726921010030144966309021424478900029889383316449336326172953476236549739020573610418216308387228368078821762597692631313843089862137572098701101291453762034148754603938575504131282739022271146229714154559112270359380830337599138214674856197787241562565943555307911366320714920509844137844181910355325017574590220863598214888399880726397699480175494020628870469487412291033664710464375306238844291808082649136591317933143390233568928842144404622931408454412193063334918805560371969360798888448721464521239500597960637541113860584141417457178864318076815106870033783934738778818052358437452671281900321151403381882971922986953729920252639171645726346430480429490821818228693074572636915955426084936605702504081332845284431567937584718481972135526617996234506991527078795180298063100555723712841976080585275725703583534274542099061654774476820436925414430422013522704531550431547107732218613901486939387904433464992585888745402558797578430354335026260204584273948215811736988306617946625569482559765583757227613863690586210675110738778153591479749876590878830168157431997623437889558874083659379359756505530464625136863535557588821934127359760919373476125852623600830369205636678205609044183421443510757399412208328720404356830008909351906325526176978394294943224808221762443578416475002737391957246083131407504548070894089489876877315241117141881519486589683070529218898838984401819011807978259788667367444550347446677516597921359864021426315478519945463822631515936051955959387332831826805589147647611425192523973846079597136704767121280957095931059685331203159495284445554145561555198648681950926008502243341530040230497686667827773822815529900351023382298962053002608612002621364825640095046971436612751005625262283115717571999744356204722353725668498723292691001096952848888568592130459681874841020724310262369644217215146828558910113805653134475142811879117262136038630104477679572108506389972840742030737528636002249934229725034499354310362380018903810208165552429031062427045375658256741858164934712292428780408145675152294996580783351605413901988421273687104310210860703244641312841774577335044096398388327689924854562627621547621592445316554712620415886712919258291007186054956900738076065211530819396845408743435565409192662400270050049963436039073510283877913965398763173931959092173636131527867241707169288562271712444338611172508708196407043908401701943339732718713595919925153406702167932960895915248611971635242262589862601518637744957306768926910630204256941132429203269704334487955044059030556271909276812388038358489093530336434782351994227481242269620675001708043902472888781592483840700628388130776399214257147666960562501087740807752388851674599076768417113809295374962896966688202017608281442237656573472251997382118844313912225069395791847933313995551374471028385250606784047017190774304749995260469324250367719535627240830185616045313734309753013677780576963894360389156227346782614134265552165512478081057787051687738446508020092598580142137411131741814431571573590551231662059339003410311245204347066645480490444701830555025000044940508305038318367726100919963713545625151153358756805878383524485956719344030810037748588171698434019371550835441727660061868611236202545158243802267289781251800541661664245823825099641901275817440764709486664278718050929600598193158848923589440284093653547369519892802673985684806495197005015846942272868155267247863417907946269353104299623281229981009627064973058569455709520064738734849010382113765126543931855982210591929630838782556258006958128156761943497442089153386563000633742435725416065950012751864152802133881114827317772212712734028849880692198042446801371259607018911795131264533831902737711909366411496834718464639065233597877616661715208402326197478940802081153636593285074078549855949959436027488462075059397037040074830291870885543870594249867893214192798064978465478028270659034786825902979472257438563763107595984786304270693803964044153550907732757841289409832904277355207223586645529756477472422985598420864177173276045731920030641344374112142835579215069650244244262188142208025556473790865306900207397035103996239336272695996082761041976305483581417895363464605122167170090628177260881233343014302870608696210012611154252742828006557067730769618526719496827318475204909836201298825721241229162126996053561128125487181810656144214553283764334238630546106365223158015965682499175148267990873041788641291268512355287671438794999066391164440151704653405369451763647363184873760625719570906352438991897677835627895163621262955293994381773427331417575189309408223277389912336528083410958155921577569420022577239274848169783019785841453258351791254461141194275617416328569803956164180954748487443609728452094097085097540757574991156895302726528389902488984778887546550680260487032624378037524749455824708806578312954513545090579689427962013498045492350821001366378866205029676238049995535344109297025193594672401790533041358539896607686077896884458049774614001022204948176824261450615566408542159960996153960842021205078630269338849111347144740916565553560139613093398545806735631638695941132118371014921990443332822376415504042096864673033696049756102970551478264659853701912615406870106500489284604970328619142720812181329029556003158475574765741969990414106217030286662312210734454858681831184759511269323967057409140684150885861879616649465775952430045522328147612199455260984104835697201214669606273008985818105721089603419505878367461084421528467392554284608765002422237708955423112888173338359367209450316710951839135596015115597893631259398973850281987338909093712272340688054964468105643231774938232658122489928564327963412976973645576009636302836929722762563422040565943672077495458562565969483666865201315483032658462817336971773453892157006464158255220057995595990913838070049618311457693862684206289370487049477645880559124490118289732422551443013593816057569749600302919625759129682845392300301999795711747264043888985899798314500614921509151257973536971309832039948509777105244237977812898070505406932375877128081880238652616898209412951886985248217891312059140603609016134308342505739072162184876845110413901634149000195540017113127583054298189242256120878212477535028767172769081468026808617730003097102635958029025370716887680415825747358436404770969594543997427439660245107289255116746406806233053145200957966913864527513106532343059069536082872252539535024362477684992148487696069208135763326867964855715229889893860364844692526864483583641889213943310500666751696207367944928859301005231793063399487120148261377265047875265352084594151580363981066972638657788513558058041282703346908984487016231448481476769479502355993416830148864991536152506248486739676414179761412478653559417911378908403670214103317838955852297009265080250552070688946931785855486857678831546180413770950246502946297258357287980647695089423724726843943989836366167285293771011493976179568597732419729669604017188806218204339725039271048751905819338066775999485102476050885446703672482240136717654018929641443013818305344064270078794897089421051018521243502069313826279348058403973544644553575485820922566092417490831265123295308687531729358856441706129651309129768342526492334776323817802148555540582941621863608517452542430334499568305144828335690658382614999239651880079099811990283590091055389489321163096265343196356379087202260033048593032412376516883928782010607844560451068246509469995631421163597191922388223802154110398107135211319127853629858626988638672707748474877477421714774425948034859631531227648771441703353619152446099005223039904692359354710372747976099994360695468282607022366485642530831481311218468009452557785011457800045062953260822802618094411217071085333279242689750038500862448597760381767725882942827529396868582998623079413829233699499901549680435079994135233365008000875722281988730635348641481252887934059006502413450881868148502701269524925922398476966431541906010440220670733576580629995031957350915753176916196785565598297985783667148300509385463890920737545314884638416188966101294928223023740510132270411498835430258690894013997674793767614486484581392506101524252819390213049703138953506792538259529354702718975922953575511343445761129187145160484021869861909637889723707498451699071614474634857186311154725868285135325330893245859674887048703596717281716661216202576229620415246914966313129798343798012302863128374772196870041363822186151778562973582921741732026072519298305174105969303109658156972002941667172200469666285753447722530990531521890719318617919458320645856992847917606019688954407158974575369412689995176791016254614143053435469043060596093328955481602282053114876886335848977759213657034282210452843477195354042918631286943734844398028873091135208694793704015299784463666535281204590907273687855741375057996852224836123005704377431400821713119780035264327217915627854205042794729118992762362635136730414870539091622014169104895085231789704530585173131825070519819034417340674774362946139009539913703406370832394463002447077031326286210277836760363106023326091485762980785621303368296475560597515076905535516576400519960114587797913619831519874066278141863846574302408793838771903452984293895822294980296213978593114008248941834848698763878330823016381597254563563762782364972479990333700608679601186041443329180342890205562721970970057599487360943518945371684821012921866465008182569367555276370291379820798794308823692083610001989732340860479022732624634220692789526603339921314998576720625057878185395711981373644034873666775287534929487701058784291900984868171907803594530486075511268613041315741763385174083209325764039267853469232042352381834052774895739118230445770712466637554081523706589293174944839095731526299487681707541812493557697040047693591712983221272854510271307279128366222868933580426269473512426868095052051696105641605479362178306736208566495768165446128791704451313249681340932988421446046591610025334848069185843937283545361620158580060442796009802345929673762802013480263556900054449348978606064508321881213419530695387455517280011921898789727440713734644338936272140560918069197304729582550752919919014301639818209380524013237453938700302042516791957985792491039343221098880149295018190521881420857843134178024321987515753293669104352675614935646563167