Statistics

Problem Statement for "TheUnexpectedSwap"

Problem Statement

You are given a String N that contains the decimal representation of a (possibly very large) positive integer. In order to keep the input size low, you have to generate this number N on your own. You are given the int digits, the String prefN, and the int seed. Use the following pseudocode to generate N:

A[0] = seed
for i = 1 to digits-1:
	A[i] = (A[i-1] * 1009 + 10009) modulo 100019

for i = 0 to length(prefN)-1:
        N[i] = prefN[i]

for i = length(prefN) to digits-1:
	N[i] = N[ A[i] modulo i ]

We are going to swap two digits of the large number stored in N. The digits to swap will be chosen uniformly at random. More precisely, we will consider all pairs of indices (i, j) such that 0 <= i < j <= digits-1, we will select one of these pairs of indices uniformly at random, and then we will swap the digits N[i] and N[j].

Let E be the expected value of the number we will obtain. (In other words, E is the average of all possible outcomes.) Then, let F = E * digits * (digits - 1). It can be shown that F is always an integer. As the value F can be very large, please calculate and return the value (F modulo 1,000,000,007).

Definition

Class:
TheUnexpectedSwap
Method:
findExpectedResult
Parameters:
int, String, int
Returns:
int
Method signature:
int findExpectedResult(int digits, String prefN, int seed)
(be sure your method is public)

Notes

  • The reference solution would correctly solve any N that matches the constraints. It does not depend on the properties of the pseudorandom generator.

Constraints

  • digits will be between 2 and 200,000, inclusive.
  • The length of prefN will be between 1 and min(1000,digits), inclusive.
  • Each character of prefN will be a digit ('0'-'9').
  • Character 0 of prefN will not be '0'.
  • seed will be between 0 and 100,018, inclusive.

