zoukankan      html  css  js  c++  java
  • HDU 6680 01.Rikka with Quicksort (分段打表)

    存代码,题解见 链接

    CODE

    #include <bits/stdc++.h>
    using namespace std;
    int biao[] =
    {0,510449513,495061266,226491030,634685072,416495341,622433855,515371779,357921372,873291668,864422505,244143480,128436544,941257754,367900057,12274495,931602511,219570131,793522901,424243793,165736797,353311552,592734296,986878535,677748474,45513528,358081215,856122652,330742624,11978314,907969740,452707782,233705792,385513746,753430728,998842553,752492443,855641031,745578321,13447582,265853810,176156019,955512458,145831791,287984286,234752773,866894950,123033105,146074373,414721266,211535148,31417664,73453267,51357566,893965184,218147054,409513200,312391305,384204047,164482310,977778800,668183958,876546882,385223263,399703865,155307713,769059546,846133218,395699018,736347168,504218398,864925539,7348130,40343052,323014902,355562371,792235771,67222704,388823273,506030177,657514755,828866714,163943444,307156587,522268131,734214987,330600050,415102041,732369989,958639411,698555650,543848543,205405205,609646251,427902610,428951372,24068614,108254283,375285950,554889225,249033323,823876456,187963345,515800679,238570548,285148375,454563848,788860551,402401317,845104027,274605739,715411803,534752496,137179100,179598563,338808663,781062916,67435444,806479724,149879577,994414699,338575445,528856067,321958428,614949006,608885782,778315559,267758023,309547532,874857382,56743518,594482560,365442262,222389338,90475704,402157044,63367920,11606592,776048109,515808143,832425005,423219129,834082086,492089730,755114647,829118770,50121783,622072440,383229016,172691624,354377916,440777386,888064163,163488849,268342230,435655567,909212173,544971281,717363536,666527863,159046301,297168853,304502285,481645206,511882109,162937071,139859023,807380480,26948473,255447522,184431844,187877423,308529347,216342877,686969760,756250834,283476365,648767475,797623046,86584246,200861698,258295295,211862206,982048020,906502274,901660772,940168655,463452843,985723042,153261065,972009731,750627825,438184021,256477039,805403058,869619483,472526183,550881607,143527490,21640478,927422185,647960282,459439689,611783491,862048350,135734976,753319882,766179650,6353477,161667681,435907069,74627262,426340528,14379051,453569008,741119707,204275908,241203965,972554064,963493742,489957190,360840131,863819000,702182142,187668384,906042258,381172096,654198674,689069078,912004255,791698432,462834573,325429359,232440775,290767548,306799763,853497372,62327731,393908668,834826966,508431604,21177341,983574821,890252585,821284257,108542774,6721305,15957617,825587379,329271903,240263064,570969128,992074536,396829288,66422736,576987022,738492836,849199365,862878342,972637390,485649473,704461398,55528617,229497710,683537230,680622326,430657706,996592916,51917624,212873799,717071900,502751490,652792357,85267889,785383328,624151210,598138378,761830774,285925304,12608870,983811862,172840580,358348933,321299943,621552173,707663439,173523851,355252572,47194692,40332383,521406514,509123754,165318107,849030687,149851460,975029971,200272018,431483642,56473545,731054112,587205928,359714155,444783584,101775526,725866983,608133297,702484199,284214789,443642729,972162571,296993162,466990963,802755903,578469911,42564017,721500554,928100865,246299009,282709524,966434273,993238219,813723494,366254747,538374349,454931268,51262505,39177861,546942930,744186365,890050882,71578037,702100964,150260073,819164935,695676350,360906467,287663219,559267513,557383628,599198883,184731867,23656449,243079395,730466445,647856445,833028231,300800750,517060679,630689508,675526828,82224834,486147848,144289956,644402809,202831534,268408365,440465913,779033541,644922039,322277945,146356515,369747890,809694192,15651784,920785540,929728098,398019681,552857087,216760687,885217807,206473409,186545862,134052117,293873582,937110679,863220082,929977913,661317833,239649838,691487458,280428957,561151427,959667623,559883686,194603443,226748229,334784733,736432269,288571884,896333554,877487170,566774862,246219926,639511755,359720967,994174733,560968183,250246836,393722689,480206495,27648222,969380176,163635920,596437578,46081301,808783571,794962380,817013177,237740693,934331179,74852114,641221210,301842509,167020719,139144799,775821876,881876593,16165454,609222491,50252686,135151256,178241922,949307602,182055295,615343120,927497455,508641614,843429760,325218057,345261804,765008343,203044195,922035933,304559481,131738901,887165205,783016013,101611371,400807206,721218119,519437663,653474236,153201615,80494292,507717442,957846611,468553180,635717914,884892236,361370002,528227783,51054710,901634702,18071114,691492910,414230982,348928385,424631737,859864252,990380731,666735328,937409647,525499302,288089369,860508567,597180915,855499432,528913314,114791137,713899023,42744559,359280095,574682855,686375784,483686281,380932379,780112131,498052316,157166468,659165862,348308161,390728214,796619581,27349461,641385821,492753477,183826132,557131234,337717070,864842924,583552826,766253810,373533887,570306606,989444451,53005468,713974341,808904847,28552525,739535010,846505392,949198581,757279029,938520848,378597498,685010707,993425102,532039776,782663495,753297474,383307622,185274328,739800267,677057900,907775956,56790451,996069051,110534182,985819587,904165794,684014983,44701843,688925229,847764234,837238307,340540340,377114620,681077600,299137000,600641904,621001948,711297955,716610169,168442618,733664648,816303098,515398726,506905804,813393169,224402692,29935919,447596203,902765044,333579217,287218425,73162324,239655144,466721235,768792993,419255534,967960859,495678936,137820581,592999657,890536840,46102073,848735633,783236908,838114003,881888738,899095549,989634539,738307375,460345213,873663766,991028554,64625874,960793484,170325633,469983434,346421501,906722089,579256539,707586100,173426596,502873189,564832445,600673831,418218611,112314571,478280026,933266234,299537124,273207755,609390051,600984357,919399553,817085776,957728610,76792102,49449177,906310922,424877041,685603510,336561430,659480720,595166183,866354530,911931874,161697044,313954869,872197975,425895744,788913249,363920841,302216867,164262079,258097943,364944814,912904890,651621754,566164418,236635323,464020667,718328494,545261467,849994556,458338363,230579420,916110166,451666784,797798694,573036629,27829443,791363924,229887728,655441210,942619629,866735902,339643107,245148458,228124190,572373273,145590884,721218028,429220589,64579601,703417389,439405605,454839817,590531119,364627806,617525377,992316570,597878960,10415563,413104100,340275009,544291413,488506913,444303571,493816125,619340827,940888259,797787390,911668327,19413945,667704527,503126428,586826826,967438882,486305516,109906120,956641340,199592854,221166498,139999511,43451078,619731649,277927302,988472937,229858217,331904220,879931045,423436709,964954742,542510040,495818484,273110602,564476608,27762076,771649180,919238760,690103165,642821869,149734779,470538559,562542421,763611221,746572469,436593785,886192261,388870971,277196111,85009668,703357790,696280123,849082867,733913888,879286442,337793070,808967131,73592928,83185553,215599806,149070049,133686335,515371731,413256266,230161015,679839510,604321445,783552668,512626959,251586309,898569029,431221745,968205226,621798487,927115165,202666767,692714387,738025035,126535588,835591589,452686251,807830916,172989423,535397088,743030508,304533025,324069407,879784726,134693224,442605124,767505123,313497435,461428341,50086575,192476422,452091527,653671600,932281840,427330592,359257888,114178294,417843316,998532017,486702694,775693921,148360414,391568891,617284012,902291806,5180421,349961983,867877729,695742231,29858457,806821794,110161307,454047410,394191286,355675995,998807045,425800918,682062290,772215362,330403860,779966066,106197609,631201068,653899419,278845086,810021960,745421655,174132360,415051490,302785827,270258946,493665953,702083892,861007091,583632765,316278994,599523469,521392811,312470027,819019428,752557153,225245427,769778291,717279405,488309754,908188617,125639917,513200311,232454907,830452774,786715232,37662220,772398799,917450442,87542929,327962926,727733521,543623274,175589235,265935661,362912809,832022217,919282180,89216593,798416190,799707685,208826213,541995711,789237203,811327460,589092010,347457723,666939609,685791123,418924547,803733897,238266927,156940657,923318417,233340136,512203284,955556994,982680135,181661137,940648561,315382555,462747556,656985208,858267374,753125754,30502632,849791429,121344190,130259846,120992723,633961438,764669391,585042199,107982581,814469334,63457094,79342097,831130541,705755080,78382234,385275397,946379206,176238412,608668725,461248866,220670054,546738897,775980757,63789410,834787623,655771915,990009683,233145395,953103469,823927324,721523222,663448222,184792859,167980161,36981220,213272372,415050990,367501996,52331531,980069171,396723742,527292495,300474639,97224406,635676826,347591824,728965062,203816759,326067769,620019183,125614207,809000210,433305391,149678713,366830478,593329118,491444733,10183998,898947320,173936492,775266403,183240845,824039996,165490279,843684036,252391414,742940734,852488278,462658543,111875677,67742410,741430771,226229892,367796190,28842580,975187013,936440362,93201583,846354160,905604909,875438790,811725513,618816543,657766897,880321579,481231168,392931391,293639154,420116804,682161669,399371296,921412895,280050531,63186879,796198818,787305789,908855177,282606605,776161563,828256550,254989923,648040522,571813380,623659232,750132711,832002693,434985504,167246354,515102338,394760353,914455783,866273132,170758149,240384389,695097175,861714677,343962733,627396240,41823152,995065244,143814712,910126292,65713470,906844449,943084326,729319794,748987208,920551977,6989712,718950855,134664340,27314353,36717845,30885751,36290722,394911040,797193258,489888985,134776466,626802517,623525858,857990177,79423657,311396324,111480090,3417414,101839528,609811021,384449351,619335088,694321292,21009799,624122840,893913690,395631601,947558317,484861129,136821273,612533677,648615310,491876740,197002259,364563193,484700996,960895916,156588815,967332432,56821111,949684732,752428759,198811989,828415100,140757393,268134197,778064088,157844369,60587384,631651452,652942731,618273288,777297409,929088576,597274585,240840266,11711828,895645492,987862713,261141731,139423083,243335026,812354799,622523197,949840869,267269744,798669026,917449896,68174041,880303165,345646526,720191034,799786482,673037844,701019517,632942474,996681237,889384119,510231805,441817211,247806450,860310596,323825832,402518746,385818265,130616328,803490332,486241207,718111142,262589274,767201985,450447311,29699603,803764385,641503608,650420167,150571001,966781678,626464450,456261302,105987172,635155997,792411205,783940885,197798577,98425646,563280341,644284767,241697627,435548472,578424970,821953942,848458612,655763355,736066502,753227055,503031537,257079377,249686601,461725775,344960647,272278180,735252961,27013634,360891270,859375663,249532730,148974453,993052378,908618184,978909319,995140173,381593218,677676661,493855887,171895932,613674726,477510323,654806062,77430107,661254362,371885112,750748437,345342759,188407268,812739063,446281879,322904407,76560912,751351149,986488468,38457856,341475879,336846243,237772505,56844208,259479496,669982391,504900833,51573461,743422100,2401359,722734582,467599291,688224280,412728662,151598545,777628427,486363126,565288951,612022141,923463970,601373771,505674937,539919730,591193653,383601091,674977830,810478974,806884451,90376447,171578513,74431618,486169036,181941697,197511949,630070599,412848059,435995126,438005975,652245740,285729181,917666235,206065693,69724238,956080583,91181668,254695803,754579310,444906463,464152616,281743378,979380846,424932027,487503561,825386513,274180000,58374753,821057065,499492349,679921453,493535264,413197416,16841983,26406362,614335615,868467263,684688714,467416458,606878833,793937499,115990405,407424839,224639808,557219858,890786937,81273332,90459977,496500261,4539373,641187062,162620855,203286077,396386378,910325504,354522490,116627435,64248365,843391857,639255035,824893199,272757377,748983955,185023592,587861571,871335797,570137858,152671161,868735536,845741401,271707433,338304079,108866144,59443498,41114549,926223695,859261935,713767160,415214776,377609480,953198023,888666155,626385564,713878227,300552492,879422061,119379026,425228258,80081937,751374096,883491016,579883473,195094597,941921899,337717895,337548170,797183910,298292262,907875236,118023765,845002942,488076920,2562690,30474449,357483642,163332992,963233003,442668132,541625898,691975740,293200370,665376079,117793825,18555543,635904107,266198454,235819724,992711664,866529789,272156388,526516553,209616810,325545344,946449209,620259289,29155216,942269742,916389000,313289176,815972289,228230938,769991523,459283423,704037713,870894682,254772672,773010101,810850597,993464992,473367106,402417165,251658973,958763385,992142239,218592221,656909264,613635655,440736427,385907738,12668879,499343419,989478731,87032838,195754071,272009601,193179418,364044115,226948782,574095062,307564707,697224019,850296129,497401762,928001586,11769408,964968772,672023318,58523352,200828805,134196388,499514694,545302594,552504608,569901214,826679696,345902237,136688378,702944090,923020893,626429654,867502795,965108637,250729672,235592387,43256790,885471615,566194000,518314622,417786774,69535539,765768482,717404377,430313435,646965910,957084776,816136458,376199392,820138819,300527691,177570941,868991895,940303564,677173888,598277451,261508387,621266899,349443880,635005193,903719769,807784988,265725745,679614715,197041296,400360200,865383024,12145845,29723989,64775490,176330189,608287745,856058522,40159213,620605784,977995940,660529301,839277180,46106246,312955263,900731769,382906486,829338381,174075784,843725682,765393155,825041086,191333842,739840192,650583872,834428885,777086485,704842376,382064978,962619959,960491115,970347755,480391608,22221182,939730579,371053449,11156159,560689460,467561813,960969165,369600855,408777943,792425347,355397591,230758460,821419066,350322427,101675142,729875186,940277004,181951446,843226558,941240159,871410072,3731239,836645477,486631596,73688274,982779849,942471957,327943908,790207570,80007038,337965919,417646841,225497109,680418892,178154623,324778314,471086239,217873149,620746078,859571197,477104874,796261579,798982491,567986398,56158394,235589165,572021192,690639229,723091712,741815629,659794667,313534307,668444088,558160609,758775325,622235607,310845841,416732765,843025044,399145001,167021654,218062773,360907121,146212794,800306392,623414641,542423855,404657053,937922925,428474499,146109241,62586382,857855358,119326723,683009732,842972407,512541672,907376164,849594999,181045967,639449937,163066288,882165967,676831470,115100245,491346627,839480306,565705803,629740895,71576242,188004259,585568921,880420249,779506269,977916673,51251900,676697332,462249231,40096179,370589090,126400566,335103934,365594257,462715832,378142337,132203790,334488170,856380759,362595689,404116742,308177680,356781545,686010347,893599155,451791264,289233924,673742483,93299085,539256285,213217657,832381625,858294631,267861840,897339254,24264041,151452132,765375598,250359250,763444858,55960721,350845246,50927818,134511915,359050737,242200990,437258988,79210264,258258190,861959744,51536486,348717514,192288750,528547327,762084647,365312673,899424823,937427875,496780158,24396872,313872969,868197407,891666077,97068043,89494048,971447369,440457212,939311274,327328903,865671068,605212522,714660610,703497905,796896389,503943869,766179632,586668147,237449105,856959992,339474847,84350996,204116841,633511102,160624176,407717243,650134153,401811836,416124883,13162534,777285953,83505148,664775581,935905497,58998984,750132100,244784747,136107059,692558254,537838870,116434850,659759007,310099218,221605811,141201203,772790481,190778371,642208850,438983173,864827061,221595582,813998487,816782836,662926836,72773576,232985374,646682490,302839852,925776037,884552674,17411583,748321995,892256638,740093707,902066633,25243137,423466921,271940874,177159184,290147569,900346095,402520878,475723489,966698797,406891331,458340948,540944795,612233791,498519280,834581901,440502778,134635910,113233294,668594850,751394100,76464265,744676718,732156356,229849577,866706973,408233637,691366968,412272826,284229104,493213426,380707121,474338936,15355105,40724862,196449911,137107391,244560210,205868885,805163109,392833791,469875119,58598502,869900298,185549717,372048175,88716157,848724213,581831901,491929519,385557741,413943958,296657144,203203825,424301227,296868137,268399962,590867404,84912666,718680348,262047493,818410025,288135284,646584130,73886456,814838044,651692958,221328165,7000909,839178846,817121161,674778513,434310196,437828479,658505431,388092904,344180597,916816092,455529540,978703082,425723697,922412139,26567002,386062633,615765455,61152056,10109366,216927427,891326769,146212144,344963122,52207999,808159217,414073328,944782329,310770590,586483936,18750906,867843915,497130612,166700291,361291412,52616268,796529604,634680369,32046135,201497308,949984196,482192067,760421199,348002400,62884754,630320276,183330766,115923673,159074417,289979110,180830509,20699327,760114346,76001329,199361067,394154152,764788142,37317885,370825730,875786532,836657008,217218774,599662648,729425617,883874610,601992199,326080860,491695082,817307299,975957102,126930207,982059407,327758930,480183886,372753904,356158910,205527048,438175657,613957195,816456451,738453408,962062668,235937465,215332041,791984131,512293742,956414738,102829200,406858885,532619592,453464534,542033235,321868150,581842088,289629648,62113173,801912872,666333572,654396202,894288468,588071360,95081507,519641448,243822516,194177833,601742938,801762700,633326119,456271527,2287240,259406818,218902597,934129193,115987925,219142720,940240373,992040561,706226629,201326849,43289305,140091819,764816959,924645105,704197848,695423679,189965082,212158663,291561865,376475963,12022254,273292612,174170868,964179888,50481422,827618181,938897598,241470914,72775540,176824048,857452898,186798296,718384151,544066461,347877558,891996596,26283850,698837520,900064890,494413110,528420189,263197211,831546910,321508657,458075614,894540834,901288111,483893193,359639247,240216718,678714219,129300310,300996963,235535894,116953132,388778591,608222125,261620977,834468413,393907014,800304265,676671487,874198918,231586877,26309771,174293106,723577617,326723824,334880723,328100674,220952958,147631640,280836494,72702397,358478362,886026665,860499532,296120245,421087197,850119988,857070147,617225688,320678817,323511547,719122543,579453566,766304967,680871371,854576617,284509118,795597584,616123198,356712149,977917332,118044115,323618792,44794869,166278255,155390300,755121031,138167246,141903689,765093339,432995763,9591961,205467620,939170061,815407194,930155405,900745565,609930111,964673515,499140448,736444612,746462772,507235895,801983316,537945634,929743773,956291955,815281965,752490202,215399594,454082867,154297905,809297963,573711155,756086788,39200267,618625545,494247925,919069901,545698999,955700930,875395390,296639704,419813706,81754762,212665790,24065033,793222234,333181583,535807083,628845319,784512103,659517151,804677108,336173260,353130674,245339529,104752787,898170349,681276005,162746058,950312920,457514692,447576675,708309950,513328973,476541450,729962848,56249760,969584664,325140454,444885323,10957674,928866077,369455444,163068407,243499504,597441887,236133049,642557010,959415355,286605520,4643838,838992080,712314195,624059923,122936675,511737200,76510980,560773534,808645685,418115012,710848212,121851597,749845658,185739953,155537681,900587250,683482096,338078980,456284236,887376444,130383541,914506793,956440924,327423436,489942561,670901049,794056852,699770556,688435382,262241368,986679852,505203360,605725366,653703716,32940126,121264304,389966122,112013500,269258149,256018275,174616118,945116709,61751440,294385065,16533364,359903176,732696829,826647426,882349189,769740953,345436516,951924414,821170754,601534754,34278243,427257029,472142671,352928768,202007268,797440365,60950144,85494231,207659749,659953922,386343218,747039882,249432208,212676218,627940607,495922329,817156341,663229386,162594371,245214335,95888947,822559385,534777672,792889687,31585693,717775706,622167854,729290384,242332177,161961576,488424521,523976167,378875798,429216190,558895124,957285374,16306251,267959973,887538185,857603062,477781406,928766204,926763784,733760854,247554958,182030165,254127777,186323470,194460317,565783195,199326026,301017824,351972286,285007464,342368770,317953786,700477473,371055948,332015929,519088983,797523980,990482455,496777344,48433494,261623785,704849983,925991432,904042694,312182745,869256952,659412184,873191179,674891525,684838777,583872163,933083468,397980044,306310582,548325851,953566126,935596739,231567254,255567514,539173794,582756816,591885438,742387033,120464026,751796982,722226998,816703021,166294027,895203451,444453409,510311184,407577363,880073454,312096526,775485422,480699237,392846069,957519877,181563654,501500283,978492989,530778971,325408466,901624076,845012995,205922382,814306836,114622894,246620132,551268215,55072419,488035574,896127887,61117568,180096437,318297233,527111693,335157330,502880326,702564291,915832472,871789017,34479339,605516194,469831698,159501974,671576260,192143068,184801108,63333600,996339979,395567982,957199602,270661050,860972367,548834974,665233199,694107138,453823394,216579524,599511325,421600713,236350846,307805011,427887152,874698558,971876411,964070632,220370802,742671447,92931867,92790105,216251802,261336061,199711086,567190179,571732912,132509766,50326015,44191002,6575519,736688884,377544725,695530161,687741442,379631467,787385469,378495167,934116917,809656778,378882099,311914217,378436290,283539053,639031720,29571370,144039909,751288732,739339548,238409432,935801192,711654018,308835754,915549628,135049942,722864045,60179451,144839929,346567351,339701424,77689024,667707551,977779934,345264695,134716596,156292100,392142918,483269694,814863389,564084032,744385629,453951422,883338964,583460619,71466156,257360199,433379379,516695949,689940554,539683631,172955575,150258716,404757888,664436879,270491656,156987578,520513498,478647934,661999104,88575992,563954979,704000206,771786466,171026589,727003786,405907769,9501527,937216655,177048158,339323841,684336256,773292246,272806818,918527680,135265831,266476781,117636819,656302811,912629962,197387914,190415084,325795686,827572752,637942506,433830540,250957747,35560036,86649372,241819197,277293960,474022135,960413034,985001074,333641210,566494195,993667304,655231228,822099123,93656307,633011247,777523570,734661983,959855230,679761107,535287434,994744443,753084894,933707877,806684826,39514557,347661309,805992947,740303963,499423329,649653964,306922630,688232255,309066623,679183606,784429469,267965688,797096827,912484687,841198919,813061921,811466744,169116553,484739067,877139143,431621025,96435477,936151086,122007605,27031111,40167095,222386099,186694260,725858783,247798653,548055413,353588778,972318087,792686505,240150145,288111716,404556099,988625917,593915711,575416104,781016944,190105558,974040511,813681606,569896163,472261258,848662152,161162403,286635942,771939210,963393302,180036883,647145485,292679104,748012438,795966227,867078782,478757143,552144371,436285296,79544609,203152142,604681466,119198269,273174815,897856436,661414808,370355616,596716010,234221635,175903774,307716998,855342148,244324230,558014156,710715111,447105269,577680835,842557103,699463025,120804971,26816987,647761214,852932993,698222645,81380009,930087837,75842155,469496523,444827809,518757372,906746563,527208096,149929894,580468084,785565257,46463878,94157560,962808486,393363583,952894860,474257261,349401358,722313938,847856820,132703340,455284486,716947545,935456352,978814952,768028776,485321408,768139322,149466038,337474259,818133424,449709761,719327102,51428255,834397888,50065424,880064265,656532108,480545482,399903322,595612983,970343828,781751022,622286480,640345686,915915972,752519731,551653718,349436776,541292337,130905251,379440060,683985780,932946253,122552163,15815503,463105707,820795864,601513894,714214340,699986839,561084308,56864274,825744293,25023929,927821337,733370657,813090398,779706351,733185577,971085687,778867792,242653988,493355873,30807204,547362784,499626370,898710629,354509196,731851956,776516550,732622694,561286260,985461026,501428810,397243150,556360392,860903714,886982849,830568624,424266876,835220362,358954947,6020278,614142178,175980272,580525808,45391892,426677533,720500244,50591583,284675596,956358581,464904202,499187618,992832835,433405560,971884604,18792795,100468246,355314786,116089760,24026430,602561888,846575247,481977458,467533102,627961412,397367744,344601835,807796649,128244834,489382745,832701137,899428937,775857193,867789818,472454659,146990712,313842970,333541553,942260075,186982959,428644270,539511012,876526713,334571296,641057174,539137016,232022494,964806468,733458399,3429505,488597894,255427839,770381465,378251060,102972380,712654735,282896708,202517875,54939807,530397550,472669618,981822076,424884162,946618026,429000182,712828107,562247393,979337480,791153378,80086169,941678041,166492172,380813459,448725697,690251818,928328527,391384781,451799885,697863560,177920599,247276195,940440545,968022678,656476993,723704760,6862450,776014952,523294602,990391432,266651281,922386905,831205677,450222893,914263006,485318105,416476688,367046161,261470694,374748577,150698687,907090816,792591388,718872798,623586853,967754496,70617318,202806516,356491945,187227494,709592864,894649342,340995212,227758744,384997146,745997503,85770005,434106232,897435166,358546416,583712235,505506961,976127735,472635792,246308469,433022142,855927367,301500795,399364910,925306466,553384376,893420760,610577164,50087564,486012330,776090649,359588401,293193088,290453539,64381444,900749468,819853381,461062294,598389322,588439484,835563214,679861459,78776443,335368639,383891322,709754178,406502969,9464944,727385913,955940176,422679695,469138597,62379494,189352843,953955933,433047385,632339662,921275562,335462909,197134473,791105510,90982388,697113136,992702073,941425695,819058654,152463630,618503306,514362303,579669866,496493936,132198842,985792641,526543291,810411204,921823631,967199464,579779111,253799175,689618462,802569306,172235398,207939111,3466088,174984809,993036578,935876901,773629721,124214645,690973204,815952279,708179270,167721528,112728508,417615753,676225788,55511139,120358961,96831321,360029379,748725309,890289784,727668763,95946038,677100578,193379366,649091990,506157852,734208616,698568132,495814369,91739625,534370300,639620026,875713333,917437299,239738137,22875110,223554030,569307107,556350645,325185638,44489184,639738152,287564627,375952770,105196957,625050823,714422073,695232566,984502648,264275839,283776420,721885213,424862880,436886849,405962932,631923279,339678602,481101169,514898236,783060489,18704332,250643877,962854467,94493256,805170383,170123793,927378051,727784022,90106929,437331361,236435423,972014971,82743273,943680838,431104161,541437611,683886587,394257689,658569976,559061508,349240257,509487207,625534885,151559091,802553277,219739753,154574972,474550444,566119441,995893242,291670673,127482106,287885233,413717532,535049246,326484092,526838186,158665213,574808848,825779179,61230769,321333396,396898097,210146204,741539871,338538425,613752283,66139004,540672891,190938487,326415838,986687633,712648189,507683361,539027686,186595491,254802452,858140973,943351157,618006164,993941835,514473389,815418027,285171125,374812133,785212068,841012079,6762083,390914238,947004170,356940889,850403791,522262119,977946598,180714144,252804914,293566861,809251739,991441525,252425999,85725790,550071002,559052099,970840666,17362164,674791873,234080609,782507814,600258014,532958495,788747926,190633527,161863618,515292165,349129469,267975677,321758207,765945772,110487493,753858061,286588514,198961257,564207601,545775687,515529383,114314882,708657122,577336644,759608332,391220958,794618433,26223768,378389347,552997318,876244302,451095489,765291631,191039082,566219778,385644533,713241273,470940086,861038420,662179047,471302039,339170953,808681330,205496844,460391429,128519978,443877361,298868786,623158887,918145881,523544325,969623156,357747003,813832322,896669452,72091257,161123157,210766727,442939700,922971942,715127150,911269264,840862596,701064210,439454302,58956171,263589052,164252095,564742507,817446823,955289310,855349003,954398156,512996385,783006350,808668962,128853880,186441374,506370592,217034153,395152814,562123962,543053698,323732702,388853256,879054514,455676725,199337733,618403646,335270569,202687218,676545371,540085184,40432125,742258241,714189893,875173272,497220725,479602452,453493821,119573046,696344185,233161415,833489420,581884114,16658857,62069372,464892172,242331802,457536900,51741354,529686029,503018179,982953088,487234870,749023774,152903581,93165957,585136351,703039876,359754575,811905597,540201465,437834699,533339601,698591767,242625834,540958519,988006217,161329116,492845732,957086293,463638775,541492358,880893256,877386891,50707814,750612804,359783228,771492049,480765770,735416643,743821270,650400025,122525643,704367412,185562787,717161397,448892147,20028966,137060515,307235850,435369723,458474480,142439894,827449208,8389368,195496869,4865924,244870463,304837983,353310630,672972490,55484715,276027945,380682668,513038627,850524335,379985372,118166587,905291518,932401582,211893848,974660115,903022834,347883321,815948160,743245893,826826295,593229838,926995831,393925284,270502489,134665588,68188188,75324444,523716997,419652933,738083950,437708859,9802233,586855640,707823152,8525852,471204977,410600445,562955427,602828543,295476854,632470439,800960184,390087540,224460710,94356047,417291492,535795093,975202568,273372564,109053821,168048524,161790858,370441106,283278575,811766112,679497446,560919419,402801880,345451396,245731682,574110201,185872191,691516413,892094057,889445157,76154184,934410358,250650728,312078995,97837522,522999247,42379172,717618946,36549486,198262081,151805270,313109410,349503781,543933427,755922333,833287857,611851971,156519710,121434747,267761876,173292556,196128456,258855538,210570975,758742260,181533796,218977671,990489103,914938795,121480099,877008536,397203441,347422277,614779558,419705787,455355284,737384712,790070820,729924309,934737056,568367282,618703112,982224803,668520966,576205415,109341373,796841501,837257322,791425734,546517554,421086494,39383600,52121087,986122725,389874999,836570111,893173418,758819725,147624059,873240975,324467158,330829777,257811494,527146776,340487965,781098666,957816306,417901341,508455664,215094330,883162393,929245618,945574716,226236520,175388161,769043159,419753172,437641990,252516203,903151534,481035782,432111303,488877715,394060662,167331510,939479001,389832449,251187825,812295697,208102866,476219898,12048686,432035520,749475555,339939483,561475190,104998482,766712004,932428891,287862884,363576979,379907901,144117988,186948005,350520578,73213601,596170599,816173907,850036889,582877549,203849544,318531504,461107418,446600241,764386297,691701965,664027680,786146072,667459480,51378146,881346240,407128819,832785053,440710349,297426179,218391685,996614613,808765793,837033178,151762204,217175385,66636216,240825113,502117777,746393367,498627218,710803612,983998138,327052993,961003227,471425801,957639919,899361393,34473192,321814775,208575389,115121351,535312988,556577473,559701131,390498738,473828819,777343050,459731845,639628186,92645550,485258407,900708320,478929980,670908379,999313551,365332120,936888590,806785182,130439912,23752354,694477936,607552242,106549277,982481702,470011911,909078613,549955930,38017505,18954239,642913355,908317497,454683080,321739345,445012379,928239001,24127146,733572363,978179669,719419026,466851084,728429386,295510759,605435479,402339543,806508537,941012756,728907289,380161354,819930791,331836205,23947160,928866811,64890802,465851488,99646847,678246677,787758169,446917629,648941021,585526269,981042958,63565967,867918927,813243938,473896250,875013826,294797718,48912355,496464984,939524733,678284346,464779387,893245042,124005487,14567458,99273907,577435472,961807995,426754999,332170930,873947172,568294282,470478502,691482342,574783214,901607194,430065831,69420077,524252119,630134151,225940727,867997431,282990323,616036094,580794823,224226810,166433099,836012104,16107965,293439121,913736465,381199542,858851383,951482241,369440165,385160736,691940287,415986925,11051625,394440896,940638022,233202080,646593081,142855884,118819165,737730470,407754858,143400421,540674445,315018821,61237235,898858670,354433829,883174615,565620953,75507112,550876605,998544764,396467496,249406817,309225762,599552872,505166049,699288816,834081565,82021190,713512844,792745084,725552038,640727227,173407933,992679941,770537651,782476471,877503539,641197818,242998882,731795908,63134102,664470910,277263769,305214706,198351415,680594545,843246240,683991497,556524451,371714984,294460073,902541296,298535705,505511025,305820709,9634147,670996757,795768658,640430120,616617684,956882847,972058439,812540805,514824376,536998948,214633569,32064642,54538831,680022439,324109206,20322421,966578203,762996213,604237655,26167825,224870386,498462174,999708039,782732781,480498094,341610525,710984562,222506344,309104176,101876232,729397560,632912980,562402524,769770838,902326992,710460752,168483667,876757278,644842613,637564787,559464575,577599637,680981741,192442833,479646963,629400695,208659669,238776503,231844065,754678967,79664427,5227987,676638158,973203401,785822229,219413061,400902540,282703566,791629337,184649766,5154417,755929364,86336818,419688245,350610356,763082447,818296547,490849631,737178013,244681656,654737492,559391719,752187938,30106385,887802336,315604140,293383551,535456583,80617513,263927073,775066767,603103761,768797681,675147012,330747059,382642023,358916546,927781525,475088520,956174562,568488854,165204310,297660038,528909027,728245137,676954343,275528682,424321083,68041915,924098536,43053573,418971562,772920380,330006919,753880585,159598335,220871088,916453069,101680857,261157344,360591017,202322377,225348261,136827430,398097364,304719792,172417427,461335149,142132782,14461455,326322762,201477755,144590808,940651971,894864793,444572055,598116468,449470191,766382086,551629994,843491012,236401392,527720664,863955937,632713898,992432469,324866420,517638439,338685314,809511588,459053675,229458914,385737507,375659186,917649518,842081737,18000934,389723134,503908815,513281630,163664476,575911027,440571037,847451914,868064506,178431520,206432713,838676574,117523246,395697991,757067966,512195510,332311988,619477218,933797150,460681696,34091833,30036801,162875589,640500212,530113473,372223852,281384886,374843013,971895373,889476541,374025463,141632954,419486715,664968262,592577322,810874768,441837477,560806012,402377044,277730860,349131958,141582100,563688169,492699307,459258410,28993999,382602001,866087431,252949835,67532660,275064421,757926120,888165547,718556363,211610343,883779249,788699000,526186823,974728812,221414591,540813309,76670126,909638770,297140873,505112913,550373058,253568844,678849837,230695112,543145482,10135013,201220794,676816314,97588679,529840452,348672108,307620340,265199957,303225838,141056563,744194836,859549158,344574689,957544254,45070017,694886864,566864756,182057732,416702580,752119553,332678387,363142768,179747625,269310582,797942292,875104419,671472238,839000982,889536809,141956234,871144191,432828431,244053422,31559456,550751102,599742223,879625494,5351484,863588057,46072828,159622049,772119414,419651910,127486372,210202265,479000011,116544796,631631002,664097137,764532997,157439021,823788379,121638231,104096584,806230401,497404852,569879516,136593017,749267405,401637141,426836656,236390488,994698501,123070653,212661717,461755907,50429711,735336860,392018848,469356139,52439006,248940518,770928124,961739432,225567991,46032175,805374512,677982197,742704241,467799798,3116917,216876995,410307021,135372709,703799339,527203595,222535186,399777817,985013993,642021934,253420470,3183598,441011489,220189318,172586062,688525283,485198586,497987342,207952414,98819501,589643470,830667567,707979029,730830883,800469773,135177460,321444296,664080712,924963201,614921193,797770426,439443144,522426930,379714736,152869796,191161599,724514899,8697057,799390415,455877012,484205379,857456298,311821821,809846930,789500327,147462265,313790309,249632537,538086448,505445678,755121732,888504396,122754937,397430611,723341799,350954664,577062437,422608006,830853005,914361291,208182117,946968817,828633208,866839156,470910912,697186034,834907242,21804180,884456061,953632760,358422042,853781361,356688422,549463910,77818595,21991191,474439328,423492272,677921625,338699210,532272310,880100750,431881780,228559751,82767134,650517134,769191866,401195523,72847710,45104958,832033094,611402674,450258763,790320758,301276016,185041486,836310836,45629963,203132225,127120526,429275074,371858840,828055216,692007566,963760363,926412295,739064226,61638097,919603521,970406563,626220710,531963047,337967417,708085579,950896099,807996795,675350865,747499292,39041386,845508114,685700223,918084114,878951536,189488564,811009829,156896108,741041557,660375830,905406045,852727995,844149661,143047328,947663553,733279310,523556325,14027100,521744927,133607141,642885334,644467145,263945771,537167100,449050229,690538240,59093678,906559847,328671047,209504379,435021835,536437215,944318457,562558297,132337907,754159731,724340234,234384821,40309694,68899914,60641162,545206714,152740901,440104067,342159401,936463517,685461162,21141353,369159917,773900431,521542275,220686323,51844983,878981518,506520691,868436615,403260324,277497997,154767389,528599502,84252756,801459244,397126008,596933250,126802322,706443002,785064450,886356967,340915634,803376781,291025793,595751683,335723903,820417706,273596409,840958233,554233346,848614979,38889138,99050571,584514730,31291772,803663745,835444528,299378047,119749436,272258875,980682860,159568958,573822172,227204315,866177836,823791272,2361389,659115828,659537327,826392580,290572118,583336562,75414668,293034630,563728589,176989829,441988157,287863563,391774080,73823458,611040452,255662724,321881274,712370297,777432333,107865603,93694569,461366416,367300283,90307319,14995929,30416628,443768696,540592439,776100589,188659265,986516377,854372122,106700093,316236692,427625833,571145734,142595119,880688948,405894207,576560978,702595731,921600524,990443375,799178397,758319842,755537738,378067664,798985196,406299507,687723639,79155016,761241366,288102419,181678708,800557524,591514358,563680025,995049892,419390628,842894838,93239540,792325251,538319810,364479437,929248982,690595123,303818416,653553667,680035391,430770027,152863924,494810195,964037235,459347336,396906341,353612672,755439494,634024888,589259183,183188683,436379064,456897771,780374760,265307874,382041323,133878881,620262915,428246646,904993862,612062168,247558200,815066406,852134598,360131724,572932599,185215618,434842542,363955900,241429685,36926133,577254917,738382529,806928249,684965904,119227170,25340203,526240458,135423116,405513206,169067462,175932813,258760447,492209668,911790896,543249481,408493332,69290302,451445906,950266568,423504317,715638881,899614386,904972252,487090646,208761441,609057452,194296018,752028407,490192575,738661683,661298157,824434893,992005189,324131389,299656786,519288609,94845579,113383029,273270184,67615522,734090516,106261724,804561750,535591206,51495046,311328050,27024508,286126739,999000059,891389020,450537071,793384162,489203638,682237933,190282030,525705355,545818,799365850,975536076,435808243,722204973,585594666,60762207,115466094,543162161,211086709,796374702,751291952,284577992,702344140,213237893,641294482,478927517,501532430,545129197,754191042,373510719,450343702,758709324,585674527,612283421,729592683,844687444,405100069,584155250,901454196,760153055,629995554,207756774,252979653,868151374,248768866,157536987,224188633,219984121,108788789,642271542,339449191,937424567,799591551,26840644,955655354,556354186,200736304,615721648,875288807,486007157,383639952,461846043,333221125,139360552,818886446,728979454,975277940,594890278,423495623,9449109,71219030,566486389,804960918,339971306,539966755,395092805,571393140,382914836,957253840,582526182,667039194,894019235,124357458,649610343,128292237,143367102,377242515,158576280,317604445,650804215,609227513,596889368,200696683,154556809,939972215,355483022,555693076,784427709,694441103,271098111,587931548,175728593,77939121,997734698,468968927,187480417,369193253,505863700,223486325,802381580,321493702,228819392,394782589,370226389,869348552,644034559,955293642,372897653,410047983,916376866,454067540,414509112,830454180,734682276,584254320,837097879,585754650,795647523,42014288,376048844,274517200,243076223,473955184,536079680,540369281,76301628,170043624,85321830,41895072,744258386,186061260,538943890,699872308,347579422,142952878,409287524,477343779,315590580,24157576,578693910,320185951,635550673,835043338,84854827,180162393,494671300,877866429,252425923,105073640,745211158,612899157,969169305,34051620,17504146,376198991,313548536,226346366,727830902,424029943,598873643,759004210,530792620,623273441,837729445,746064106,61123923,919843445,418248460,103043588,795794832,881964306,952335175,370144654,583484055,447945265,735639407,161165536,786400703,514276400,943583475,545505419,629878352,142983398,115043151,305263806,792010095,683725298,585693765,471795317,26169499,710624937,931797763,175849205,176598862,545346077,659171050,153133386,686772959,470156187,316204796,455628981,905507544,932467799,718944399,187146344,851453877,612604287,208239873,330820866,685680627,584336780,128399365,634660113,599264928,114016685,467228146,24479644,632494065,653528148,562471281,673317832,971210000,407805857,361357477,793666471,472065796,639790196,354908864,327806915,755250014,559575508,122887463,782069256,845817012,24928880,788270643,88745125,207330417,941673106,488487830,620696279,372622051,434087202,240185027,925450969,873371734,232201957,562881334,108203832,354234329,641050097,749262921,273680469,759237361,192861139,270860648,149358161,1476007,892209652,168185781,34032198,712013943,107228627,385614398,757198312,973459302,252436313,443539006,273881905,501412749,657476268,263431597,742391670,391429546,962304204,99628949,135051138,336339512,727402582,47097572,247284428,886767517,451335529,934958279,875817088,969701493,243741921,130106184,439762594,979996176,779569129,937627320,115197012,826744150,557689510,116765651,963453936,656999381,753297291,70193953,77049754,550605925,937959675,764154820,789188763,586691612,770406051,939114314,722474438,582983333,143429955,162845789,222736780,421251518,696538066,744609053,723887859,716955114,801290169,782363330,377826186,903284806,6887981,559135890,627461197,595104843,149560108,284819515,471683260,295370076,653310224,116552050,485374446,131070275,768078957,162593085,478238835,689826325,261353690,900401548,415299565,449042317,765154676,455069043,305904670,227030006,991246256,929022030,904155508,742097015,933724422,795669566,383481804,195050738,717981881,617382714,350600356,722470696,196991994,247141986,233953106,231830149,970735768,600922624,558397934,522132762,784917661,555952434,119226344,375252005,787643991,279828225,205652849,607123118,308756421,716848432,507067534,115406183,364879478,568831825,442058150,488549989,692828674,625900822,523833,13107297,791154675,485336332,425545312,698095121,980434283,496400224,224849709,757663343,821688417,850979219,796739715,205074064,747809920,392541964,889882034,778284315,818163427,49440918,499873885,547854329,255083692,278094956,213436980,242469313,367162718,358621325,864302696,955709491,996095636,501122518,185059195,988373066,584490432,973088084,35387941,715629309,108812807,291548513,316074342,672654356,455852908,764026945,837873249,265398682,419270740,798056591,28931487,452380275,812728589,857721642,735151662,940344278,671782847,108934654,578795432,878982131,98571231,600734874,642306217,49868159,144899688,494604648,468738302,332419557,497335392,399900095,429870287,663489609,241854495,490553256,755320407,701397095,733591603,744517026,522367191,982357293,57112750,640189289,222768313,690161344,120201601,656136957,982878899,339852494,51005059,382734053,321068604,480272015,580579426,938967092,136698192,511541509,201102127,85985681,769351062,455594584,11528419,708557225,534976132,365668372,995775069,219395758,754733234,880353489,819618127,541065943,92263051,387947004,493114512,922062766,141367213,13661294,288375168,972455297,814486242,972926730,607704378,420086845,742535186,567482985,427897362,737017446,882603888,694554336,977213063,214293778,647849310,441281057,511775918,525664161,459475254,714494182,230128415,914579884,453905494,609083453,609734543,531223008,973477580,480311127,298183341,639086166,644790257,76088180,982336955,773906468,378031344,28507290,72584778,39667179,677036791,740970020,708631325,141947289,195984414,334732632,450969940,212866665,748911,850642309,891357283,630781791,87219810,533850554,252996171,830640744,371809157,238691592,320570722,814679399,581248266,253211514,366116755,545964833,611998954,965064403,816538087,151284840,107661209,732494458,74281848,493428287,402278749,720873627,869542938,577198136,145165113,327272338,366158975,671809729,861998053,80792511,933459367,928424957,410694883,241132031,142976596,639326721,727917566,435962734,904992332,755293812,189386058,967354599,415695746,183783578,346519201,126208008,875874452,255739966,762222522,319382985,243861777,139896785,589798702,386612177,617875864,218809919,746762772,638855906,240240406,496481086,615933492,17492523,339207205,770818623,100040858,204858628,138632577,659503117,163277216,400107466,60954951,575131221,40781330,816279961,637748994,615197021,936516872,155450759,502139451,468699525,669130335,107666429,463266908,679320901,99634520,728880585,924499776,820930852,2438385,966336005,765587913,592018344,302974160,313863436,953490990,689445012,933875200,375577106,429761970,434601721,903737360,56978194,333714523,588648240,333011689,603109166,550791849,324211302,255617732,559846301,105797723,28078572,392738567,180953751,874782636,615687145,871182463,725063672,386574242,753960885,940059014,445215046,789663670,115249126,686163748,22915443,797331646,109042611,240892019,179504813,296099830,534073354,599704,919492059,245424024,885011019,242953746,519076000,460078693,335599952,782225631,960344451,963798160,428863879,382981253,389182485,982477773,431461796,986954262,256037618,608818637,386533937,762712235,301022867,404095953,521954013,603811587,594439155,408890772,589378271,527573901,481484215,923396767,843401349,865192188,61667016,804419215,669594524,923824797,684198593,577654694,12594079,473270153,771111933,944726828,502847367,173433855,998514707,9832347,868345122,289857478,48186128,175830050,760687683,36318272,61127688,290435409,324603857,274595200,652793445,765672629,847431696,66515234,705217284,761840598,707686355,949626493,548639393,413796116,594283679,393020210,463009544,14262306,489066646,892385075,795341152,320712334,919891802,911562592,726505952,62632632,48695411,571667820,606113068,295328934,434242000,998940579,35734014,255810783,369938893,394173895,110938186,687172273,577977186,689931874,284024922,776744328,521166866,162737503,11589397,440262369,385993745,744750435,299162463,786051532,651971699,375760533,617624320,716711358,24795698,378671786,893079955,131565099,771504286,513093994,157594375,960179405,729746743,588372453,251073938,347267169,727249191,591922502,629487791,72288304,648535157,837270389,896679015,702912586,421875936,276656509,187964905,28719546,912682236,919945053,139802758,970628991,576372216,654715822,342116348,768859958,396916647,130117321,690015904,206391445,179751763,151196900,649200852,161553498,236378337,79161126,506467929,637638252,289464350,756306808,533443975,334489715,723383977,264432326,909130510,64476395,207539041,504287108,349483324,8869718,126816655,735303458,984248551,601192338,88217792,940626855,299386396,787715170,341204386,206676817,712820895,45404711,35444544,412892915,546837483,50933173,202380200,748299039,600340368,492847403,396152079,60347702,144849509,7033409,576154202,103571852,318341008,13830171,428822423,644104457,499894388,35128660,147503773,337412840,529489672,55635155,142775671,236132328,171043451,679731656,154121984,418408819,481409101,404288935,731194065,771229349,11045087,962625050,668778691,392646422,396223117,799068099,889374265,220141601,681306445,541226603,902189981,396699137,799858882,511904564,368440221,101685527,191227155,617768487,54186796,472446116,556623367,253323074,368969203,489482566,251542783,821350251,680592584,892993821,393178217,968068239,209396735,863480510,483976360,245921995,741765299,869107694,524490796,666889860,790485595,565996419,604727849,949446538,729377170,256151540,861122726,514871350,214521579,867973744,661122182,185362730,71750985,681276367,862778954,149833465,327222347,469620107,137814958,31169641,39204599,22272959,343226648,508637796,979203378,176665131,609651759,809447996,483277919,842600481,292634998,490410838,6525507,778997864,607064451,359176597,85255683,985420294,677866479,909854394,56877706,976290821,505727187,98981989,324980475,492435644,641091091,445130243,421457827,439010601,899501973,291099409,690553661,413870646,169793523,552970302,362485471,14976817,108498701,394481989,223540988,424446688,980341448,429788445,494034003,377903138,527750353,455507748,733895705,728930543,184324864,1605440,327688125,242686483,24236147,163648402,907614401,434584545,871136028,157559447,7539992,721957762,440847124,298282012,269783650,783333338};
    const int mod = 1000000007;
    const int lens = 200000;
    inline int qpow(int a, int b) {
    	int re = 1;
    	for(;b;a=1ll*a*a%mod,b>>=1)if(b&1)re=1ll*re*a%mod;
    	return re;
    }
    int pr[lens+5], inv[lens+5];
    inline int f(int n) {
    	int re = biao[n/lens], i = n/lens*lens; n %= lens;
    	if(!n) return re;
    	pr[0] = 1;
    	for(int j = 1; j <= n; ++j) pr[j] = 1ll * pr[j-1] * (i+j) % mod;
    	int tmp = qpow(pr[n], mod-2);
    	for(int j = n; j >= 1; --j) {
    		inv[j] = 1ll * pr[j-1] * tmp % mod;
    		tmp = 1ll * tmp * (i+j) % mod;
    	}
    	inv[n+1] = qpow(i+n+1, mod-2);
    	inv[n+2] = qpow(i+n+2, mod-2);
    	for(int j = 1; j <= n; ++j)
    		re = (re + 1ll * (i+j-1)*inv[j+1]%mod*inv[j+2]%mod) % mod;
    	return re;
    }
    int main () {
    	int T, n, m; scanf("%d", &T);
        while(T--) {
            scanf("%d%d", &n, &m), --n;
    		int S = 1ll * ((f(n) - f(m))%mod + mod) % mod * (n+2) % mod * (n+1) % mod;
    		printf("%lld
    ", (n + 2ll * qpow(n+1, mod-2) % mod * S % mod) % mod);
        }
    }
    
  • 相关阅读:
    Packet for query is too large (1986748 > 1048576). You can change this value on the server by 异常
    解决springdatajpa插入大量数据速度慢的问题
    thymeleaf onclick方法向js方法传递参数
    git的使用(扫盲)
    【错误总结】Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.
    SpringBoot集成Swagger(Swagger的使用),生成接口文档,方便前后端分离开发
    spring中后台接收参数总结
    PTA 03-树3 Tree Traversals Again (25分)
    PTA 03-树2 List Leaves (25分)
    PTA 03-树1 树的同构 (25分)
  • 原文地址:https://www.cnblogs.com/Orz-IE/p/12039239.html
Copyright © 2011-2022 走看看