QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#335256#6740. Functionucup-team1198#WA 62ms21152kbC++1756.9kb2024-02-23 02:49:562024-02-23 02:49:56

Judging History

你现在查看的是最新测评结果

  • [2024-02-23 02:49:56]
  • 评测
  • 测评结果:WA
  • 用时:62ms
  • 内存:21152kb
  • [2024-02-23 02:49:56]
  • 提交

answer

#include <map>
#include <set>
#include <array>
#include <cmath>
#include <deque>
#include <bitset>
#include <random>
#include <string>
#include <vector>
#include <cassert>
#include <complex>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>

using namespace std;

const int MOD = 998244353;

int add(int a, int b) {
	return a + b >= MOD ? a + b - MOD : a + b;
}

int sub(int a, int b) {
	return a >= b ? a - b :  a + MOD - b;
}

int mul(int a, int b) {
	return (1ll * a * b) % MOD;
}

int pw(int x, int n) {
	int res = 1;
	while (n) {
		if (n % 2 == 0) {
			x = mul(x, x);
			n /= 2;
		} else {
			res = mul(res, x);
			--n;
		}
	}
	return res;
}

const int T = 20210926;

const int SZ = T + 100;
int mem[SZ];
unordered_map<int, int> big_mem;

int& get(int x) {
	if (x < SZ) {
		return mem[x];
	} 
	return big_mem[x];
}

int f(int x, vector<array<int, 2>> prm) {
	int& res = get(x);
	if (res != 0) return res;
	int szp = prm.size();
	int ans = 0;
	for (int mask = 1; mask < (1 << szp); ++mask) {
		int go = 1;
		int x1 = x;
		vector<array<int, 2>> prm1;
		int cnt = 0;
		for (int i = 0; i < szp; ++i) {
			if (mask & (1 << i)) {
				++cnt;
				go *= prm[i][0];
				x1 /= prm[i][0];
				if (prm[i][1] > 1) {
					prm1.push_back({prm[i][0], prm[i][1] - 1});
				}
			} else {
				prm1.push_back(prm[i]);
			}
		}
		if (go > T) continue;
		int res = f(x1, prm1);
		if (x1 > 1) {
			res = add(res, res);
		}
		if (cnt % 2 == 1) {
			ans = add(ans, res);
		} else {
			ans = sub(ans, res);
		}
	}
	return res = ans;
}

const int STEP = 2e5, N = 1e9;

const int ER = 5e4;
int mn[ER];

vector<int> sums = {463443233, 74635785, 562074786, 997840619, 420212568, 757834603, 182556177, 444832180, 815302335, 195380453, 362319601, 792540738, 118645482, 417131208, 594375822, 834457057, 199756955, 446388490, 586980259, 290139518, 295677403, 228271294, 813394814, 44432906, 531721631, 399240043, 583931411, 358170759, 217717639, 325290023, 239439976, 136299549, 895516584, 572030161, 212980688, 240284950, 896496163, 964969071, 345677456, 697893222, 249082989, 957195894, 185883585, 907733231, 305373255, 585878910, 26559674, 577518250, 58990633, 53980650, 349657739, 553249858, 889145284, 652577621, 401960547, 468209107, 189929531, 462540052, 984021813, 851174202, 217925297, 458369223, 3621520, 609723106, 584350030, 444072688, 553084578, 42073478, 571885897, 805133334, 130758782, 862552068, 401328662, 630343697, 424813122, 121403722, 731020154, 893694673, 42216452, 630282545, 577868830, 234644642, 272680974, 206138684, 873536468, 872952078, 897290125, 573784925, 288796085, 509235889, 497765220, 539279702, 116652585, 944725741, 730041929, 207105768, 967683496, 816522038, 812763695, 103392255, 428357499, 953791082, 660943454, 604939691, 894758404, 543202657, 493138862, 963755199, 825367766, 66535461, 267573576, 644522359, 28624297, 292279831, 575065262, 124419294, 173849343, 389783303, 619352015, 769241876, 601185195, 904781723, 844535728, 705830559, 102905204, 222518537, 594264246, 274071141, 875733550, 993336349, 823017313, 372876779, 181600718, 328704433, 210608944, 772613435, 618147997, 705870243, 213529238, 781424278, 985004804, 166383507, 249879792, 584890390, 274552591, 370902428, 996329562, 752616066, 868260192, 274300720, 501773275, 927128294, 349728327, 256582082, 543056192, 501856405, 520256893, 957369236, 701659455, 722460061, 101542213, 439533205, 32490420, 348985910, 163616689, 989175662, 695608781, 449698035, 890058053, 94612159, 554398470, 581947367, 727273052, 651582189, 804016663, 565618577, 757847989, 452107917, 116009547, 151896626, 792320888, 269295540, 767074595, 344057709, 135042573, 532414883, 859372067, 895689141, 341525356, 213557785, 393007699, 729635715, 302291605, 705936067, 255970354, 139957490, 951821427, 238687428, 629238473, 719411018, 314654293, 207779101, 102079748, 725349308, 589115001, 877582093, 362469733, 335277397, 882622558, 564571936, 483064917, 978339827, 343880071, 524040841, 884056622, 788921878, 766915226, 815412435, 966736317, 468064152, 644145995, 746329869, 572950259, 708343531, 768213775, 813739048, 849228485, 715516098, 12137926, 229119619, 230267016, 24876084, 647021701, 937052094, 558474915, 765743270, 241786612, 685283838, 809412385, 419333824, 315257418, 593574920, 714158436, 798960008, 139643921, 250454369, 707571064, 451545662, 215356884, 498787671, 479134031, 750996169, 323791467, 749982643, 593242472, 736533090, 290981367, 207580690, 772121724, 574316731, 803024251, 673692481, 424914212, 533273342, 629387139, 807891941, 320912423, 509292778, 512185317, 737709666, 783965252, 979157666, 705285409, 792214770, 869907424, 164210366, 516266714, 861672846, 812306759, 827061189, 471909015, 278692770, 791773345, 325349599, 607026220, 602026124, 998173107, 776156635, 427393075, 788046673, 63333449, 775553570, 651508768, 429126406, 992608286, 110493759, 50191102, 938418582, 414502408, 833066730, 844051056, 653164963, 42427280, 113626983, 447857044, 580490250, 712095489, 889852528, 404464923, 134832046, 242606660, 290533066, 714817143, 330147642, 716880082, 736264119, 736430288, 52733175, 485362036, 458657452, 90936133, 850285504, 132512434, 842802635, 864806418, 602593766, 998154611, 786813415, 173979117, 553015031, 628179291, 288793139, 276374791, 212178553, 372952852, 728917490, 596927162, 503710975, 533349661, 54110136, 48027231, 235476507, 718412216, 510262532, 942498465, 654213338, 674138508, 544984693, 123504827, 290743200, 579535945, 312811260, 423920226, 306459465, 535948302, 661576736, 753382064, 157848266, 492162575, 901583203, 616256224, 254710685, 51812682, 720878377, 837051842, 367114939, 833579655, 188763189, 574760222, 639639225, 890030714, 5072734, 523402416, 52198112, 26243044, 602658785, 480334270, 537405918, 915009935, 295361929, 917214639, 407985080, 773059953, 426425355, 316286053, 13747895, 488873258, 74129775, 153306746, 515085311, 346127892, 333515249, 149373928, 242762906, 491142127, 769463401, 188846514, 681110155, 548357953, 101116840, 948960060, 57592880, 406506499, 275860417, 200193572, 671087576, 514649244, 783161751, 487714144, 118521617, 620872527, 970997541, 718638708, 632144905, 112910082, 868705939, 682523441, 220051004, 105008238, 780714332, 160496885, 891679829, 545607222, 397274195, 133085905, 987234668, 589138679, 55726188, 823531811, 805279341, 19587939, 128752998, 784385713, 705863888, 146123120, 545793428, 452456808, 82453558, 619593310, 120333365, 914814067, 334411042, 225578353, 196968430, 754363834, 270042547, 909793122, 9002585, 705022715, 480132395, 99723953, 938829698, 120462943, 517635698, 386314085, 920529939, 828090956, 871193415, 994808213, 233888133, 65797458, 479904908, 310882623, 558272659, 479879614, 811469424, 98705686, 565952275, 396195250, 662554198, 113665332, 848982496, 88821855, 646255566, 270471208, 408273295, 232433428, 774239741, 977467771, 192102645, 358746727, 808437755, 522516892, 651694411, 931217139, 267511594, 62965373, 187772837, 573466864, 634903701, 614345228, 923100479, 165617009, 44979082, 929322707, 414731119, 279352952, 581963565, 106546486, 801552732, 829862122, 100979406, 721355702, 294858975, 797517229, 955116117, 65162967, 588728723, 496757651, 680804434, 157145636, 702619904, 771214255, 162733479, 932765778, 206993606, 563838991, 786410964, 311254675, 330575845, 329743787, 793001680, 783377032, 222807837, 87542909, 750801982, 752040688, 584176193, 558565978, 724180916, 865656376, 639129401, 52846576, 27892001, 230962168, 990802319, 226239977, 959463446, 469838011, 61168810, 549355660, 925431801, 757823676, 618012280, 979647322, 46056942, 443821012, 833003356, 660168160, 249110639, 492392382, 793775931, 185223724, 723642739, 136691212, 105502028, 970424895, 281082884, 358901354, 875406330, 620464322, 332265466, 312860478, 665330312, 586324612, 465755333, 907725622, 82528662, 38432286, 44939282, 7816039, 427382583, 373294677, 37759097, 915713413, 132009939, 180019769, 551303938, 363547451, 422629423, 146288579, 300598773, 189355898, 840768038, 759357056, 45845328, 690732169, 806676768, 278232485, 500634361, 500454915, 708677510, 342831661, 801893856, 997274235, 767172064, 496244069, 543802013, 940322679, 732178141, 961363620, 678901430, 761792070, 382073137, 948995687, 575848801, 180403823, 461013648, 66664573, 938923850, 356029021, 885748109, 147804323, 379651605, 63149576, 972980624, 513569072, 157231985, 95588147, 141089729, 835638319, 480616920, 33289884, 977463497, 298330754, 386166441, 405215538, 267588907, 58018968, 681595348, 189113700, 16806403, 123300154, 937324105, 410953267, 262902512, 84563939, 796074899, 862711523, 403920559, 427262916, 433940294, 386593412, 475338850, 394647944, 153662887, 613442980, 958440430, 443082655, 757686271, 880838, 809535745, 627108006, 180362601, 303847967, 102597156, 822126592, 43893058, 445662477, 758887102, 909564120, 652700367, 166304402, 9063603, 559799714, 10864456, 859652738, 239451991, 30140776, 268731379, 12380134, 959066209, 57409210, 338155919, 698575767, 979549374, 439743041, 842501119, 312814107, 427456934, 485985247, 320266152, 695091614, 143072236, 548129406, 162908775, 292019473, 904739593, 719442946, 506216411, 296167237, 435162410, 801821415, 620445288, 450557645, 298244990, 469603909, 624009490, 78051972, 947958432, 358014611, 44363387, 788714110, 16290928, 966528728, 389650657, 298998219, 172066270, 231817735, 512898538, 380755663, 824202046, 291850364, 911169626, 394732669, 739944789, 364591526, 540434745, 820666569, 788609087, 73986831, 757535811, 324105149, 445180755, 869903653, 462302127, 874209066, 129888092, 92844052, 80154699, 473640621, 47473612, 83088093, 315514807, 554552845, 136649237, 776992, 653954112, 676215422, 850511776, 217558922, 806046990, 795472914, 628845840, 807082089, 228272131, 952877876, 76844738, 850651189, 311064315, 336213288, 477058104, 984393445, 341307824, 753316115, 698111961, 620785944, 602411968, 738139318, 593192775, 63854343, 691013908, 623785733, 410918445, 321129730, 86311832, 783286293, 835458307, 635523219, 884765893, 620738409, 388916976, 609092276, 609311794, 429888451, 39298805, 214742142, 178964492, 117015662, 521408276, 696328127, 971153839, 690952592, 797263446, 297323621, 685476990, 245583961, 91431583, 685061270, 770923308, 853009077, 858876291, 820292363, 317832475, 666327980, 191849486, 254582021, 947203595, 920514318, 860766221, 706618702, 396647778, 407675664, 138052258, 168677399, 603944392, 723152467, 156405486, 382371646, 659035229, 737162839, 504837465, 300225586, 405039530, 465096478, 902217927, 97287365, 63032417, 96244993, 62115756, 904701519, 142053522, 129464190, 492081107, 473094357, 997016449, 848045248, 25316856, 73770239, 202588059, 852287611, 115105186, 962632053, 202279603, 893513923, 196230126, 620951241, 324094913, 566891486, 616983945, 355506171, 449837184, 696978532, 561469553, 239452488, 631677170, 259295922, 106740001, 957137555, 311797861, 805702916, 822934611, 365533272, 579692563, 742258448, 473946977, 38456945, 127362830, 953126058, 182594421, 919752791, 536831727, 34402310, 939240974, 688717031, 15156011, 902598715, 448257564, 327133462, 838972350, 215915173, 746306702, 196658791, 935520263, 840306708, 249873454, 428954972, 192992286, 508892303, 991242115, 577899906, 495639063, 810460362, 709108283, 481611108, 811883618, 987944466, 294458472, 383478018, 82502842, 758871098, 454427257, 3184808, 611422010, 785308616, 582923504, 867095842, 470367746, 644666557, 201209549, 794198659, 461592203, 885263266, 707407829, 569382420, 755067745, 70179472, 286675735, 817891348, 744375434, 498160384, 187963792, 447971150, 23065893, 697348021, 987837398, 264264623, 205730751, 179834781, 595838672, 661599937, 836820278, 704892098, 700023682, 375103591, 572819476, 850214486, 760428762, 122721549, 698397061, 381085974, 381287403, 171343672, 520356373, 902786346, 812072538, 91943806, 536650870, 887291190, 231672142, 506235020, 963185680, 54787821, 748297346, 90986558, 311334511, 458763366, 470974798, 534581265, 927177279, 51986050, 750853324, 839007079, 778382104, 753932308, 934710318, 501636546, 574057400, 23026266, 725951298, 394804160, 612990432, 189732367, 835715095, 789917676, 908366173, 156600608, 373359729, 583611820, 951811702, 184197352, 79303071, 554998136, 606414270, 215920774, 490035607, 47281178, 817821881, 136319399, 804070456, 590857363, 150778766, 890883801, 742182864, 276232335, 959361968, 724723055, 169029332, 987834328, 905569947, 980737752, 127771064, 299913049, 804883333, 943686425, 786590567, 148848259, 258990588, 538286416, 46130551, 47397571, 931282518, 711619928, 614966451, 857860295, 494104686, 12465398, 143133608, 232133630, 229959521, 813507119, 265508283, 893461805, 89972557, 163748002, 441512620, 223927965, 567703252, 658595949, 306966820, 940960715, 294970009, 227145254, 605288711, 24394564, 243579252, 469290110, 460323023, 143304656, 353778679, 872517276, 972522306, 463688542, 336757339, 483263088, 939313531, 817201111, 295879585, 243295551, 921708029, 979153209, 399739619, 318160814, 29977783, 952956687, 656462643, 101959152, 797022231, 651071539, 300007797, 470924081, 719647114, 890031355, 454213863, 327956501, 578140647, 964834494, 656272222, 752829191, 697167486, 334913166, 941614626, 978582970, 979274993, 376803958, 241735629, 201425685, 234845330, 523433431, 341929528, 249042572, 466776376, 175054708, 843231046, 441165786, 408091949, 184564374, 584209515, 377052976, 866416253, 465790752, 221034399, 948207621, 657147459, 679328596, 220427774, 393234084, 361954744, 828670312, 546544970, 754209162, 738425448, 575725139, 280915095, 22308244, 404598849, 97946791, 552712205, 745527364, 902228086, 873269724, 626747752, 125137446, 363982998, 12554987, 11927924, 336950778, 484162657, 437882621, 618976042, 786906393, 956576165, 347980208, 681629735, 745726071, 636447557, 670202562, 536161104, 461465290, 360012224, 939369000, 26873375, 68012546, 306985756, 735822441, 691037059, 306505384, 859383989, 321929613, 364760337, 698205930, 885496554, 484337646, 747627623, 27323972, 209532411, 118086723, 471967387, 466929792, 839810499, 170204803, 749383092, 746721040, 597433812, 338655338, 959834882, 954503236, 266139595, 788727221, 557780632, 678307222, 333325324, 723858758, 427304442, 411163460, 903957386, 781812333, 347476662, 168440742, 837543413, 803696185, 670715096, 588588511, 272558418, 614166774, 959215762, 411409144, 749033561, 284158708, 783566896, 899105366, 266184658, 905331154, 411304028, 78679392, 473629843, 887208175, 396940833, 709666687, 155741177, 310369447, 89798578, 228688723, 162306054, 495984234, 626506756, 335961652, 429497561, 133152163, 939656238, 427113581, 805033869, 104097861, 319630097, 142674526, 63647300, 493822333, 411599112, 592631745, 638262721, 870221327, 867676868, 471332262, 150578771, 667252726, 458958463, 766502510, 727361511, 800726508, 990023969, 207308140, 435899499, 648985790, 532697663, 560715312, 897069024, 203016945, 8556637, 645049929, 160530059, 682457721, 732586846, 199082518, 390883584, 219470300, 610578581, 126873462, 513597138, 567548845, 40232007, 355704575, 376893216, 389941443, 363237588, 201696281, 818823264, 430076981, 807580596, 515357893, 522601965, 291581128, 3059219, 605107387, 816238354, 504348749, 297484666, 654235254, 506624018, 43102359, 865038523, 200024015, 973210455, 91036854, 384336538, 187267013, 936052877, 629190147, 457250113, 96040919, 425694975, 768723870, 953958936, 930575337, 153106632, 699287606, 776707546, 814359919, 48707978, 421730421, 694776758, 971686462, 407866553, 736953877, 628986695, 138270033, 880146254, 381140081, 593006730, 104835374, 835745436, 364495014, 353932173, 702843808, 418979104, 964098094, 744575298, 562307419, 572778978, 209619805, 674627581, 420382122, 155060143, 505230315, 179631999, 392150419, 852007606, 454957728, 806804433, 722838553, 248070406, 19253659, 734804584, 753321414, 36581921, 199165173, 333627449, 319280487, 983802603, 933274583, 203412142, 379930515, 768738573, 561681164, 387321607, 891397174, 317947713, 594593187, 656788321, 545914829, 838511048, 269279170, 843607778, 304716680, 377370692, 161211872, 990027524, 832660871, 97565461, 506797341, 944885980, 184049617, 580898879, 489668224, 875987636, 509617321, 955227161, 105612542, 702828968, 982435591, 7374593, 900961771, 977264277, 51028457, 594171673, 153625442, 610624352, 493780188, 210274070, 980200418, 760331520, 885783987, 238312249, 838573167, 362974375, 26508296, 44579942, 394899461, 657416151, 687318514, 689985506, 405848906, 750789203, 21591533, 349945681, 19389213, 38795222, 848738131, 973656839, 271845131, 5704450, 177963462, 451993669, 135875090, 442061937, 957629435, 925303066, 481137704, 694252558, 170381067, 54848425, 98457205, 767217645, 619610082, 499629820, 231408578, 797053207, 105740383, 890631773, 298899372, 309346644, 280077198, 295889584, 617491681, 736001352, 115834741, 253952153, 281630519, 784728844, 890960565, 920509415, 269335233, 860877220, 643077296, 356891725, 47165121, 943185245, 44861052, 448598580, 100113494, 797418209, 145936332, 472564357, 223525777, 912762386, 501517405, 688027218, 234074080, 93319146, 93874182, 532175853, 297785124, 426246575, 876314260, 880450866, 564871, 432502336, 607753319, 934102421, 474432613, 232944225, 272369635, 147663984, 26581498, 758062900, 901258734, 517072682, 645596575, 508605112, 452827298, 245899902, 291331160, 547610393, 776929060, 171062114, 591465823, 454273909, 788188639, 268951733, 13889806, 997132404, 691770886, 397158779, 787619807, 714505130, 764778502, 496161450, 561153584, 705209449, 209382472, 969247789, 810640007, 255727678, 575303287, 697797246, 719235469, 768767912, 394994895, 784016270, 697507201, 771450539, 82849620, 654275498, 142989718, 597737721, 850706334, 216910017, 44736562, 454072335, 93002611, 589530525, 91804858, 233750147, 30180201, 526537275, 778028601, 955879002, 979211406, 433043231, 510870625, 640607973, 173309934, 242298101, 792261203, 322729299, 35090909, 140808802, 241865266, 37162398, 312498417, 433375794, 131153427, 548683100, 478617995, 397099926, 258078401, 98205934, 271464123, 663284681, 55356855, 708728125, 784531121, 252088623, 117304294, 191621230, 779134840, 875607290, 139330623, 960662579, 800539317, 524396010, 491243030, 84254500, 345526222, 817303239, 99079029, 880020044, 451106678, 826335060, 354835166, 623862682, 954294279, 979155678, 810040845, 275557391, 403083873, 244867651, 188336984, 899002051, 248958931, 927134937, 34290982, 680849984, 872303381, 494655397, 444130366, 91178873, 358328812, 601906278, 507663178, 524816788, 331610216, 875409384, 842282148, 536991862, 251192934, 246770648, 688509057, 770577641, 978819057, 403030255, 111460177, 35092556, 815774478, 588492889, 533417363, 252699868, 637587994, 2617016, 7305366, 325158898, 679404582, 646573116, 436331137, 3079501, 361121149, 359783798, 539154450, 245127102, 314022690, 716955444, 953734918, 152947362, 26268934, 501224981, 748648019, 955452254, 61900754, 13908435, 616077394, 989301431, 973286354, 814661714, 930875050, 556805402, 428481066, 408841040, 766762545, 855856568, 819172084, 245242161, 294847360, 64499972, 439644105, 225140050, 525059696, 426891959, 961311642, 46620015, 184466073, 636910143, 400053228, 851855742, 469824468, 249976869, 416247639, 315166015, 73263839, 286300988, 293240139, 771923775, 761412233, 395051490, 378338766, 934055088, 790405195, 492739405, 293158776, 785653945, 290272527, 62549820, 500725338, 887276946, 197630195, 509543862, 119717634, 551577232, 803798542, 392888863, 651529983, 59331477, 252285232, 960294572, 924545566, 180688477, 564579164, 469118982, 264671495, 337290977, 6516034, 571775392, 663819462, 807788031, 575102952, 662451197, 286159014, 911080022, 518193475, 169553991, 908561386, 947636119, 813145223, 65831088, 429776062, 333388836, 674510639, 618571327, 84788151, 685135403, 708580318, 295078483, 251352254, 86518566, 948538819, 40138289, 327927561, 164201893, 795931892, 866662158, 900647472, 618935497, 207309753, 911545357, 322588335, 618341535, 632126745, 72809962, 469187854, 207896486, 278506098, 396750063, 189671184, 286479731, 478770459, 746109680, 784173764, 586864986, 915889071, 515580903, 997685740, 181365323, 981850272, 220586763, 927814530, 591586820, 786192178, 583288849, 481314266, 335437871, 63940778, 113852065, 794784140, 37166218, 220985926, 697748876, 852730914, 345553989, 468461558, 760441187, 754072563, 256314733, 709073619, 451467826, 860221647, 606584952, 251762894, 94902501, 403947792, 662911629, 18195405, 270702236, 728887970, 128763171, 829093468, 924328035, 206926759, 112860537, 219072640, 577409968, 932735243, 962713687, 196457803, 659386352, 211607980, 817130502, 870254543, 729876276, 385870556, 754010934, 554340351, 654337591, 230602612, 334414073, 44136871, 234984327, 393352102, 681169176, 280363149, 627325219, 311157019, 370088611, 540937432, 326001882, 956382926, 135934186, 141673660, 372788825, 793979005, 947896965, 342416493, 384522083, 406590313, 824348559, 570488245, 658109448, 667094315, 20903969, 858722682, 770432569, 461004379, 203871632, 623550266, 503451203, 553830285, 350247100, 992173976, 833796449, 570470246, 362040455, 775744817, 283605202, 753942721, 303310560, 38535797, 943611542, 928298403, 618074008, 368260434, 179899937, 115801557, 144020059, 421987168, 105464706, 145410972, 990223930, 389284621, 460672870, 29624026, 642194945, 129387775, 938206122, 262770139, 158608096, 856141656, 902082163, 847515400, 438324499, 513012005, 71347319, 613631588, 342241730, 456597548, 285043390, 431383900, 603286203, 9923542, 989529782, 10411960, 370306035, 750819078, 86460575, 451567232, 99267200, 776357739, 468271979, 419434334, 146254409, 804383905, 628714342, 560332205, 211803429, 618059598, 121256579, 199117094, 864336339, 333290143, 865869588, 810068861, 879919169, 557669500, 172252564, 243171992, 225142781, 61892510, 341724910, 218777632, 373663240, 807078093, 626916616, 253506744, 941939092, 672568263, 421804218, 298518743, 288169373, 606749763, 140475959, 926336855, 685659358, 611822017, 755820067, 152411511, 80517632, 252539204, 630972414, 180946758, 559949434, 857746859, 894737890, 979003737, 744652514, 768666560, 953587719, 862490612, 153483253, 630888427, 997565007, 91933976, 362417691, 340112309, 88160431, 604724246, 483177560, 30846749, 125886518, 615348156, 566382349, 328869033, 896399022, 242495547, 350956445, 967937404, 831247162, 425955187, 851693608, 910993371, 456767224, 993274417, 959371643, 622689091, 774455825, 183662337, 100952695, 2020357, 651725975, 858615770, 356595580, 831567012, 904443956, 595615110, 358004302, 273941991, 460405608, 379261006, 201209777, 559566184, 117958134, 240366781, 364153281, 398655372, 818284727, 202916079, 324578278, 286615400, 319711954, 722100981, 469962308, 165579630, 656687969, 629382583, 820882364, 972980674, 223690252, 991224386, 500597930, 620752923, 569676518, 221728557, 76640265, 699155170, 29151017, 223885999, 715255862, 240288697, 358399805, 463696, 145444549, 743411979, 143129011, 158703325, 345976889, 972335164, 901306505, 737114437, 393166854, 797135684, 466489814, 865036134, 44748549, 388397324, 69833881, 769008997, 599175022, 829416786, 864217193, 910646623, 219804688, 750688794, 379038903, 864776162, 427705027, 678554776, 477355237, 658104725, 333501634, 117821830, 726097087, 718011402, 364659312, 158941821, 466265139, 277033871, 787913902, 199449976, 592303761, 598937530, 79066114, 332394323, 435195037, 386721882, 943705127, 465772818, 525859719, 470689092, 647189326, 3790729, 898378417, 676407425, 505970079, 830477521, 788821028, 346116069, 619624003, 672307958, 250908731, 608013824, 652675599, 874080465, 528954199, 297206730, 550305389, 518154045, 939647704, 507165824, 345302446, 532014533, 927039588, 148591983, 562815445, 358991944, 809026958, 578951887, 733700178, 858494596, 512688974, 23392635, 180771249, 22164529, 305251807, 9585288, 576948617, 352836769, 268371984, 972041109, 756803599, 852519201, 646936742, 376908653, 829431299, 649937225, 688311651, 351349820, 128539460, 186836307, 513597890, 107525810, 755464911, 731545473, 522121691, 600101179, 181861205, 781807685, 800229625, 397597416, 415489614, 730160507, 994686884, 825355833, 991035811, 596263068, 994634332, 460415863, 590951904, 802682922, 897173251, 377981303, 507751798, 780604186, 90941987, 763516749, 545653532, 788512029, 818090736, 483112058, 982523661, 219779469, 508086213, 5421920, 784463823, 331703326, 640576116, 737652637, 163251820, 575200268, 610041952, 188712857, 64532119, 232353971, 786795128, 67356203, 896846446, 901404109, 606325579, 91365009, 287961732, 987708970, 56910420, 906926735, 955273438, 351793931, 698212237, 805691047, 202695616, 499158263, 753182789, 329011423, 246618123, 233913244, 879515198, 785041010, 591951691, 279552407, 150883103, 422014487, 801145571, 179241646, 222152096, 981368252, 174239577, 163641690, 525503019, 879007389, 523160411, 396033009, 734009958, 91088438, 672674596, 916683486, 633250954, 246803024, 293082536, 733855360, 243669102, 890890711, 50149273, 9092177, 686145185, 402189714, 141948155, 588504434, 103500074, 830933782, 253935368, 546435194, 421954946, 870778542, 129387030, 819915586, 467278166, 982911029, 813570278, 446056172, 529950290, 104470179, 681207126, 801149605, 622300520, 128856198, 217812587, 589324982, 90663029, 376855043, 534802995, 469890916, 255053663, 315651483, 975896239, 299390652, 534831687, 906179270, 70429342, 938675677, 231260396, 798006495, 476334447, 36424728, 665904784, 108738216, 311866262, 196461274, 668547540, 103023486, 9549937, 180227763, 994229287, 121398497, 419269436, 598881255, 471217669, 954071268, 154947885, 830129279, 889035345, 702261041, 944939271, 696479469, 954826928, 138585737, 621639501, 760221362, 194110307, 231689300, 26497309, 574746405, 673317213, 185936628, 536324054, 82482869, 801555052, 79472530, 227429800, 473041512, 251263332, 977652304, 595689715, 331531586, 554570777, 805306014, 942339563, 104908291, 957001887, 202447152, 414501003, 736445285, 48816066, 114571289, 737816091, 191788503, 402477009, 834506045, 310786164, 389761287, 237448442, 405213695, 23535887, 828809703, 537642791, 756504071, 521333193, 231582409, 142774367, 557424678, 907268003, 994489162, 919696844, 114566633, 151174951, 58088305, 841272795, 199977839, 740422223, 458872804, 776844208, 303972174, 629441020, 846794168, 936077987, 811073652, 608499169, 274417432, 365884755, 359226496, 614911439, 20576116, 422078179, 669709232, 286448551, 914796707, 938852506, 632581441, 83299418, 633074960, 153776294, 916915966, 488268848, 844175722, 894455495, 939904225, 834522431, 599627001, 918348996, 908401543, 844749429, 966411815, 164465286, 713227510, 174400267, 37327444, 544928162, 118500267, 58919436, 768540532, 113635232, 428482495, 69629995, 270087938, 441387543, 834753364, 411458821, 205746072, 892761208, 337461849, 372298531, 355747526, 628409844, 799722614, 289895896, 508417357, 721864198, 78798180, 550061824, 477600606, 692638020, 484634628, 460242309, 291151610, 643268774, 400867863, 481188427, 865720531, 457804440, 983594961, 900117926, 783020818, 68274957, 49102659, 844690803, 468494124, 823092183, 412571774, 645292149, 960203361, 595704180, 411277354, 482913155, 885840324, 893193731, 806346337, 340842760, 157821818, 880293120, 859203886, 474501517, 278435155, 474951040, 287580410, 739377850, 266586233, 535260755, 473572975, 334018873, 203236240, 787730099, 490737553, 711025176, 683503209, 727903630, 349286874, 572425636, 686406184, 5394774, 527623791, 715590127, 767639937, 217546714, 699254803, 646911484, 485203481, 441317208, 762186061, 584484531, 20721981, 264586206, 903878807, 97168315, 128170192, 491151116, 903409845, 37931856, 675415012, 742782629, 797764136, 982855889, 401787400, 372516218, 328455362, 909889566, 360248942, 66783962, 439137584, 941403670, 808405538, 69763611, 492504402, 163874876, 546574959, 465879265, 175592379, 768871777, 81790838, 217003181, 976480668, 920537063, 317031123, 324514075, 368376607, 582982615, 242116866, 369537157, 868558616, 918649960, 259647519, 446802834, 692720761, 920020370, 540569028, 444378991, 753875632, 544936974, 662843747, 631227493, 975375531, 163816381, 847961057, 973205847, 570706904, 122852250, 88996123, 578835600, 825048843, 867280835, 534736122, 429472131, 592573990, 4011761, 824716622, 123652249, 549402421, 294242350, 15167427, 22231089, 79449880, 21142577, 878766207, 808270796, 905801437, 733674517, 39226076, 922175513, 697002111, 119236479, 397704352, 809223201, 726466655, 959015292, 489251846, 574818309, 652397656, 693702970, 663004489, 767238958, 36043815, 183232631, 998150629, 987503730, 892948541, 882457261, 876582469, 513649542, 611418083, 109369122, 213970430, 946897403, 869926628, 604370942, 814217325, 793995617, 429641420, 905241872, 635993535, 595320496, 964087616, 256079744, 311803499, 262449350, 1586142, 633823996, 187614999, 808439658, 381443968, 268020108, 439709781, 337954623, 306795421, 385565600, 666273709, 148023598, 313649802, 455273308, 654605060, 893800248, 733098965, 89992740, 257081477, 962094030, 291224716, 758087836, 67970714, 251678541, 611244426, 253687688, 609347619, 371573835, 598204990, 222174495, 363419550, 802888241, 199623590, 748016988, 650603812, 543147794, 873266165, 299730346, 211493677, 997836768, 194362978, 239465077, 548987385, 675267932, 928157201, 801578297, 528201398, 712016835, 734390106, 624786714, 473737536, 22133284, 709599524, 510361517, 421929020, 548484688, 149186218, 492024671, 150118483, 435896998, 69060579, 975022816, 976141987, 95288991, 133653388, 813783715, 710259904, 824369211, 937074815, 184300053, 847776763, 37776910, 626487992, 833530121, 752707673, 2973309, 970443578, 708555094, 349214853, 687749143, 461014363, 932291778, 10644565, 121776644, 693470449, 871416038, 921501687, 20320938, 634592769, 205835938, 754037813, 605345565, 149580018, 840847479, 492428272, 283742912, 279039162, 854994782, 718462841, 719962617, 503649978, 238142687, 133814162, 344763771, 169646538, 500279361, 844828184, 402665148, 521034777, 910333325, 243811149, 879896956, 846722704, 929176656, 615907474, 339990394, 511327609, 709994130, 625365668, 144109670, 387691013, 462383460, 374234851, 683719179, 31987872, 121378354, 144264009, 432136416, 635562462, 962331193, 250326494, 337983809, 420026492, 143567521, 574455499, 654057826, 70252839, 462080494, 977164955, 969933314, 300109904, 75724418, 145522754, 180065682, 248657350, 312618660, 275695314, 959702530, 539773085, 653883634, 826664481, 693479296, 768130700, 318842499, 668808719, 89420148, 80770941, 631911300, 965605443, 399806982, 103040586, 851933025, 851492297, 57825486, 511899672, 863347362, 567103706, 967758704, 915857048, 385925184, 580713533, 301306626, 416611898, 116327473, 629812348, 936081227, 263348254, 905351208, 714275758, 200512470, 563923750, 72882680, 890327730, 206287147, 325511329, 528820385, 54091083, 451206240, 607448781, 107230187, 37349648, 951567885, 821068161, 949428207, 534982148, 878079522, 557447374, 363837673, 527608838, 239881815, 237944065, 673308391, 473826811, 581087919, 902781112, 453248123, 610375251, 166807919, 487926946, 333863816, 289567893, 344339622, 469700595, 43128161, 97897171, 759300312, 853504876, 620300688, 773896053, 491827449, 742730691, 55005601, 635981457, 109479431, 338333772, 878053208, 485443027, 425750905, 931722317, 661536135, 960535436, 474483982, 261095655, 350507956, 781146778, 824774850, 983927033, 633694956, 454498498, 561881343, 11099434, 31070148, 288025821, 805499643, 5306580, 897737856, 66958299, 141024585, 396412524, 13008108, 636094781, 600331358, 768903321, 985423290, 725046595, 531015530, 636575313, 674591806, 530840957, 400599501, 71178345, 577603002, 853175685, 86590329, 374451011, 985993439, 75770118, 71127341, 161660794, 277427820, 409473722, 655694012, 678473411, 394771854, 178610847, 149101005, 340755579, 347009929, 268823138, 138505787, 380583728, 113653695, 427602614, 718048368, 357539698, 877637537, 778981716, 300507343, 836121520, 754492805, 677601238, 83279968, 628505249, 820793452, 870291202, 419210311, 524203712, 763025429, 164011675, 119885275, 75787413, 663040282, 674677531, 284347204, 292184453, 432025810, 424287574, 649346560, 183486915, 90009313, 606472056, 219811205, 182272953, 655343407, 869142023, 166414248, 577631034, 947243791, 419152526, 35110548, 967315735, 321867761, 725908922, 246504762, 7546049, 849707459, 905103135, 13065332, 768429906, 641116266, 820488900, 479300004, 269120750, 877542983, 856854925, 294116459, 32486330, 157136727, 673625415, 872154441, 306150401, 259733387, 847810391, 510056684, 228153109, 981758671, 465503896, 714940920, 674541637, 801858527, 904808260, 601454583, 722850966, 693365852, 775460710, 345329516, 950899429, 903483214, 934285922, 277680388, 458736086, 633152619, 697484879, 378215234, 903108130, 728822419, 247854989, 904359013, 752315938, 778178534, 827520915, 374379278, 285420441, 790103210, 761605531, 477075943, 105877840, 408261855, 33109067, 948172583, 69927696, 550486492, 21546577, 664513615, 619046856, 842619773, 183907605, 644181755, 899145562, 224085452, 258535408, 795929770, 195469921, 970374816, 520634137, 990031325, 685248162, 744941761, 803179342, 38103507, 415042358, 829729711, 991521535, 185996512, 13444946, 456088256, 790719630, 767569781, 547746042, 130600602, 784994455, 845873178, 419606448, 861117147, 699475819, 185641953, 689703751, 691336107, 618902612, 57388467, 751570647, 881999157, 614419427, 795426626, 947368638, 732914214, 323299016, 438933059, 500595315, 784897920, 747842533, 401072395, 622819888, 91908385, 380422399, 456809893, 944528618, 154861936, 571071100, 237790340, 229675655, 716886211, 624558180, 108309259, 37648585, 208964967, 813658457, 142539569, 163021597, 6456482, 457569942, 582852624, 979631087, 202127934, 923996899, 777181951, 105892523, 316666809, 97407409, 94839861, 341947756, 901105925, 735874195, 589255976, 262548679, 784515471, 404610422, 362479919, 792163277, 493224888, 34689814, 90329343, 463585908, 753372704, 470613611, 769368172, 436749614, 161535056, 995613874, 846346784, 531026145, 91577450, 406396152, 396748326, 934525527, 956901641, 780285759, 309989020, 361497993, 353900615, 630745839, 7935746, 628865166, 286811045, 200631939, 137170753, 124305826, 363121953, 597370671, 620746060, 344117516, 719184471, 554355341, 123250151, 737281209, 611585762, 665712968, 539427416, 682454091, 863546474, 482165716, 368775246, 82393221, 377318264, 731693078, 210300927, 222976672, 235431146, 56840058, 534204155, 820626796, 49173381, 976136427, 500169632, 628954945, 219707182, 619337682, 605076729, 995808641, 51072434, 190511639, 742818209, 543630079, 627239979, 99053502, 316379315, 186938680, 313869329, 903467043, 414574169, 876387150, 149855315, 636641658, 882052060, 253733478, 829721354, 890708143, 866134350, 262543783, 167156008, 255836841, 355879630, 121759727, 749702371, 295586640, 473229980, 123677067, 286936043, 765050067, 933858028, 630779583, 440599993, 203100838, 400428237, 126198100, 984288791, 723171617, 199052939, 708734478, 716543455, 4309569, 641125963, 303540225, 539636270, 124796985, 692533902, 347436588, 605879349, 7855255, 298924894, 802830952, 964743966, 178918355, 603109239, 25800679, 207362755, 112726796, 979620207, 62770172, 874923584, 370742719, 473808752, 97222317, 772605299, 315940553, 759495204, 895097293, 537617645, 380469736, 523604949, 216727879, 731694875, 523791625, 319088642, 46515026, 592628412, 305273928, 429559189, 709325710, 748057020, 783156795, 440458024, 150529751, 577412614, 812633736, 421959812, 863797873, 823891568, 226582711, 50529435, 731605058, 939638707, 757610783, 421525070, 709000903, 618014973, 102850192, 828177939, 299035895, 873385273, 661572128, 631209525, 254508145, 477066294, 553563337, 588124484, 719408948, 632194758, 629511855, 712689112, 489133515, 925389055, 414385875, 884424668, 114478074, 362903684, 467032506, 74833322, 285669723, 739790732, 969353373, 672888554, 306032080, 466442699, 153329814, 917923255, 165034820, 240262274, 135504930, 395549226, 583415162, 842826985, 510794838, 860309673, 886035780, 57514537, 308756097, 729232435, 62995592, 67219812, 505376109, 284591768, 219063147, 585466617, 521834025, 769404353, 338561514, 126897494, 826383075, 223810274, 788930456, 264745016, 473381034, 713865657, 940722624, 862152161, 293903892, 235427689, 46484079, 790059594, 871927494, 292262133, 963291292, 393909112, 500119901, 5234262, 236171635, 472127214, 563975249, 227788208, 928205347, 174046280, 841957015, 38936512, 399371142, 271628475, 386755422, 601158315, 390059404, 994600445, 577562958, 403389544, 810781409, 287392746, 384150665, 581100736, 961148600, 904358784, 356112877, 795106784, 888077196, 635859612, 725077999, 612170262, 258517550, 752132590, 491330438, 881562919, 191947925, 437779359, 265980761, 822158995, 901244895, 645033500, 481230136, 518287942, 504290052, 759994634, 836958395, 821492424, 917522539, 777383857, 326872702, 721723032, 272322164, 456082835, 94003591, 439322002, 470034365, 484079267, 396242517, 868962276, 661069320, 414592873, 396653909, 944515274, 237995474, 990274029, 671858418, 539318848, 953455667, 142533783, 417160756, 536748621, 965369690, 649739806, 69780064, 533234030, 990008455, 409526604, 792296055, 363445314, 356629878, 793279181, 622423410, 332205830, 38767836, 315022031, 97050341, 334394478, 535659285, 211786318, 710061901, 978539191, 548796388, 804890640, 793129860, 940237113, 374664168, 520302879, 126128682, 813863868, 129923283, 897513188, 874679672, 620695542, 226385039, 248438032, 864227230, 620210358, 455222410, 295463312, 571067461, 267097276, 66289900, 987709847, 154996348, 973466379, 186407068, 761629373, 994135712, 74392066, 813385564, 611220389, 851525702, 217738947, 836061065, 346339822, 157665767, 45396441, 598116240, 631229054, 547216581, 117905277, 514165542, 305194633, 967363407, 935940964, 647747497, 417098905, 799828374, 586920134, 853313354, 607168214, 938424279, 627422505, 466353630, 828329582, 282998184, 504336471, 625322363, 230564081, 776639371, 549765205, 223702671, 283197034, 891357420, 424701899, 710365905, 977508731, 755073237, 978657005, 978721651, 989470145, 353555352, 751514863, 360061986, 97545441, 162948784, 126338013, 281410727, 215829658, 564850606, 813552229, 340143642, 128575432, 639150444, 214408182, 538511422, 206584396, 416933988, 848425640, 433197454, 943661213, 436809462, 453434941, 184469382, 797606606, 688444240, 795303190, 120006629, 664978752, 315106893, 231714034, 729911758, 411017178, 852652589, 66395479, 176141891, 748590850, 102009408, 7322887, 523922557, 708451829, 233944851, 585838226, 186538277, 637515289, 525324399, 524722917, 245253978, 482799204, 176743743, 229664601, 848688497, 636767849, 83722441, 533713707, 783647412, 695100764, 601506143, 357249703, 955047695, 61552379, 799373974, 61923681, 222840026, 124875179, 307379626, 371563357, 137100719, 324911949, 195148718, 425278177, 362376421, 921882113, 561394798, 55969279, 741682884, 103960230, 438336698, 351892889, 74571586, 831624310, 898050351, 536188380, 303699450, 750814786, 728114329, 681084382, 798719483, 150569425, 256082312, 346638235, 311990854, 661793999, 443773868, 613467944, 353460311, 803280413, 487653297, 984405856, 875914825, 731403583, 847684351, 604964100, 752177431, 832421448, 202880743, 548106681, 922204732, 650835223, 938730857, 189971637, 224024992, 995437980, 617155934, 375907449, 896918799, 835701995, 510869090, 507303141, 175892740, 148383693, 620823173, 63763890, 919186428, 848148902, 489689387, 272853663, 17715220, 716881842, 710828753, 736524429, 344048380, 167371732, 842650947, 829723742, 405751266, 860825663, 943609373, 598899032, 651704793, 368629675, 152546910, 881462137, 955117976, 455255903, 605148035, 136990538, 805629261, 139642833, 57091613, 881127983, 257065220, 994056575, 427481091, 843366921, 872395393, 401519778, 864782378, 149075888, 412034962, 698912375, 374185900, 42110747, 100916326, 316505275, 450620767, 466596641, 20793387, 245335943, 900779920, 276764287, 139884648, 590609994, 166942202, 403540582, 749609218, 489057293, 182567850, 228548358, 535887016, 314716022, 602897778, 816422412, 366977663, 824740085, 965707846, 363136101, 148723819, 353203246, 463207815, 208524056, 71926287, 305867226, 652014956, 527557721, 900132852, 17400485, 510064264, 944227787, 412778571, 180407215, 454929610, 165612864, 594364311, 442144764, 84896865, 624615486, 202484650, 127296468, 828273387, 193963676, 115253532, 738680235, 505612187, 280895280, 566910520, 675740274, 994597185, 906252705, 195972414, 5897745, 560981211, 29062229, 275896880, 574354789, 8737132, 94621459, 979403599, 309441399, 240635717, 497255732, 268635843, 956664861, 448231255, 787772109, 686749535, 93136774, 300384562, 949225929, 723506780, 310003265, 299111542, 965194898, 589920504, 223719618, 723486567, 857609313, 324164429, 622273432, 788057525, 403893224, 579551734, 937653395, 692757623, 311622803, 709048157, 125386522, 521195855, 267249128, 408734933, 458304711, 852057651, 398698707, 912060471, 380481202, 600985644, 853944945, 859859403, 271821022, 606680727, 768112133, 634740709, 513954337, 755605588, 530376962, 233184974, 208401611, 89370584, 783970825, 451388255, 4385321, 510714425, 885347236, 274404037, 401320259, 377447742, 303371050, 352336367, 353832143, 48495167, 474309669, 854625137, 822870841, 658705273, 760538787, 876076406, 308308554, 962163696, 485052723, 411298851, 443787493, 735056432, 508879709, 582219113, 316034338, 941446762, 466679509, 215989957, 284931596, 323545910, 269070994, 329403794, 976254234, 790346648, 241127106, 715295626, 225162558, 959996841, 29682568, 375654678, 704359358, 794940909, 163579032, 950172352, 198600678, 212118884, 395813911, 523906979, 300261249, 902912715, 653563296, 367620479, 602664706, 952525180, 99444866, 617959443, 241176797, 677915826, 684083314, 997348864, 598611397, 880214751, 200343766, 722242013, 953190063, 282219603, 860129251, 536436359, 343746093, 124884675, 710558743, 487352310, 273561467, 320191958, 870100132, 905898439, 161258442, 346702136, 587788231, 858600712, 261601443, 124950487, 262935379, 692960680, 656985424, 88259048, 252152691, 876933491, 490662324, 317083530, 299740184, 624501953, 206839944, 609941838, 884037182, 31833325, 843568642, 748825365, 86941191, 123794368, 72622905, 362461649, 867846131, 79934772, 462588340, 493332825, 536018419, 81984713, 757137988, 280520839, 682577494, 178784282, 398467787, 198473618, 936554533, 883646989, 548152189, 756253452, 570185745, 526388362, 515702857, 168812276, 817657724, 656466545, 765513483, 555878444, 838580067, 546092682, 876880416, 217917496, 535317252, 76409673, 817559110, 288168861, 331679503, 476039091, 639303607, 420403396, 659851280, 176664673, 353278379, 138675337, 916784458, 858455976, 121373112, 202400963, 214883882, 947329062, 575095539, 432827143, 912984715, 492821004, 963981812, 108709749, 893361669, 279267492, 422702405, 909337945, 13249386, 486986987, 836228648, 43113057, 900460162, 684309036, 896984755, 250628292, 84686431, 270020491, 796472922, 674960378, 172640283, 916011960, 698405509, 112069534, 901324822, 471630617, 272417479, 735605780, 437041697, 191821036, 895791767, 635866542, 979000994, 35068097, 906616253, 903336962, 275893963, 470418190, 258348048, 63382816, 700053886, 441395880, 417888262, 180283092, 367563662, 624424099, 23160209, 609516259, 963714910, 768532670, 833166166, 179303374, 773655278, 725225116, 892953474, 416914616, 50345954, 737352094, 997602321, 754091388, 933516397, 620080372, 141159427, 777647568, 616903619, 161955374, 816916887, 769226257, 174698530, 174426502, 409464500, 690198639, 78928348, 266488131, 326944560, 609839340, 968958602, 914468328, 924621460, 730285649, 945195612, 995018570, 131439426, 461175648, 117648447, 189362159, 291182777, 198153121, 732344408, 605454666, 641311531, 259964606, 228613839, 585477536, 602700638, 311931994, 174562495, 128189964, 283552493, 926509148, 78993269, 814800545, 323591557, 324385995, 443224102, 657827408, 439082603, 844699348, 342621004, 381811984, 18118165, 365042479, 680370060, 713856526, 39352157, 529991011, 603700027, 320261037, 763568321, 906611803, 697561850, 140738085, 167853617, 804736152, 495888351, 896343050, 367129375, 436811609, 725653393, 405780612, 821036307, 976703787, 832240199, 601321286, 453269449, 223938798, 136588186, 240415781, 48005202, 92521724, 204056718, 735981098, 181153930, 70022720, 524510077, 721560982, 221516683, 911141407, 240372161, 171735773, 333267796, 839787125, 333260852, 34375376, 354235106, 835989501, 672510059, 786040, 563905040, 230634260, 733910569, 155315126, 925594339, 341483940, 584045762, 924042088, 975375218, 72668531, 780500166, 57413562, 913301678, 522239360, 183093573, 109736381, 512971139, 387558635, 790630314, 525715511, 149162676, 223928273, 724747671, 687885713, 877825337, 770017728, 323038565, 485332689, 612596474, 282946542, 744743513, 852556280, 538205803, 611966733, 86322663, 261442854, 770733263, 435310557, 116068224, 698568387, 446652605, 919031122, 427697724, 473820830, 696998711, 167342043, 725983204, 273849059, 755000469, 514847812, 620305524, 829088414, 296924468, 667626412, 259757526, 719607895, 469170444, 367931640, 849661850, 186977636, 133149124, 256150091, 121346610, 46654408, 783496544, 796255014, 444687435, 892460446, 774375371, 41414849, 653776508, 664946881, 681843358, 752772101, 934134409, 645341840, 274889192, 380160313, 312970887, 478332656, 74884449, 565594212, 263926112, 976940842, 494366944, 89171772, 289122441, 71749123, 639844372, 965860743, 945786014, 875347187, 920079210, 165837269, 53386039, 214322121, 499568671, 705638408, 899653242, 605445742, 762468863, 295749396, 546180944, 228484556, 125594705, 302818602, 503687380, 677967183, 545605496, 414857152, 743765958, 873030847, 270450183, 785046188, 997964754, 851154020, 8948748, 276480283, 45004120, 418003375, 332209033, 48648139, 291039153, 713862854, 897183038, 141260910, 720196356, 704417007, 198374751, 827773977, 138778782, 58132171, 175955072, 958571905, 70792051, 249625976, 537944205, 402325058, 769641156, 211631749, 104496261, 577205940, 851070403, 687205771, 678193110, 103798551, 220892857, 818598530, 371791530, 772585464, 955093594, 31697758, 921782154, 888713301, 325580721, 403715409, 425837457, 468157533, 263294064, 947442724, 987270490, 963997136, 785251704, 256335125, 977667967, 829011155, 198078515, 442169553, 494114203, 27343780, 263931206, 672512803, 555974653, 210398730, 11226684, 626961512, 295807030, 983545532, 859459548, 450244262, 486349427, 317005324, 647628168, 62796578, 160138810, 195973563, 316435181, 228722742, 594907115, 669076479, 139710319, 585100578, 717947641, 800635031, 778952741, 126263333, 574169422, 42857, 152420217, 548419760, 582213053, 110401531, 310909232, 968476616, 718064679, 613119750, 913329295, 157262077, 342745183, 63410365, 952693066, 974203970, 939460287, 726840743, 936556674, 750376306, 356663881, 687191830, 711945155, 698023131, 105578320, 402163671, 666944375, 180415800, 302586101, 455276030, 303376794, 456049949, 440947955, 326934665, 172505876, 973223427, 696963786, 256418205, 388956548, 950592750, 536359391, 223644253, 253923105, 779486949, 398548217, 652380141, 738510684, 196491662, 746038780, 919673696, 916781578, 57364231, 283100025, 752372995, 854585194, 322967512, 326056677, 901495792, 526250511, 251991021, 713441098, 675819980, 581115913, 172306978, 389337621, 827910313, 595265213, 836188613, 490465039, 373325192, 779099936, 993852208, 709944205, 406367575, 271877325, 425745740, 587283289, 345996178, 581032527, 983607312, 594002264, 574691734, 117566292, 772035901, 950038243, 310171428, 314211613, 122174614, 792024540, 278665974, 798586091, 128907821, 780706590, 644997182, 89948296, 885116043, 984461641, 429909012, 890725544, 747789232, 445994052, 22196579, 211385011, 249002106, 822441253, 803630868, 196916899, 723095890, 412736425, 667292200, 704112295, 152042104, 515203051, 324331952, 698090765, 689703099, 192279576, 380175154, 907047186, 979546608, 563810795, 312286407, 63747519, 197235838, 702978630, 831195402, 700077828, 53846351, 174706743, 399597576, 762903916, 235391137, 970287806, 463632092, 892734430, 617979790, 816159169, 460128535, 607207674, 293426512, 503257570, 473495067, 959884442, 591666374, 841871513, 424755281, 557374272, 623029904, 291872507, 861661746, 633736478, 664127456, 416469339, 483846074, 323471030, 756787092, 119963005, 167962057, 439842807, 689507102, 515064800, 922858068, 517997579, 765801550, 126179774, 550462286, 621224689, 560084007, 121011630, 777364044, 925741610, 85619387, 272229766, 334905596, 69378329, 155413517, 486842628, 336184148, 332067522, 446177214, 47653765, 793544906, 464217069, 205386664, 276186086, 699828013, 870507825, 402914624, 32516068, 886039231, 94214568, 904527981, 488008589, 936576623, 690701205, 145276094, 751512285, 841840874, 191777363, 183795287, 670535022, 207274859, 781436311, 673414942, 305176378, 527458149, 555603902, 212115397, 924261897, 980452285, 707212482, 361120952, 381058986, 931140419, 489894085, 25306774, 585651892, 333572855, 829948700, 648112264, 415128024, 895340028, 614282289, 39666390, 381935627, 11405777, 254649507, 850772734, 587803408, 782417419, 720857065, 868943555, 521511281, 116564588, 270845563, 500096479, 403295062, 651563625, 740908176, 506062936, 424381757, 498836931, 53860231, 95300877, 188663577, 789602288, 261664204, 654565867, 833887204, 277933450, 42137499, 65335841, 79418935, 482666783, 657321318, 222631509, 514427679, 97294161, 299218648, 500188084, 759949984, 347886135, 212994317, 422634168, 452159852, 913904364, 605532125, 961018814, 174661173, 482689728, 288944335, 493461784, 927956757, 588664486, 99073659, 820672572, 807085921, 236244208, 267073832, 801905084, 985019745, 292026823, 365348670, 924189014, 592141108, 651320542, 108256511, 46135767, 65648453, 659166322, 438412009, 59106165, 621979190, 385215591, 722681335, 751642684, 34431092, 678343343, 103006810, 518835487, 747076599, 512235116, 388751640, 652472648, 492478695, 700708053, 930704704, 141733276, 656902947, 201598154, 723078230, 543432768, 674390877, 328247265, 587309654, 861676852, 214437655, 852231474, 273346124, 572035135, 119470577, 581353792, 504737514, 185848403, 389029368, 379372618, 401219966, 430693601, 384346908, 42854177, 663557482, 972691705, 727651094, 16835614, 794596456, 499041194, 313429724, 694939158, 342692789, 621578189, 5575707, 854386322, 123627779, 217591123, 639573026, 711576782, 863530313, 395376788, 320577098, 983723376, 817266756, 9998595, 31923946, 251499175, 640980087, 837541367, 164032303, 780787820, 776758536, 178837387, 877032299, 969937272, 974620129, 832594441, 707078030, 234420814, 652274311, 76201465, 64308914, 271722013, 187038396, 197754187, 993194779, 30719675, 36321577, 170710722, 56032688, 31969987, 399766436, 531593464, 544160334, 234510465, 138522105, 624410969, 531545142, 186607666, 159899448, 239558549, 458246231, 179665084, 884414890, 835954937, 392723849, 685286105, 189787538, 578836752, 820072925, 577893331, 256250599, 385553176, 43540546, 214712114, 874702581, 93017742, 526374434, 43778392, 131564221, 443698446, 486536411, 811382337, 389472281, 666012163, 992799069, 476788925, 669650559, 916665906, 626750184, 969998049, 523953064, 917726352, 403473584, 873452383, 845638135, 152477073, 991303096, 365051482, 810791337, 327462358, 213523206, 467560299, 334523091, 471086583, 368886175, 17853642, 583672414, 223896366, 321779747, 50025411, 635719420, 43913959, 200109775, 347368980, 787228821, 259712651, 449911449, 694819194, 611676879, 401423955, 485254626, 17733327, 305755483, 800019854, 469535873, 153643504, 666013590, 70814691, 366254834, 330589892, 979670827, 186430092, 829880282, 961168530, 399505391, 195300372, 555865917, 135377039, 197916681, 170518563, 964325658, 583468626, 123735428, 354658536, 459078160, 540023221, 964337668, 135148384, 621337894, 476442833, 453366512, 695710744, 816878180, 811027453, 373495142, 547013246, 816024025, 979341319, 441527901, 582242728, 794778306, 635923912, 432349813, 590156759, 867621871, 966168292, 472626082, 869878614, 276338816, 675491411, 301095484, 988121795, 989601552, 218950670, 571612262, 652991709, 932463904, 484011668, 508565728, 163047588, 606097285, 182333610, 51605456, 217130380, 903147254, 302649826, 155047973, 749729504, 404900788, 154938782, 246857832, 989555876, 920619943, 215100687, 945225913, 255529665, 106261104, 465273403, 984580182, 485148500, 125845627, 269668267, 388958416, 594728105, 594825944, 206253723, 412082078, 891499298, 169091048, 260106123, 995659170, 708903861, 186458938, 817723584, 635333359, 694928503, 756030109, 950645436, 144177108, 574895699, 411553358, 418483919, 291392170, 939073220, 966824097, 693393263, 846481581, 507577362, 412449372, 495979609, 171764320, 432885784, 413861148, 202340286, 113506335, 285156208, 132759045, 608139246, 374627028, 356374049, 788199604, 715639191, 967152278, 740076263, 206125511, 280185976, 857423847, 408156626, 398393565, 903475978, 353869154, 576366808, 560198316, 396107485, 882267944, 63145900, 568472319, 206166206, 146428714, 918986911, 766175693, 6176170, 642065059, 627717767, 993244138, 459984584, 28418205, 277790391, 273795448, 420339061, 502230933, 570022589, 795904724, 218223837, 338742752, 12611331, 856514344, 153051276, 38340044, 960964931, 245876392, 252120333, 196747991, 65111558, 571676467, 673522444, 219295365, 896096557, 183798611, 412740646, 40871671, 436207295, 135479652, 341019949, 363813523, 739412832, 786517195, 979171341, 389436067, 715857061, 55917608, 374075088, 220706163, 937164475, 99600291, 672282432, 551630685, 539665695, 910293270, 263814211, 505612352, 330728043, 747170218, 948328050, 607858847, 190919992, 968598802, 433505294, 743484969, 384573442, 923556991, 186703606, 566941994, 959215579, 624413186, 299298618, 289239241, 511948474, 574849874, 576336464, 869215685, 543007973, 250269620, 437747542, 992137294, 220942790, 139765357, 885534487, 119120622, 666565019, 589760992, 369725248, 59685087, 797346583, 430533168, 566637238, 191605496, 482137850, 26892911, 241133978, 58266138, 189395156, 566133233, 876008990, 175751829, 852698097, 588334483, 724087250, 522208975, 580792110, 426629818, 644968569, 382740491, 11789812, 839503357, 416153100, 875038111, 880590218, 323523599, 658072694, 306180855, 545737529, 102945418, 650088478, 869633593, 577286696, 583327497, 174162120, 400493701, 550040993, 88919194, 210147090, 475960125, 621778235, 269827511, 372843769, 581188540, 254504811, 377730782, 553798041, 492606921, 995128801, 746974728, 106152931, 528317754, 760331949, 869337551, 451693302, 779119153, 333261469, 350763378, 1432623, 509163201, 306810374, 159589003, 732691854, 815789080, 422771468, 730480597, 41208318, 875561716, 27471218, 495918061, 455781975, 221295819, 707614760, 444676169, 54530010, 527815443, 2961568, 539214355, 449627940, 563684465, 85273426, 73234524, 121077910, 949431309, 678429432, 597593295, 242660562, 725358414, 853264706, 996097223, 498332277, 829788084, 180234611, 129434908, 855981591, 187624911, 157195497, 874577247, 147882829, 887051889, 811743107, 509252973, 513346802, 320302696, 613872496, 395624363, 723913689, 289354984, 558002834, 368464363, 920175546, 584378758, 835895061, 48620101, 747105701, 325681734, 728678915, 182729986, 236509019, 179723719, 859364092, 852225872, 530032141, 348201535, 309813009, 714429281, 675811087, 537336090, 867515307, 526634770, 213533140, 200697617, 509234417, 449587859, 341267971, 424971915, 61411505, 304949038, 804611711, 377384584, 475576646, 272562721, 110322435, 26484058, 23946843, 949706740, 856924352, 460497136, 22177287, 247044744, 199132976, 882085640, 116026630, 316704524, 268026220, 153850738, 236250330, 67121311, 356225781, 122967440, 324786410, 921467418, 200032243, 279391900, 84936865, 177904885, 223522039, 739243936, 70777162, 936939512, 631384239, 518380254, 405243730, 1495486, 767919173, 509704643, 287372202, 304707951, 368317287, 909027256, 583632926, 312483220, 782198805, 902527222, 507953348, 119695322, 292620471, 676835998, 178306155, 486480420, 873564271, 306623488, 266346482, 168010464, 128986318, 534808100, 250652443, 268736171};

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	/// freopen("mem.out", "w", stdout);

	vector<int> prm;
	for (int i = 2; i < ER; ++i) {
		if (mn[i] == 0) {
			mn[i] = i;
			prm.push_back(i);
		}
		for (int p : prm) {
			if (p * i >= ER || p > mn[i]) break;
			mn[i * p] = p;
		}
	}

	mem[1] = 1;
	/**cerr << "er"  << endl;

	cout << "vector<int> sums = {";
	
	for (int s = 0; s < N; s += STEP) {
		big_mem.clear();
		vector<vector<array<int, 2>>> dec(STEP);
		vector<int> rem(STEP);
		iota(rem.begin(), rem.end(), s + 1);
		for (int p : prm) {
			for (int i = s / p + 1; i * p <= s + STEP; ++i) {
				dec[i * p - s - 1].push_back({p, 0});
				while (rem[i * p - s - 1] % p == 0) {
					dec[i * p - s - 1].back()[1]++;
					rem[i * p - s - 1] /= p;
				}
			}
		}
		for (int i = 0; i < STEP; ++i) {
			if (rem[i] > 1) {
				dec[i].push_back({rem[i], 1});
			}
		}
		int ans = 0;
		for (int i = 0; i < STEP; ++i) {
			int res = f(i + s + 1, dec[i]);
			ans = add(ans, res);
			if (i < 100 && s == 0) {
				cerr << i + 1 << ": " << ans << endl;
			}
		}
		cout << ans << ", ";
		cerr << s + STEP << " / " << N << endl;
	}
	cout << "};\n";*/


	int n;
	cin >> n;
	int ans = 0;
	for (int s = 0; s < N; s += STEP) {
		if (s + STEP <= n) {
			ans = add(ans, sums[s / STEP]);
			continue;
		}
		vector<vector<array<int, 2>>> dec(STEP);
		vector<int> rem(STEP);
		iota(rem.begin(), rem.end(), s + 1);
		for (int p : prm) {
			for (int i = s / p + 1; i * p <= s + STEP; ++i) {
				dec[i * p - s - 1].push_back({p, 0});
				while (rem[i * p - s - 1] % p == 0) {
					dec[i * p - s - 1].back()[1]++;
					rem[i * p - s - 1] /= p;
				}
			}
		}
		for (int i = 0; i < STEP; ++i) {
			if (rem[i] > 1) {
				dec[i].push_back({rem[i], 1});
			}
		}
		for (int i = 0; i < n - s; ++i) {
			int res = f(i + s + 1, dec[i]);
			ans = add(ans, res);
		}
		break;
	}

	cout << ans << "\n";

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 23ms
memory: 17852kb

input:

1

output:

1

result:

ok 1 number(s): "1"

Test #2:

score: 0
Accepted
time: 26ms
memory: 17820kb

input:

2

output:

2

result:

ok 1 number(s): "2"

Test #3:

score: 0
Accepted
time: 23ms
memory: 17872kb

input:

100

output:

949

result:

ok 1 number(s): "949"

Test #4:

score: 0
Accepted
time: 25ms
memory: 19880kb

input:

10

output:

19

result:

ok 1 number(s): "19"

Test #5:

score: 0
Accepted
time: 19ms
memory: 17864kb

input:

1000

output:

48614

result:

ok 1 number(s): "48614"

Test #6:

score: 0
Accepted
time: 24ms
memory: 17884kb

input:

10000

output:

2602393

result:

ok 1 number(s): "2602393"

Test #7:

score: 0
Accepted
time: 62ms
memory: 19836kb

input:

100000

output:

139804054

result:

ok 1 number(s): "139804054"

Test #8:

score: 0
Accepted
time: 30ms
memory: 18668kb

input:

1000000

output:

521718285

result:

ok 1 number(s): "521718285"

Test #9:

score: 0
Accepted
time: 28ms
memory: 20996kb

input:

10000000

output:

503104917

result:

ok 1 number(s): "503104917"

Test #10:

score: -100
Wrong Answer
time: 33ms
memory: 21152kb

input:

100000000

output:

388391491

result:

wrong answer 1st numbers differ - expected: '198815604', found: '388391491'