Examples

  1. 2

    "32"

    0

    Returns: 46

    The number is N = "32". There is exactly one possible swap: we swap the characters N[0] and N[1], producing the new number "23". As there is only one outcome, we get that E = 23, and then F = 23 * 2 * 1 = 46.

  2. 2

    "60"

    0

    Returns: 12

    After the swap the number obtained from N can have a leading zero. This is allowed. In this case the only possible swap will produce the number "06". The value of this number is simply 6.

  3. 10

    "1"

    0

    Returns: 999999297

    The number you'll generate is N = "1111111111". There are 45 different pairs of digits we can swap. Regardless of which two digits we swap, the value of the new number will always be 1,111,111,111. Thus, we get that E = 1,111,111,111, and then F = 1,111,111,111 * 10 * 9 = 99,999,999,990. Make sure you correctly compute and return the value F modulo 10^9 + 7.

  4. 6

    "123"

    47

    Returns: 5331084

    When generating N, you should first compute the sequence A = { 47, 57432, 47896, 27896, 51734, 99716 } and then use that to obtain N = "123332". There are 15 possible swaps. The average of their outcomes is E = 177702.8.

  5. 200000

    "1234567890"

    12345

    Returns: 400386862

  6. 3

    "82"

    98467

    Returns: 2664

  7. 15

    "7530228"

    6332

    Returns: 603177180

  8. 11

    "9639671059"

    96457

    Returns: 132685585

  9. 10

    "147103"

    94606

    Returns: 638856689

  10. 17

    "577030761011"

    494

    Returns: 862078444

  11. 3

    "27"

    39454

    Returns: 2442

  12. 14

    "68"

    37814

    Returns: 217902004

  13. 12

    "421"

    61767

    Returns: 532977606

  14. 3

    "687"

    33851

    Returns: 4662

  15. 9

    "77067251"

    42779

    Returns: 838537519

  16. 20535

    "798957405403100064524426115142998274457930142826506817847519893554758417641966097640187"

    89594

    Returns: 310648080

  17. 149837

    "8685827456369045857541160521975984610566398096001102183071625433081565952281049366278706568295901836816453705060301712886564738730293925093292928363917697813773796907581687277300375969574872547273412295107068531015216008912350623851043610581383328313298896133078519363287374066665402265476438679848328293668404431372492310730884953726232421251919321794299992711367111938825934821338854422687"

    27400

    Returns: 408581648

  18. 35121

    "1198009595018752573329161311382165178501402400570901668197570064683930697221926702076905129819282810515447434134634408619202767039642493927795978380912228324154808614340635376379891499598668829711444182492876226867600620536535171841714478769503296901992028330462951638073647627745019293869313862118395225491277193995065964486114496492039052600374926667921031099572030504443851953231292821118681454859346079346519927609538537239916038814321767559924200540230869852309418322403912002007489940572061017025105910762998147999923187598505746835008753693185336221079198709484970106080766549021651631074287430852760594018447347149639290275111777173830811197433364219985088425091226288913076978528558448305230208897040694139792964144197341727036614888071091296336474731201405259646295196994225255047291574651317540042263899619051455213436261371989459524465"

    76777

    Returns: 423376528

  19. 42368

    "2089519426225968306106397719156346522650408326790808912295703761846954369670953371271904445368622701103830283862856540573132046256403643368372479780309503446240638025381566694645916080081915713568548100821024610302333566040844119756652372730012147445127275506452136616715302571885878543284756936821880806027554235897249479330832677680761899292094249311254862016902291884191928202832958390879981210969978670406788891862736777874455"

    61603

    Returns: 227818990

  20. 26543

    "84203663866285049218463712615184052090420843962355338"

    78419

    Returns: 545501238

  21. 26236

    "579088005060125994005407048296667654993474661212955957882417130761100015409077494599560483390738702005104329876136575337091451772065636085790388326979862127509041881824832973"

    55361

    Returns: 556672723

  22. 143328

    "69166935836847531763270634606155939740728368522914479130164"

    87730

    Returns: 667072351

  23. 3304

    "12996969379361138555446520511036687385408201115666122803712040956737389508061813939122444950361056155672415206062128242507462430034923444877851883094166882681099730479892735946094363061572975255883759574495317340604847977046727351219653377723026483469720746119417144725415237830840962777288405514731025188688727358058733205375008177270488961437995845340933821414910290996757901547604193725487966703613302388374598671650030343819542513308145814017035131070756616"

    55136

    Returns: 531555239

  24. 27118

    "283164304283440359212589958502957456127203396471164648469466299667785182203757525990134669142572413172626599039212403558966518747336788310374598872682908392481210546027332605812044694072223864449317248625142829923245844345670707048206755055004018129077531101974205925256108576978136443283102662170646422190170072535609172136297667900110893554270353479573121822596348284697301589944358046684551722585709184969353637589330977983239666914068955209005837947068087271152668967912514485706075116602063251857022817758274990362637516228869751067138503282900419597806670850489924575310113293275650"

    24668

    Returns: 951960229

  25. 22322

    "374275106238207222394860631636217945762743760188933716557017861834047037917811135598592107655741905919109705001249914176897028899869175661921803166720488723173883689695763046419433054071609276834104508826611230327012850075428704831105579915984879131864727976057053277406386296573377330101005537489807919728126237964488134604800704994378786982394492183832687054949254657679608853983984064140481343768391553745457957800625983830368364909315108676557626574292919814692910804795641120126710040646848362064512511873471575656222779942959611670752315754087274833195026067221686830127874779760812893113545275868149495679069422590205573046924663980557960057159738126742948"

    81929

    Returns: 702298322

  26. 54701

    "79720450084521293669141322121042941374108677544237515964785906427691771701999242345211634775123253496951240625582421705993483004292836165955662023219903406768684649320248807252722701507616400864834970558664702784269057531252882451920352336418194524969770430331391722556795047278309818862795950511562858476672980659485878725687987647358025101096006274185889004598991164627130735097549981877772495889556632259500711903681954736762482618539028303073739356044236415483797134566814702332275693681902061657969504064507580133484731451503521832856339859756829536636366821712124735569119119375191005085513199920543716352974027783284935366242719349245915220816"

    85567

    Returns: 173332772

  27. 135930

    "9939843004589999393830095649707050350471732710538848413962831956980516448576229068909489421463799142793098883389938701439089051215868733303316442628933772988021997231937840417751384333262824908533905032162002004365584375389343562420542427253436463002288574706874209292598787268354431591884465194601472382959442818666213535368296183138761281298419282691683427722456407363130302308185728780252961742633468964670668478206057993909163586330726846351452483393435626870209091717396386568543589097954994447373927557505799651159774958507290456338792310627777090483469440838135320468801141567600949063923683521421230582738481181539976629146573952504611291685348331381845169209915813540777163043138293702633345513374365909937282110601162626248867338358041271442302061260253401094611460915287620783961921877130027870297500393689431491814213697341946280335430442838132540201040543198"

    14139

    Returns: 394343944

  28. 81435

    "91137449075587363839970382254202658733676032094906404475494695117792916380138346377853032620766551725976322107899890840122295422624912987989581745669127018774420782309654787565730237519447705549121636824488715453442177670785573324864817165569238522059484872647196081494678507718956436795903112510741458933869886845818684598023608880180484139103571039414996419977597042956285086535623857513376727226049257281778631530386193611569046202489396717178197419476"

    58246

    Returns: 574928815

  29. 150586

    "4241203731437233350564841636830897117394652979964220424430231331612961450104413867579414393409335535898945055042219508003154053857740146374276012552611515281145587554761844717773411423387421325372653758280530724171731897039160189641601207406520762788208340064279310933840516830818035116401490231789740226061588616439485719278279290764044746523120872795448224049621984139954726384335192183251097875376132947341522665137878529798005642289698021199143928774705136193888278706235958488658620130687800374394109409955885060434586994506175371578977609175002001229071635029290665301169107103751479875589859288860267783694533734237930089490032155602322139845720043649647435759989206187890719385305206814762061058567722341695728828508275251"

    39046

    Returns: 214147642

  30. 81207

    "33013359003521779191212974093659459459374923301741459405613242651691382702044484939250727941469767817023937115660885724867958681992204641886337097432202916357232976303134868552112572546941890877189451281432029988511403282133242971066680904246681025180138229575297494663837745071516900444981551251991768204241095178885348532452132539537273476485238887112369358904965721021610617366024326386137964431486291868970331991515352073285484011943643087456382"

    73236

    Returns: 456163027

  31. 136459

    "80685684302872820379179285754727675620503145828272803224973755734182486503265020639699209062524668026727265387681330771116985979657109386889386488716939473569973446454935180835798574247997360875589517317560901150918544821167692487385671904268690108344346184058700448203926770504392940547735213252397757494540517351705695288597946304678194326695984667366397272796402746540616453664365970009421666060418739878157390470938447404754922323954400714308934460780192806618783762641380808649143126155914060860721397064567677079241370"

    23446

    Returns: 616511838

  32. 70058

    "588560243581134010292450179656455212462003633125883648796914180922423954390942321640200874245555386281889686245033181043341324597495979697086013623695568136936374180760004429301584886034098092800092827566245276235390742974388130203607930439735560449826895286790598229068342664665003777578595514746920152603257139078191146297547451747293412303560345829043276910007128699787838397712248829269029386092221385287688035140926274334369224214664294303001639466397905003983736293564511246408926010374107329909474602177497968007399813685217371083586993309586966266978590632398607530235402680546939264630685914906737913933105506032896209562499689090027183543518625208130094543526070205083240042673213221952708790347464856408307874833878682089315586259127543221160979108572732845538929658371117130629127546372536575585205649237015628422686250896756156444858177068762096022238873210893334397763819866830449396572015937899683532849381492744072486866195650144518747112436848257272740907916407000"

    46176

    Returns: 299458395

  33. 89136

    "433876158587259914228103592595830120986110006900021640685818900180908319687291715103884657050605742599228296038849870471733912728649453309279493239297512858662986246244191229943782974407068504656911110024337509327571490644347284012556201370356884137766865024171202405399827300896365468631561587448894483573513555737669095476170915131309874754908465677225900540618469135800430769553103395150009467117058530706076481742240682637160392733633660751339382057680432864722427327889745372798021131217058711592596381412910656747035734914651626594693579277310879988519082320327009772709760774615005515311052001145243105387390557066291830234558100701564432160768069995207124176903940741376169477517454642919312602076758723721442743851073326615666631846881799796439703677739571431523772395324341886"

    29052

    Returns: 909243697

  34. 133444

    "58903512260955715777389122094980587"

    20487

    Returns: 169319426

  35. 115346

    "43768296716762223875089617063478231268681308844526380275593117587771205057682528964591834467573307859379733779654646375101444105814611621105884685594568401212042840593784084382112059842736804564294471078546896693875343768332980154023678962339883774009109813663167755988489288575414076166366832095894034655173991815252071751892979736120058369093538966152870703289457568850731578099421327100832551428685843969226490334829696884311558682044964381510342038296680022783373794004769635345484459114567263337672334713182906971148484478003483454821517773973688425289030094626381023797782794529556464313773420066260504805978329536198071476609782398397616897819573650898862360502523694722586178818748168461248141460386828005333869489627041191535581344113478693259070190605007473115545775157404854545115398275346346072645424051585996165731343783571554283874"

    74594

    Returns: 299348485

  36. 197830

    "9037219084676030113528954572216602629535259012007122674758960381052663671001616981626863185138130004336299114729840718710859062686005990027820242410059564965547247140028673280336332004676702520960805633995091558577802618693129560712920258272419289993692239430579028713721525129778319823784884380118413202132351210558029265288167483302812276428886309689600934368512399842373402052317724056451572705521932593610961456447365820037718298875352757195696337855375100086125648378892688569668074551907937781997289648458113641638358818836842333377123018783766523073972738945929793161012609993839770465184647991722925485667592113997934868235871697390757447927335407579422975925810327186436434948478496380347103863179236325772719569227945"

    33685

    Returns: 949410330

  37. 51840

    "27446509731665249748580936219941724607541889296388092045291619212287273638784245436822773258084824421237418888909201511305069275204418728522141077406108360291400219506533987572599629648009725459556219925164451041109914251657091475212809234856168678241465366991940237663668680746021015757512147928866662140171815853461087680152589181707959821567855010589501283520707059948506136225811851169842365772428379251905739000593198428766413566885359278801671608974247113661397844940410496242997303786543397603806400320984539201683832292397613678821869426337341229826128413249922309360351065040484335719378131925816611803736636937291788414591127843809678206280773672030346531951410535938088051773287023086824985237861122610510207655928461950806056456783621938439411072337578942133892229350677628468681145881358438669233062546866812472959358867010926828341005281386416902036701010709876215993487767177211434531008177078802324517964909624016"

    23096

    Returns: 722805347

  38. 49991

    "764861322888312610133278654815631113606757009536094906488827139370594464602717204531830040996573699622802580953731172673757584935058558399771141025263040509731423368239234010313862931913479731594"

    44928

    Returns: 816707037

  39. 88306

    "9223295529123736708623290997497146755252452700004364776724104977793973716811959533184144734310182760996367486717843972047842629915803637305046135113065232362539356825867776858150471868100383953112316782085888275317791431867252073267408765876525651158963925669742229641258395247953594801620227723270062796118498065043577007568122494080482548844123237185425277227955125836861375448423407697301682522919828466539764197946215147776516966462993661274085364475819617166209701931459829846096645506807445367011335933050304537160381020835056138025098184583653873228585308772472707451163092349704287512587510744307256022798545000534931407983400940991618242822598176810271734519286123326055101750060849643698662037058371441060"

    3762

    Returns: 30933876

  40. 82137

    "13680512044578479408925888178918270034778208445367140268509789587313374764220581508140323319753435180755068004528238059110922895883616772041"

    1131

    Returns: 336141589

  41. 146735

    "62088752559587804330311104486041122112324306524542032327619912662127646399275610374379742969479277814388058273551806517177258716854912308046751089981080170029497116271521170476761902241668331523596063832969939071856376247794155687635377266365326903055927246128325711427370364662906843311516400584382362455837331496093708548801029427537241641028"

    17132

    Returns: 988385512

  42. 176960

    "80005140414960591136409532903886939176327881569629485332937252462557034500109804849850370582655118239129367928434487130280272503389897353108203192062302473299772871006728043265725687956663527962274951469019038661080779378105706588192808006517121845581168350516536767554671098034726060042583947156737173933425597497691808149815341820888411987912195174861143623846085258364995180962677808026355286993317591709045950410998288703182747113843925453137083557894928751872615416278812510822546335272957862012010716967357685248686639425843805968335217686232607533205294033888274872862170730119971377066571941755339168102734582042889296620174865801592585680774980684064790416153608081865667202243055518847223392296668560427675566365244415747140593427130400481838206704186666642310042236210904487703832584153064204733316981497179920869522504091887353"

    34027

    Returns: 576470737

  43. 139290

    "9303539036274097286211703239192586325840300810908285790593750915714274667374148043692"

    70297

    Returns: 594847564

  44. 126658

    "21667575358233895699866733520714321069144801582137550682709874201021583675135997562554477942781383618402057901239181825187414051473087583011280797307026920083964950603560112861467948962815030369642658951337340889665717579862232608690537542858838940742794205035956993908376541967990222200746320717665870836658564902919871333313973432883028232143245534328615288183736642250737745904093709884673259265814545880590471451700680779636640624816996453378987315795073391951595049104822284291075906563078523409037343015825433903932572523249393603749645974219900143428039917984513846795730161867566181005875919146152329607960459507946602508414703776537171477912356544421407575145040513313719611461674875200100916679301199670231938356376345226043164194627433494317907417877112647223939667474646476797717281608725315750109777110739144208605721"

    30195

    Returns: 869316859

  45. 131915

    "370443733223405228177929872405871219158534409386321551390117775851168344284230787138196630848867912951524278914595093371751142250785320849099569091272837848381971418449664612545859312684051851108108361970907320901899066051362153900667296679584598244410233084388"

    90669

    Returns: 957557427

  46. 65018

    "970729793123193258009789886357777242037363914563952411031724760828925537475010483615806694057259113515429927194087177999698402135945482375992904664200872033410741929588440874212036264508808386234824761294507784576074276509131590847565552043"

    58930

    Returns: 678830640

  47. 180077

    "7794226269580058901621592106879167270966375165362312242951570719570488066084350277337021865916064470413469295083519576588422586267541274872773500088599253677871744225543459120109016394823384638288612489997601477741740862717443519216907160981700907646782858563779937441889566705848010033376929442093603035013604526338064401191859585546189993164670872573584567577838770343730813997134496836327188810638395690466604512840191606435114279286960701233667936801013286366778802200655533312485850598142235943310677810586460930699420848574051420067704677041804258101424417"

    82205

    Returns: 171814461

  48. 46539

    "74760898852142853073454355077273734032385988778954882326276750703929870368479125076395063784226992753594396566572646715172061049045405985626044237764226056313081671512510030254571090281364135377727438578740608457658653947529696808792674814987543727693517088200476099543739249094501547626895546584290335292832260672624830446802624308312041230504143709595376408506489900900625289957035747473337998915276293426830120120423031021317715208336211777090696983421131023955938187438936934570509737289947070796792366176364782904858361832744685786783308011729342597060587154321628668446588772703691265822401523080078180285946105174642627980448249024358654035986099878978352467531527897005772764374690212900938615175860779616890043125324804415902485444791344684126566124389069273316298517991065752007473112378670096789557809459565372423512650889"

    87198

    Returns: 693574822

  49. 66356

    "978998898209789446330691411167365236876734698627247165858635663322761597790575403832063522841559387114750675294143204948870757793769486685857867310515196903220514682623854001537683554062825230177235547990282173825666525565850080031335773398941824943916510333664089983937105786018473357339616470561578040244245798240653687248557928346636794658670890307238325869944158021857798745995274347353368682642703858131163069271918388729475893882466287308910964572857355601180440189886208858646973199266050119311912566733132139416832376065974573021443632252713955442063508176672622716440187493812028007206130379073714786921959822292967166465748679033618325885132778961677624512148997393794951061402811602265384425994774674594779183086171"

    2286

    Returns: 6355539

  50. 20966

    "7028396905549663617529435058246102430535151056290383175839958391340985446688563351593184344764084946034497555903315785631226804902954339242934918251684987878226496723021157489402788357174586536013755744719862574605696777054689460938760258791056160477346607639709775812092621056269531035487088162023936410023092272850265600907084256419131547535238597293122495148203093677377011091487518239282666918943903274103552313246026803233629119296379653914012676973939487648076596466177872642363345921690531062352885911534002618639860286317295495776548716675442064451409287011620448356207255893963918284310296492160380867158942023332049819958458460620189"

    94830

    Returns: 472222773

  51. 159706

    "8263949091936324527311726034995664316450089026840487367252911689262233183895906327685421756791233066717995840399513876639701493056601503019705397644457252692975679596424695195584891984180546650525496160532499744775576574537447165356433745068392652103091100315517148306663779298214123005223532566326174680126576062953960845047713945696394815409958472516641015431935031551879357642951911614857604975782488384295562010400477866756910691284202994127543727118354577957609537869079362940437524051109117705619920910721048987071537543811171429587606641172823522400326147063038671970608763450885258883525916159252678375280166662125676756376471523624003050420775880856287080621606607063959480171630157600484789485845264597058492244012935699504570671883555818027281166696815420206521509819075196564249256570768524254141212309096940454677381019954503235928512210006875992491954932858849148703413991088292648908947890326976644666273968531893761212381877614459455905465"

    83330

    Returns: 861289221

  52. 44072

    "49206220594994758681453040622347233085508938987164077319505074237309356091450037576138959650313937515618564616276696968809677511429053684089570411978340480850899645377149061774742819399692206068660077748718018012392411035769578363425896019289926486049232060751668921604249782356592055976337197610013942883663827394178142675969799699424362092710997371235560818439311464617633648185592780416101575674439324296431895331750313831096371037942718450160592841795142223370444982072553728056819561289101986627491511262795442631490260542304492720048567197966830501063736126812611699124012202183161179569120835025358424081344324169043419680253536572955561805153291501180141427213904490493982893592327186480453637849061296719889337172392591902348387475777025793628044375675885329897428745574841926351989946839397635894818623815341297487918415894710122665818698625837216216240913583"

    544

    Returns: 766824908

  53. 186585

    "7203365632333316592315173204807515554341069502172331187968316548946713618232946921852051939620658419050745946380461686253283970577700953669572592302912997287370159289751014697590993980342702814944655248779730266757182241786532782867774048939789163291554105528406191089041679687899003393260187881234158331730266890869179490757330987361412912425982406367521319824107420105203472588767616404134316384406363286782024030170335041306217944199164939774243732174903371136759552228400604768703253598800200453702622686616273476937309934903076767546746940799392154851006299137653344674437405789136631456125774333478470381912787796687204361541635095635079196507199279525081884427844075883986379391776403543482480548100042910385617617899033345"

    5370

    Returns: 897145981

  54. 14651

    "8660840309589284729079875857213565499300851997543457179622976417773636833499247227334085548301309069788211920372385596653441804675680362309494316434922456472597170756464654936494272109190728990988493618448855257949619224314235152622638459700265163824097479467547300919975072841854686640368066226041612588949873347106501849280364648435809522202332250426925918515134728126165265237915549940950844033058323643218831910816562769379394996411151022474763220342587310364086964280571665242494790051405758493167295202844029810642707549640702663219572857986484854333708614401648514403799236495712401061613337354834997938594060132169034673622739"

    93993

    Returns: 765272367

  55. 34427

    "646880198302513535658791057740507122619111805646390248028573394343579686364948603344614224854541978948226803874146016252958094428318219614815594317977052552686466471367404572887349140995979864506675348482915381028509425654599845886545583210573640192770597792487034573528931632057547979778233769868204831904084959903979903690732657823241706622690197574730007516795701217139995330079295289305288965979023791218704147692149480612554904310516074536786364272246954195419357115538554968372740702174377963295290342658916785803952150982545282306073250040837054518925883996130387813260797318873493634033287346749839922959423492380157152136261404020427064239"

    85675

    Returns: 13763741

  56. 147414

    "110439825818790916576072105425810073189960412507213877089905895872290247643419423491380487824966814768505648706113395310576048032171095208078956765910980567803215448368626985542818300431772997950624798197486134379859700138057824898351952659383578838586523039186675636844293191045771527730045937374807063134788312147589555093720576202418450374422202139564718966242425649489196270915370824783160303094312338815078401366258039297545809168786099770140355416838020058055064231620732185288939005536678509506924179430108949085285118104120481875523952202109354101875247122063727470917469549502600279756476212316836665810840026777305106015567979105345025459392602134214754794178299"

    5960

    Returns: 81979094

  57. 151873

    "89676710651868291007796305784846134139677291196865608065810935045982484287169890858577602807999069322198208150891032676549811222623172970954625687837504965543744632062706228788900856605571848904486725230878774352420760030457873128848644074126884625898432649712228089850622358298971641676374269863989580339180613483315474601361443188375784564940671106977539920941001226147287151127580441535006192112280170890809617583704254144779679616659453624902409538797650400614711860498732430743088186177283586895661042532589666759808035193827785160482316837347451442161576222476508596"

    89126

    Returns: 885089631

  58. 105550

    "54642945575806026446675504089502410434054529204921486728297203811762836421201452777322426371780496517858052110963437517942109757186646394331608511701281979334456861726746120604899559488055555213101010979637281212959828358325376064869406279398051917424858366306025370141889543351253215896374119321940709786950972285575444120414301609111642399362570929914225151700248834433984267737150350703030034168555819211238547518846012322054553700043095572261417844743007191453443780068936070470112034591548943497819782385251524188992377830688935309922546937569002617334318029863356553906216605319175561808621378762594413766572927688705194852617956356016952817963164803916324577710679817475026363181919272955369954235027909171960115305301"

    36337

    Returns: 413771376

  59. 66538

    "329473545790411850343364064713179028627822389338598855106875222121464871153888620102948371531871197842359484090099559773973647489982721674822430456871503793662493171296775204220477811483276075788327131767930869432239794883686746633"

    7758

    Returns: 942646708

  60. 17814

    "24430950431191217662032652000966048276306423403353449467211044932040915025844582369610636624026208867059856117400139478505130698616158930023330736096151491967213942284722670987281014396951834780046908789877802039712304964462668888067722954447766793284515446498400373584045754916457137309924777147201877594267247730558846998381761575462825410575327653438917391099258758699762834171934903398663891996258157344975312190862006413984267817569505932992488413715833994467014241812276047098979067205008875445296774541384345107877"

    67889

    Returns: 790929870

  61. 62075

    "31528342598707819044240982081799322799828457009462361925363137612213981807113994596115220762937174958018002013844600736029385528211052992690906557352906798049283392824275910865955833942788577320444820992330201969265056077419503789514691589647636301088102962665378329341240565518953347115999536662580782676100069164840182051480561062386815769965956042701217253226209471099230092503734552569969413217388873430070396279280460509554230175750771836865291356337765959429222907193998262743249648886654345286518710245987003501857108873850128504052244879538388349331282053285215388264092950925012911308009453469194354223907625988968491239075067273198807127008167358732178071747240618675047125284972116618967190681550097732311463"

    92567

    Returns: 153561556

  62. 59613

    "843223194156279788251638772780437185782447620115345217150771883195179463"

    54317

    Returns: 44057772

  63. 107656

    "989357641841520331531480834413577552061920802005345748999427584138148375509535396911898877579694815378713130180653"

    93028

    Returns: 685078380

  64. 142379

    "5894747177239941579971709866251407098638520294637331173962863454056647504653556951145259089640144791114894725973688813044106241892656160342728696449983032855770794579476902670494478500443877463331650955076851585294850361215467499542700404831520708159941560778109568128232863074672912233512574075312276"

    96467

    Returns: 964961239

  65. 3910

    "280455833314240218587796362714824364959441387858209338390991041740705148915002955871035392918858802017074594598552724728338062794037767366506617765035566843652686704324175519943708596"

    62580

    Returns: 973592298

  66. 117369

    "3563857995323513334308486526612631704538270647675909060011358756961334853785452551869858820792205506148596237183221793770017845590464283411270285356237148879462266314797309703107931676220100351121217897338203016938435740175248233951403044002922157588688360028442667124954449943509549557744402843270069142700072475588613178594771563400998799502573104309129271993324106143171972619345127735103812314404429029010417076702092866732453230929306403332199089866914717772767118843519957560608063842808613738251051895059898247397970029418946865702107750701221270267230722145744742359273707334124606248023253788160123564024343861929130686025512936239045132763354335269"

    33264

    Returns: 535532292

  67. 192005

    "89958692012405353874303932640058199812209685286448940926680363623075314566712857364692592764805848905360187774891178675625255894485539749005944392595366610180822677120746016429437338369115830590474200318224602111833027737448597905821982427824030096366525965629550300619333750759085026505602280035284088239672848012993520665890637154512860351164732209146869095672950792348824434435492456502346011353454797886691840359077654448089311795073923085426922711373998732832887636220660064652"

    83595

    Returns: 692751278

  68. 165104

    "5112225317623598465661151395346498494960613058760118550392672739173323709077729934825082442152415967688828456761846961281699560466782000840828666682164119592528514155683531780350738870012750368525451750967305363350779407878747550482170997022350984113036408047158550553562877760969436561995944993984495688859801914941148629236513899107593512624826459388158114831277251472634499862260582493369528562473520881182590198807387426989602200615307788792154853776035300403297983743420630169689116231692358420925660620118825453858549069447691952502572424324111842186115670062523659101670690855055786132031059204646592223903112189556964"

    90116

    Returns: 21638947

  69. 132986

    "466132896164511032038902678531494272733111820296802783445612459949832636322976159833568286233113477102898356779503824045187761378410270435453489605831826298797147144136110434796273634057083732534906155147562"

    18081

    Returns: 14492764

  70. 177084

    "2092278093666538528221518155822872297068262392085823182648004"

    26287

    Returns: 527779785

  71. 170293

    "1769375271840613300392443508268473973900357254309481297792085489378842403662315094115117383677509440025178040112683680797302665301006177874805257394251614863755165238893004678588164480806794313287061060595765525861236533220080636821100996891328683764242905435846065764766190005"

    11368

    Returns: 171725990

  72. 166229

    "82184098582965706993942738884195961349978501127983437670177241663613252137639261027947046237038750181228065103083801"

    2149

    Returns: 690242649

  73. 126124

    "891628561645477900217644412093774772889731876040346629967997986347405532797394580708740271652099"

    56927

    Returns: 78805469

  74. 195862

    "2694216134599042414069118564971560096166456980363612508818375975841708468083090379702279088655679058536464546278047604333359877697353817945101032234091883018683096953743136569919579941240559591052643892384201443112743005894109532120343290767069176811355803981486835568328608788187185536460953883721466979729836002041313654187270013894966064590048479952990530878768251164674374218328418882905271957230543316410090815603892495024030011158709861033"

    42192

    Returns: 784186689

  75. 9322

    "7401426278662877874761854785519252696593394044993875074406241024499832053875767382193689632340941083750974229658045652878658747522125259045650069183530434111062974009110607043802607778724076951026737797058486609880164723276023013860706905967422050084921931167117805048487163204838731374584970257578974121117523508710782000285502228977824972072117634593305298118332092050525242089239343158002019602311804189067348889540487400168006701852054536194726046522231664374682066455404912761220006139082283343332722605098732341943886001090898822355463439658587778358837274717839381615060356817519083596439140153152597950224600033449025768"

    1152

    Returns: 103746831

  76. 163345

    "8962021421365852513638293288432326769778806173797018503053588196505975020688247098816731161629853315206248052354025645818459264037856467221640226461379474491842237141242009217052404163363087692752042501209209141963874241764531310684336740578896171705658486013700948479882968785336711681662090621376904231668878864449962665892297099610313350270004601664216290197173201857114871839616514083933760494614009912707733004271186638556947202183702842346031897644483301079293617746465834195213814457577665139221050595450607505185746133009109687305050391052150273865861564569672584152008090386563239031871142942820352501525090595219733469178690863477933611733282879002142688837293300814449721096161240461458534928035714397230365644147090465576226576828240898099049036744974164398629"

    4344

    Returns: 741010268

  77. 44131

    "4581938498056092199337297337327498574737417303619653447762415584132612068221637914834854552203502417285341750772898094857824677545856498522866035882291943237398672730242901020757879193613999397054738001702024364832402627441429599453247400576325058684273322711134334036849944785625216116506968848113557753810967347572828107041416159158456478886882785676409243345298550794106456968367477040209270123810770325092456423142326313863069681369446120595847733521365282870323410684580647694941267394400559123682295148526781884142431357837018403096978568524742278747538298006595178172262214533522966037881165524948270133134552324340707744804842315609522394747512595673791530271402428618999225673208711611134871353633083617707745404695508552374507942018835900758196733321409"

    22803

    Returns: 64550262

  78. 101857

    "21240713450905431962738642495084758423499896919645601082298060812369713063417213428529832649487799108610161643367100117069894967743963003640158184490534919211348143813447298247432123369557128324324627417092723732652789091569258495221399643225467230754295663437504064729370914505474049948490332088145976399772561100298450106822933932637051859280896650268887944414877644208158430076832366086788554850586792025646388680802478163411507148783472797145699187598980642855479749547133108230505066063947152118688156340874219548175607403563576518813842410309530118423426637779345796148570202264295554929359838050866661205184714718153291296345264102267876212281609038320955203045667608239864694542550591687409055428153013380340836990290388398319928177392582324951295532288695187126181"

    54815

    Returns: 348708501

  79. 115820

    "27862029339357215439615591380580333837245736510479016135079871542194196855967436737592255709363520307688422138129860464396300400712545707949450219922204948329709104501601572078163106087603608860779864894597659357844183409950419345502145813312186490266160980951974964858724399596293903176817216908390188310542021723797297167867539285910820330142536600141"

    57750

    Returns: 54444393

  80. 82754

    "426378839059545629458940851768737615720233361428221650601861077403156777690876042636841556950816473269180750271689049406661292795426910556173488819143913062132614688899801778956259385702914765717083662966872992909073305088335551345463733451408496989292601628336228007517888863873940872824428364335861420337836281005744301204299309331493979726325451968304980716591339338403146689082395270632788650254135229880735884000616092807093343546715978530063797193393042650449006233963196994633157078467016736972138756512610592584681503988348369728404"

    66678

    Returns: 973156765

  81. 107347

    "946679440179051687929472655211933789892742108026015555047500153575788684327420008497550786415731148028"

    28357

    Returns: 602954295

  82. 107749

    "183039092449011974296286231168581828865071047997568941623234608134128947290066649953069556175083418665130801464511895755239052813221814198696695745405378158522155949504894693589487810719792319667768591200430325543504469058229519259972937366298686255861711039900095553036985269485527381639057001033139121660252357190958327936911052919528556933562553201427068512613234894669020962409701668721260705881197843007329559919251466430688786040032475557748357083763995147511631739107689329311032800897752943538416851521413627396409421429672839766241107894672324071131287272284284921228171859152074387714268530739894901933578841339391414623832283678054948324438869954895130502212489343650926955912025976665011129432911996934"

    64447

    Returns: 273807875

  83. 116742

    "72541685419610578839160875305469024353745752566815292899893909100190553377039217709738858754570369388211834770696894244658254910933470555053422376276755136520001248569481196460688285620078372780444757482796337853764211892960493097830758080944842854203726969869383323409312636575035680840680789711023652351806970690619734173227243994897663477752417502582386074432041076228020"

    877

    Returns: 583605430

  84. 15687

    "829175608184099859234461102394703674470639048780487674472164973997057188488758581385923701924415973616256386313479855037483205015080072988245126772658641247224644262807476132672109919442384416684359931329107169759082737122566527582807095191240189805971843790775610198234750714085976284647790510833664646405754215254331157688187987232156883953923392198746365262766633264082858477424261709857668622109994896577494203231547503395624321755876397307612177946573357289667190261252782466026222308015664442781166375838684796393010698912495724994874854563135165411728950135087222259417783223299495858203451341832040193846933394468140931601899505071794594107871990431779691264183839996498625"

    53181

    Returns: 305991977

  85. 188190

    "7627735058454957981114340631244667199154607174425811190566466813784547082282740005839158867623172986354621867515404210426889305407409936860672014799680927903596991191148423053929400567921302588789430524817623324031458078710517013743865359435472416916155421632450424532142468604932698536667231428102766466422563186247516849463980204475853198596129888349300281312863179679172954811604514962841950285837897585931116102739841700274148280445426069074710601362083409305690239227347117605722213896795019468811487355812721792638660538010171736083068175404"

    57631

    Returns: 251686556

  86. 120715

    "9209040947098183596657015254672610380870662617200823871216380954054076281900000236786217978277770845401563647447449672838957126960089856983605092618912898344372956754218006341040006475916840224092562246798474938161556135841512029007819344838069169050364355134460280250945395912898126989263577902511455122975550550255452413640490807557839978262391866366668812714800885487047042282308623338934282364974179429185189738112029559399801890656652460731943956792447130200425875715500563338551891994244665204871271297960350650560829958591064650986185042650416769489705164784470511367976350622517817961662767701032330260083176406767440066847454194401952044389407263965915518404784568674185375425746381289364329711158034540397682912950004046342470966865284395145672711982943669853470299501206643745326564212749428660995616850857837539069665091314359221556222163812396021341130204795802739423533213388729"

    17777

    Returns: 937788126

  87. 189573

    "765997824799803257379017830689617259577589838397054504478244107524835567918640315972625121058265175274913058940978045429776514373547388801936713473560282916323001750059675757219776511540180737171398841255064471542923756547208004556933117856869927849303043674220911971989069361767241533453641687099750039135955246766503952432"

    83246

    Returns: 485055108

  88. 106642

    "57104913858433080481380982579643289049170377897098840498995707756993735496316530091477960563141770738892439241934013235431852048604219081418036579602209239913530226808463459501853584681795457914355779651689637231501154810507429871861688215770066281019936703389416419958092729727100065809847151960650697912118624373584882403376194714752503982730937823149861705656111655409812404666991943809500315048820934883523131861491785727131519986932012864"

    92888

    Returns: 277633271

  89. 47269

    "896119137229292866228136779611294397258345662832021295901849097331293298215384979565047391251703969812232249175748407605596492158057880074355530078620503753613175981714492268082646691047770251007881897638400992700711076986933558000265448932290341696112309892980757921039291976143843179842538902652412624875942989802153539287711943407281631293245232629176365499549483262390483154142188466409770301354185818644980915910055220211158865120604392670630858961597859512405058695164254585404576200640549429929620140514724643903856"

    85486

    Returns: 274899120

  90. 113992

    "1201827074795189913343134976118563625163786093671172352680091347905786206775478418018163890443375033822128831717958694251838767953632999595265614894446944386353178185411201382540084217526939817598816372313964533907952129899623491587462851382750960278737724673389082273493072298192483803693195591297262340306997457477807120049579602757367846219301474380277751130291502113625354052417091524597211059397593572969687538576764962313993633047997130254154330081624439792422776876555120529721910039895591558584219674832986241904185228534258304837545092226502744573097635238033525467851661284801802243151687487057471121132507242782142886627471129056050630475493219304424657121218283499765838126236624107678799833850240702228256267680163672523199537482258846995914162289137018759918782205522398048895441216101562459621717145823290042069391331837255567839617267134"

    77585

    Returns: 816309031

  91. 94568

    "25504562145594081972326260363244357724029607634844009678890624229767021125538846813976812960528675295591833269080448103946995327504659847014051084251487574689753807856894210371446059676140439928785383182043952162057550747638672365575007355349598051760862900159389427767269302198540305997991366142969634195507995855894123437510838182389753464943628111440726879383501769628418614173451679587489100089015201353467480537070134495053908672586515003987306170287683030686018111081277691634546884013248409982367221875553874239600627763093468738071000269749530663926290122196420891360032167423710496493416506181979551484675888917926729776756582340722720306345263229061801"

    37400

    Returns: 593453316

  92. 55399

    "47154441965483335500740295324489742060454351662191224109777186783533921329267"

    68310

    Returns: 340246085

  93. 56497

    "1625156207178962659490571206835937215190347074391677"

    59018

    Returns: 599496307

  94. 137711

    "5276461414078787990892422343458833349688937132014233823806665548995950669734898787956660054300097500119347400469502881173254941840751567851643586703276025195014410394292661827286266098121482503507023833046873755750254629047618757543196868580606498256188821544948432231924211879414689623655654133370124263782988841739759075783240915736103936255950616416568782700268449892504776232359454087834807798706796306489784244235422159865127256093448339883397732639031236807652937872007077776740730746520955691332849672546789760794585906054110828740345289252052018179382163835702519072367132244582352520241913336967140887861535642673814039007815054279512357061650281134474580220272170193153410332452478456266890698684929840834128351664412260477157453671198951317118314550158"

    33199

    Returns: 515642829

  95. 171295

    "137481225690384936616761547316668630120264280769323707521529866370040310614968691857098426336476165868284078356255902796986494835078602556156473713680078156749351155127628613069637163083874495787631517255901307659872070662197663847770492139302700596337624320204278539524895298883136117958093631255821074247706452093352833071819067604978764340059233892001219018583422779128272574114962680368130845017803299721919510588022631548848894974431335854096447047525214590247820639522517418514167926793033443605353967870732796796399961510730961452315092813844036271625779194947542896563767660135652979060197072646836191957588550994429712040708956101801029897584562505649475233891576084740924128573220529345833167953804088430819750339462050122606524030417685051365619149509363098351298807694598567394119466537480401780677896232155925550235230778944633121526535052161558661355570462114005377617388459070823513541943922383512804571552096288141594090856841220641669608903"

    87474

    Returns: 60763164

  96. 8723

    "956385313153010111467465456214704821439429633035607078525788652400355951781590062244852243991385517476230645866517736548996273787496278247728728647678864598583995227622898867532548229454609312648378168377764872918485189262790964008901250193522829013923199652309605567200750198965938728488227614673889514853669520112846516024815945782058707347774444939120454969629050256982217719265714111288621418360122558368872515362073962608563106294930157738209498247377616317182515431289643084595291530003813466913857839268288153035216446844280328820718373006808213102134346816505009855260995856810399349388448813230590778365644478164"

    5145

    Returns: 290083896

  97. 187876

    "31759527039962908202740244766397956649976409359527506908509620583061024673988006898727758743948475751754685659115739129306381409977495279719908226912404996965863863184715766215651201107675191439321410174433229209314325668087108832181990489985179025190999590159637189957176418257129116276242140391422710797756501742161498871840937374391066983540271234549060711927559283941438687685055988127680404922327364908649310225688809673833029688139816225676993167335686538901012310179867570341522144892221260399652612053854028757548117593107992701154039804664019276332443130230525556301038967964406673387024830704001228194280261315052608944554578331145061259655724741988516552152413064611458911628946646420065857962994931964252859421661089150962309517850730617913782018423750300822088902879458732379869422746930313205036907155983433700079284827374033366479422989036886850181211"

    55267

    Returns: 468297693

  98. 181564

    "1830632020394923871665308590645906639190003008353391773019020168092307758309034467304655179048981321155394073305049023790923535944339593079831282616917179823935045806133291577021316437504048249929866050611981966450002838406433751504167322830423858610035201518834124171015865137003113321317530428437874618470856053927151068821510449853990005450089478860376309026761367456169010370677674282768401464471072227737172605564920910982718238845908705788868553593780815623444607882395696533377983226035896298925387126887654294438751007061797602934252482262860918146325880875564614762688525572743466137043014906374212806503343063298806975005344049503503084571491753924390484367352466094699697290"

    57084

    Returns: 138784092

  99. 189233

    "702618306146962038808187381711343086888450916422551782035697865398117983085732522057935774913076611854234276871797001761637489622617827243331612293862645120587031199671977604673417439311776145493147697227008046895350142779331089312533402285736791981080657173411903659461615978804674546460726648327856987888892002655358962094552343000296634274277338041090598910326210340011829630969023340950063690156511520019658096359062271055460724299274239685802981232"

    34312

    Returns: 780130229

  100. 192848

    "4074817168437281741423413555558093445535335550966974037336218857436077623274477285022572947861341239706388129405703236005913437580406976872072735855335216852919593471032609664567623689061648067171163121247901112742053771784248774255408110644011796551384618801379531926801498098647460368948542531174529613754509434808525589230910490899767813437255610302479650022939607269122150839869246741538904717431617354665590523610078094655259510416952468164571383194996663427755949554461169022205918813763389"

    73324

    Returns: 637154813

  101. 184585

    "675665051032018401935273007162966234824820820819021600108066623973121476152839312351981753544123889308778398208281993305662858953673159452523632164837675116655903437445358818986411014229141801760108688426162772696751812958601315499603206870165046774444844244992791799497500640252335154762464328243814201620192668011749819873930172592541986128573883124960113172746367834831817392871367740571725597571674565748054811631308696192818"

    56732

    Returns: 518695631

  102. 191976

    "89581293805807754074738948942187896960806352366400731398456284663078848609369379819960129639304530875087798850921675262276650875325228655736944496457129694292343774186826485543582109430351922458727098857827236386700951319417702260111354084403152908716303134865750799593723893420164400554705787145815564341654138983127122256690376244154310128855961871050342045743137051607157469689218470500974410743805410552145453423301670331714672076596670514319125459031751556178237074948588146196225260749501446826999502725010320287813773402477143925906043879308021727841981281561692655284390705228512420571382511135694534653443632423528831097743422389668655132948908863255977995004571069779899485126049305851946369904933808116938769783254716967205405316700141351475570309858743562187303244003976944658403614379509457936922127359279961039"

    83289

    Returns: 316488044

  103. 191103

    "345488244932302733684557969204669932433637806444643565784568094938016716861044685343081957211830752179068093818764703061259116859579556323084314504829004460048510973649065179877373714674381685446645240849526425400451199389424559648343054641054795087984261544217296333706580573834145692990568624376714378031455483667829149477679618205907540419967935997948245969944555090495661880514747239111328394481499665692952818164480366349723462672272326833413647556873048342509176436207570970902512962761993202573550610188844970665012762105750264800502879026833305917905507621766089960190681910532505040214794674715016789523502174003966267558115160430594542057206861489826425361348375472020710668543108692106784670481478927586382401560149371807372478494989266172261862563305437711830859002154798927713034244002"

    9849

    Returns: 450852337

  104. 188247

    "944621715272467124454380253198295831127384880715611487233953052698054799634822564655585696710678095696943146677673595825298995666249499311485252896225218181998763406053073166576963952902941413816592442753278291019108398020175972765703962166166925672787668405457589845233716342202895315009726409533301209832328094639098775508892865456395163447691754515080075082743168587462181999486335886160128303945958767332361226812618313107675816315880602000122976381918888576507851312423430640835616989771962937898310147496671252630097209024317"

    54740

    Returns: 344065003

  105. 183064

    "407281587665744842666826396403668132950492870599119659107314059471469598368993433398196426724434732087174382946019235719186816387664598906555266186676255873562167476350849291691540789566624274471"

    75052

    Returns: 210796723

  106. 200000

    "123"

    47

    Returns: 674454204

  107. 200000

    "9"

    1

    Returns: 644653841

  108. 200000

    "12345"

    23431

    Returns: 420027103

  109. 200000

    "1"

    1

    Returns: 627183764

  110. 200000

    "12345"

    123

    Returns: 588256859

  111. 200000

    "1231464"

    123

    Returns: 180350654

  112. 200000

    "123"

    474

    Returns: 10955231

  113. 100000

    "123456789"

    100

    Returns: 730506433

  114. 200000

    "987654321"

    233

    Returns: 53759355


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: